@blueking/date-picker 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/date-picker",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "蓝鲸监控平台日期时间选择",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -57,6 +57,6 @@ export declare class DateRange {
57
57
  }
58
58
  export declare const transformValue2Dayjs: (val: DateValue[number], type?: "end" | "start", timezone?: string) => dayjs.Dayjs | undefined;
59
59
  export declare const transformDateRange2Dayjs: (dateValue: DateValue, timezone?: string) => (dayjs.Dayjs | undefined)[];
60
- export declare const inputVal2Dayjs: (val: string, format: string, defaultDate?: Dayjs) => dayjs.Dayjs;
60
+ export declare const inputVal2Dayjs: (val: string, format: string, defaultDate?: Dayjs, timezone?: string) => dayjs.Dayjs;
61
61
  export declare function getTimezoneOffset(timezone: string): number;
62
62
  export declare const isValidTimeZone: (timeZone: string) => boolean;
@@ -26232,7 +26232,7 @@ class DateRange {
26232
26232
  const [, endNum, endUnit, endDiffUnit] = end2.match(commonDateRegexp) || [];
26233
26233
  if (startDiffUnit) {
26234
26234
  if (end2 === NowConstant) return DateMode.NATURAL;
26235
- if (startNum && +endNum == -1) {
26235
+ if (startNum && +endNum === -1) {
26236
26236
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
26237
26237
  }
26238
26238
  }
@@ -26395,7 +26395,7 @@ class DateRange {
26395
26395
  }
26396
26396
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
26397
26397
  const commonPrefix = startDate.format(commonFormat.trim());
26398
- if (!remainingFormat || remainingFormat == format) {
26398
+ if (!remainingFormat || remainingFormat === format) {
26399
26399
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
26400
26400
  }
26401
26401
  const formattedStart = startDate.format(remainingFormat);
@@ -26505,7 +26505,7 @@ const transformDateRange2Dayjs = (dateValue, timezone) => {
26505
26505
  const endDate = transformValue2Dayjs(end2, "end", timezone);
26506
26506
  return [startDate, endDate];
26507
26507
  };
26508
- const inputVal2Dayjs = (val, format, defaultDate) => {
26508
+ const inputVal2Dayjs = (val, format, defaultDate, timezone) => {
26509
26509
  let date;
26510
26510
  if (commonDateRegexp.test(val)) {
26511
26511
  date = transformValue2Dayjs(val);
@@ -26527,11 +26527,11 @@ const inputVal2Dayjs = (val, format, defaultDate) => {
26527
26527
  validate = validate && M2 < 12;
26528
26528
  const y2 = d2[1];
26529
26529
  validate = validate && y2.length < 5;
26530
- date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)) : defaultDate;
26530
+ date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)).tz(timezone || dayjs.tz.guess(), true) : defaultDate;
26531
26531
  }
26532
26532
  }
26533
26533
  if (!date) {
26534
- date = dayjs(val);
26534
+ date = dayjs(dayjs(val).valueOf()).tz(timezone || dayjs.tz.guess(), true);
26535
26535
  }
26536
26536
  return date;
26537
26537
  };
@@ -26544,7 +26544,7 @@ const isValidTimeZone = (timeZone) => {
26544
26544
  try {
26545
26545
  new Intl.DateTimeFormat("en-US", { timeZone });
26546
26546
  return true;
26547
- } catch (e) {
26547
+ } catch {
26548
26548
  return false;
26549
26549
  }
26550
26550
  };
@@ -27173,7 +27173,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
27173
27173
  handleIsNowChange(type);
27174
27174
  return;
27175
27175
  }
27176
- let date = inputVal2Dayjs(val, format.value, editDate);
27176
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
27177
27177
  if (date.isValid()) {
27178
27178
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
27179
27179
  curNow.value = val === NowConstant;
@@ -33835,7 +33835,7 @@ ${$(r2)}`), n2;
33835
33835
  const [, endNum, endUnit, endDiffUnit] = end2.match(commonDateRegexp) || [];
33836
33836
  if (startDiffUnit) {
33837
33837
  if (end2 === NowConstant) return DateMode.NATURAL;
33838
- if (startNum && +endNum == -1) {
33838
+ if (startNum && +endNum === -1) {
33839
33839
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
33840
33840
  }
33841
33841
  }
@@ -33998,7 +33998,7 @@ ${$(r2)}`), n2;
33998
33998
  }
33999
33999
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
34000
34000
  const commonPrefix = startDate.format(commonFormat.trim());
34001
- if (!remainingFormat || remainingFormat == format) {
34001
+ if (!remainingFormat || remainingFormat === format) {
34002
34002
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
34003
34003
  }
34004
34004
  const formattedStart = startDate.format(remainingFormat);
@@ -34108,7 +34108,7 @@ ${$(r2)}`), n2;
34108
34108
  const endDate = transformValue2Dayjs(end2, "end", timezone2);
34109
34109
  return [startDate, endDate];
34110
34110
  };
34111
- const inputVal2Dayjs = (val, format, defaultDate) => {
34111
+ const inputVal2Dayjs = (val, format, defaultDate, timezone2) => {
34112
34112
  let date;
34113
34113
  if (commonDateRegexp.test(val)) {
34114
34114
  date = transformValue2Dayjs(val);
@@ -34130,11 +34130,11 @@ ${$(r2)}`), n2;
34130
34130
  validate = validate && M2 < 12;
34131
34131
  const y2 = d2[1];
34132
34132
  validate = validate && y2.length < 5;
34133
- date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)) : defaultDate;
34133
+ date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)).tz(timezone2 || dayjs.tz.guess(), true) : defaultDate;
34134
34134
  }
34135
34135
  }
34136
34136
  if (!date) {
34137
- date = dayjs(val);
34137
+ date = dayjs(dayjs(val).valueOf()).tz(timezone2 || dayjs.tz.guess(), true);
34138
34138
  }
34139
34139
  return date;
34140
34140
  };
@@ -34147,7 +34147,7 @@ ${$(r2)}`), n2;
34147
34147
  try {
34148
34148
  new Intl.DateTimeFormat("en-US", { timeZone });
34149
34149
  return true;
34150
- } catch (e) {
34150
+ } catch {
34151
34151
  return false;
34152
34152
  }
34153
34153
  };
@@ -34776,7 +34776,7 @@ ${$(r2)}`), n2;
34776
34776
  handleIsNowChange(type);
34777
34777
  return;
34778
34778
  }
34779
- let date = inputVal2Dayjs(val, format.value, editDate);
34779
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
34780
34780
  if (date.isValid()) {
34781
34781
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
34782
34782
  curNow.value = val === NowConstant;
@@ -26247,7 +26247,7 @@ ${$(r2)}`), n2;
26247
26247
  const [, endNum, endUnit, endDiffUnit] = end2.match(commonDateRegexp) || [];
26248
26248
  if (startDiffUnit) {
26249
26249
  if (end2 === NowConstant) return DateMode.NATURAL;
26250
- if (startNum && +endNum == -1) {
26250
+ if (startNum && +endNum === -1) {
26251
26251
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
26252
26252
  }
26253
26253
  }
@@ -26410,7 +26410,7 @@ ${$(r2)}`), n2;
26410
26410
  }
26411
26411
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
26412
26412
  const commonPrefix = startDate.format(commonFormat.trim());
26413
- if (!remainingFormat || remainingFormat == format) {
26413
+ if (!remainingFormat || remainingFormat === format) {
26414
26414
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
26415
26415
  }
26416
26416
  const formattedStart = startDate.format(remainingFormat);
@@ -26520,7 +26520,7 @@ ${$(r2)}`), n2;
26520
26520
  const endDate = transformValue2Dayjs(end2, "end", timezone);
26521
26521
  return [startDate, endDate];
26522
26522
  };
26523
- const inputVal2Dayjs = (val, format, defaultDate) => {
26523
+ const inputVal2Dayjs = (val, format, defaultDate, timezone) => {
26524
26524
  let date;
26525
26525
  if (commonDateRegexp.test(val)) {
26526
26526
  date = transformValue2Dayjs(val);
@@ -26542,11 +26542,11 @@ ${$(r2)}`), n2;
26542
26542
  validate = validate && M2 < 12;
26543
26543
  const y2 = d2[1];
26544
26544
  validate = validate && y2.length < 5;
26545
- date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)) : defaultDate;
26545
+ date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)).tz(timezone || dayjs.tz.guess(), true) : defaultDate;
26546
26546
  }
26547
26547
  }
26548
26548
  if (!date) {
26549
- date = dayjs(val);
26549
+ date = dayjs(dayjs(val).valueOf()).tz(timezone || dayjs.tz.guess(), true);
26550
26550
  }
26551
26551
  return date;
26552
26552
  };
@@ -26559,7 +26559,7 @@ ${$(r2)}`), n2;
26559
26559
  try {
26560
26560
  new Intl.DateTimeFormat("en-US", { timeZone });
26561
26561
  return true;
26562
- } catch (e) {
26562
+ } catch {
26563
26563
  return false;
26564
26564
  }
26565
26565
  };
@@ -27188,7 +27188,7 @@ ${$(r2)}`), n2;
27188
27188
  handleIsNowChange(type);
27189
27189
  return;
27190
27190
  }
27191
- let date = inputVal2Dayjs(val, format.value, editDate);
27191
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
27192
27192
  if (date.isValid()) {
27193
27193
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
27194
27194
  curNow.value = val === NowConstant;
@@ -1946,7 +1946,7 @@ class DateRange {
1946
1946
  const [, endNum, endUnit, endDiffUnit] = end.match(commonDateRegexp) || [];
1947
1947
  if (startDiffUnit) {
1948
1948
  if (end === NowConstant) return DateMode.NATURAL;
1949
- if (startNum && +endNum == -1) {
1949
+ if (startNum && +endNum === -1) {
1950
1950
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
1951
1951
  }
1952
1952
  }
@@ -2109,7 +2109,7 @@ class DateRange {
2109
2109
  }
2110
2110
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
2111
2111
  const commonPrefix = startDate.format(commonFormat.trim());
2112
- if (!remainingFormat || remainingFormat == format) {
2112
+ if (!remainingFormat || remainingFormat === format) {
2113
2113
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
2114
2114
  }
2115
2115
  const formattedStart = startDate.format(remainingFormat);
@@ -2219,7 +2219,7 @@ const transformDateRange2Dayjs = (dateValue, timezone) => {
2219
2219
  const endDate = transformValue2Dayjs(end, "end", timezone);
2220
2220
  return [startDate, endDate];
2221
2221
  };
2222
- const inputVal2Dayjs = (val, format, defaultDate) => {
2222
+ const inputVal2Dayjs = (val, format, defaultDate, timezone) => {
2223
2223
  let date;
2224
2224
  if (commonDateRegexp.test(val)) {
2225
2225
  date = transformValue2Dayjs(val);
@@ -2241,11 +2241,11 @@ const inputVal2Dayjs = (val, format, defaultDate) => {
2241
2241
  validate = validate && M < 12;
2242
2242
  const y = d[1];
2243
2243
  validate = validate && y.length < 5;
2244
- date = validate ? dayjs(new Date(+y, M, +day, +h2, +m, +s, +ms)) : defaultDate;
2244
+ date = validate ? dayjs(new Date(+y, M, +day, +h2, +m, +s, +ms)).tz(timezone || dayjs.tz.guess(), true) : defaultDate;
2245
2245
  }
2246
2246
  }
2247
2247
  if (!date) {
2248
- date = dayjs(val);
2248
+ date = dayjs(dayjs(val).valueOf()).tz(timezone || dayjs.tz.guess(), true);
2249
2249
  }
2250
2250
  return date;
2251
2251
  };
@@ -2258,7 +2258,7 @@ const isValidTimeZone = (timeZone) => {
2258
2258
  try {
2259
2259
  new Intl.DateTimeFormat("en-US", { timeZone });
2260
2260
  return true;
2261
- } catch (e) {
2261
+ } catch {
2262
2262
  return false;
2263
2263
  }
2264
2264
  };
@@ -2887,7 +2887,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2887
2887
  handleIsNowChange(type);
2888
2888
  return;
2889
2889
  }
2890
- let date = inputVal2Dayjs(val, format.value, editDate);
2890
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
2891
2891
  if (date.isValid()) {
2892
2892
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
2893
2893
  curNow.value = val === NowConstant;
@@ -26853,7 +26853,7 @@ ${$(r2)}`), n2;
26853
26853
  const [, endNum, endUnit, endDiffUnit] = end2.match(commonDateRegexp) || [];
26854
26854
  if (startDiffUnit) {
26855
26855
  if (end2 === NowConstant) return DateMode.NATURAL;
26856
- if (startNum && +endNum == -1) {
26856
+ if (startNum && +endNum === -1) {
26857
26857
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
26858
26858
  }
26859
26859
  }
@@ -27016,7 +27016,7 @@ ${$(r2)}`), n2;
27016
27016
  }
27017
27017
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
27018
27018
  const commonPrefix = startDate.format(commonFormat.trim());
27019
- if (!remainingFormat || remainingFormat == format) {
27019
+ if (!remainingFormat || remainingFormat === format) {
27020
27020
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
27021
27021
  }
27022
27022
  const formattedStart = startDate.format(remainingFormat);
@@ -27126,7 +27126,7 @@ ${$(r2)}`), n2;
27126
27126
  const endDate = transformValue2Dayjs(end2, "end", timezone2);
27127
27127
  return [startDate, endDate];
27128
27128
  };
27129
- const inputVal2Dayjs = (val, format, defaultDate) => {
27129
+ const inputVal2Dayjs = (val, format, defaultDate, timezone2) => {
27130
27130
  let date;
27131
27131
  if (commonDateRegexp.test(val)) {
27132
27132
  date = transformValue2Dayjs(val);
@@ -27148,11 +27148,11 @@ ${$(r2)}`), n2;
27148
27148
  validate = validate && M2 < 12;
27149
27149
  const y2 = d2[1];
27150
27150
  validate = validate && y2.length < 5;
27151
- date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)) : defaultDate;
27151
+ date = validate ? dayjs(new Date(+y2, M2, +day, +h2, +m2, +s2, +ms)).tz(timezone2 || dayjs.tz.guess(), true) : defaultDate;
27152
27152
  }
27153
27153
  }
27154
27154
  if (!date) {
27155
- date = dayjs(val);
27155
+ date = dayjs(dayjs(val).valueOf()).tz(timezone2 || dayjs.tz.guess(), true);
27156
27156
  }
27157
27157
  return date;
27158
27158
  };
@@ -27165,7 +27165,7 @@ ${$(r2)}`), n2;
27165
27165
  try {
27166
27166
  new Intl.DateTimeFormat("en-US", { timeZone });
27167
27167
  return true;
27168
- } catch (e) {
27168
+ } catch {
27169
27169
  return false;
27170
27170
  }
27171
27171
  };
@@ -27794,7 +27794,7 @@ ${$(r2)}`), n2;
27794
27794
  handleIsNowChange(type);
27795
27795
  return;
27796
27796
  }
27797
- let date = inputVal2Dayjs(val, format.value, editDate);
27797
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
27798
27798
  if (date.isValid()) {
27799
27799
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
27800
27800
  curNow.value = val === NowConstant;
@@ -1942,7 +1942,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1942
1942
  const [, endNum, endUnit, endDiffUnit] = end.match(commonDateRegexp) || [];
1943
1943
  if (startDiffUnit) {
1944
1944
  if (end === NowConstant) return DateMode.NATURAL;
1945
- if (startNum && +endNum == -1) {
1945
+ if (startNum && +endNum === -1) {
1946
1946
  if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
1947
1947
  }
1948
1948
  }
@@ -2105,7 +2105,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2105
2105
  }
2106
2106
  remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
2107
2107
  const commonPrefix = startDate.format(commonFormat.trim());
2108
- if (!remainingFormat || remainingFormat == format) {
2108
+ if (!remainingFormat || remainingFormat === format) {
2109
2109
  return `${startDate.format(format)} ~ ${endDate.format(format)}`;
2110
2110
  }
2111
2111
  const formattedStart = startDate.format(remainingFormat);
@@ -2215,7 +2215,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2215
2215
  const endDate = transformValue2Dayjs(end, "end", timezone);
2216
2216
  return [startDate, endDate];
2217
2217
  };
2218
- const inputVal2Dayjs = (val, format, defaultDate) => {
2218
+ const inputVal2Dayjs = (val, format, defaultDate, timezone) => {
2219
2219
  let date;
2220
2220
  if (commonDateRegexp.test(val)) {
2221
2221
  date = transformValue2Dayjs(val);
@@ -2237,11 +2237,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2237
2237
  validate = validate && M < 12;
2238
2238
  const y = d[1];
2239
2239
  validate = validate && y.length < 5;
2240
- date = validate ? dayjs(new Date(+y, M, +day, +h, +m, +s, +ms)) : defaultDate;
2240
+ date = validate ? dayjs(new Date(+y, M, +day, +h, +m, +s, +ms)).tz(timezone || dayjs.tz.guess(), true) : defaultDate;
2241
2241
  }
2242
2242
  }
2243
2243
  if (!date) {
2244
- date = dayjs(val);
2244
+ date = dayjs(dayjs(val).valueOf()).tz(timezone || dayjs.tz.guess(), true);
2245
2245
  }
2246
2246
  return date;
2247
2247
  };
@@ -2254,7 +2254,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2254
2254
  try {
2255
2255
  new Intl.DateTimeFormat("en-US", { timeZone });
2256
2256
  return true;
2257
- } catch (e) {
2257
+ } catch {
2258
2258
  return false;
2259
2259
  }
2260
2260
  };
@@ -2883,7 +2883,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2883
2883
  handleIsNowChange(type);
2884
2884
  return;
2885
2885
  }
2886
- let date = inputVal2Dayjs(val, format.value, editDate);
2886
+ let date = inputVal2Dayjs(val, format.value, editDate, timezoneInfo.value.label);
2887
2887
  if (date.isValid()) {
2888
2888
  if (!(editDate == null ? void 0 : editDate.isSame(date))) {
2889
2889
  curNow.value = val === NowConstant;