@blueking/date-picker 2.0.0-beta.32 → 2.0.0-beta.33
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 +1 -1
- package/typings/utils/constant.d.ts +1 -0
- package/typings/utils/date.d.ts +1 -0
- package/vue2/index.es.min.js +41 -21
- package/vue2/index.iife.min.js +41 -21
- package/vue2/index.umd.min.js +41 -21
- package/vue3/index.es.min.js +41 -21
- package/vue3/index.iife.min.js +41 -21
- package/vue3/index.umd.min.js +41 -21
package/package.json
CHANGED
package/typings/utils/date.d.ts
CHANGED
|
@@ -47,3 +47,4 @@ export declare const transformValue2Dayjs: (val: DateValue[number], type?: "end"
|
|
|
47
47
|
export declare const transformDateRange2Dayjs: (dateValue: DateValue, timezome?: string) => (dayjs.Dayjs | undefined)[];
|
|
48
48
|
export declare const inputVal2Dayjs: (val: string, format: string, defaultDate?: Dayjs) => dayjs.Dayjs;
|
|
49
49
|
export declare function getTimezoneOffset(timezone: string): number;
|
|
50
|
+
export declare const isValidTimeZone: (timeZone: string) => boolean;
|
package/vue2/index.es.min.js
CHANGED
|
@@ -23234,6 +23234,7 @@ const commonDateList = [
|
|
|
23234
23234
|
const NowConstant = "now";
|
|
23235
23235
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
23236
23236
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
23237
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
23237
23238
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23238
23239
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23239
23240
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -23573,6 +23574,14 @@ function getTimezoneOffset(timezone) {
|
|
|
23573
23574
|
const offset2 = localTime.utcOffset() / 60;
|
|
23574
23575
|
return offset2;
|
|
23575
23576
|
}
|
|
23577
|
+
const isValidTimeZone = (timeZone) => {
|
|
23578
|
+
try {
|
|
23579
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
23580
|
+
return true;
|
|
23581
|
+
} catch (e) {
|
|
23582
|
+
return false;
|
|
23583
|
+
}
|
|
23584
|
+
};
|
|
23576
23585
|
dayjs.extend(utc);
|
|
23577
23586
|
dayjs.extend(tz);
|
|
23578
23587
|
const timezoneData = [
|
|
@@ -26710,8 +26719,14 @@ const _hoisted_6 = {
|
|
|
26710
26719
|
class: "time-zone-panel"
|
|
26711
26720
|
};
|
|
26712
26721
|
const _hoisted_7 = { class: "time-zone" };
|
|
26713
|
-
const _hoisted_8 = {
|
|
26714
|
-
|
|
26722
|
+
const _hoisted_8 = {
|
|
26723
|
+
key: 0,
|
|
26724
|
+
class: "time-zone-area"
|
|
26725
|
+
};
|
|
26726
|
+
const _hoisted_9 = {
|
|
26727
|
+
key: 0,
|
|
26728
|
+
class: "time-zone-tag"
|
|
26729
|
+
};
|
|
26715
26730
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
26716
26731
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
26717
26732
|
__name: "panel-wrapper",
|
|
@@ -26873,21 +26888,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
26873
26888
|
1
|
|
26874
26889
|
/* TEXT */
|
|
26875
26890
|
),
|
|
26876
|
-
|
|
26891
|
+
unref(timezoneInfo).country ? (openBlock(), createElementBlock(
|
|
26877
26892
|
"span",
|
|
26878
26893
|
_hoisted_8,
|
|
26879
26894
|
toDisplayString(unref(timezoneInfo).country) + ", " + toDisplayString(unref(timezoneInfo).abbreviation),
|
|
26880
26895
|
1
|
|
26881
26896
|
/* TEXT */
|
|
26882
|
-
)
|
|
26897
|
+
)) : createCommentVNode("v-if", true)
|
|
26883
26898
|
]),
|
|
26884
|
-
|
|
26899
|
+
typeof unref(timezoneInfo).utc !== "undefined" ? (openBlock(), createElementBlock(
|
|
26885
26900
|
"span",
|
|
26886
26901
|
_hoisted_9,
|
|
26887
26902
|
toDisplayString(unref(timezoneInfo).utc),
|
|
26888
26903
|
1
|
|
26889
26904
|
/* TEXT */
|
|
26890
|
-
),
|
|
26905
|
+
)) : createCommentVNode("v-if", true),
|
|
26891
26906
|
createVNode(unref(__webpack_exports__default$a), {
|
|
26892
26907
|
class: "time-zone-btn",
|
|
26893
26908
|
size: "small",
|
|
@@ -26985,9 +27000,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26985
27000
|
const dateTooltipsRef = ref();
|
|
26986
27001
|
const dateContentRef = ref();
|
|
26987
27002
|
const format = computed(() => props2.format);
|
|
26988
|
-
const timezoneInfo = computed(() =>
|
|
27003
|
+
const timezoneInfo = computed(() => {
|
|
27004
|
+
let timezone = props2.timezone || dayjs.tz.guess();
|
|
27005
|
+
if (!isValidTimeZone(timezone)) {
|
|
27006
|
+
console.error(`invalid timezone: ${props2.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
27007
|
+
timezone = DEFAULT_TIMEZONE;
|
|
27008
|
+
}
|
|
27009
|
+
return getTimezoneInfoByValue(timezone) || { label: props2.timezone, value: props2.timezone };
|
|
27010
|
+
});
|
|
26989
27011
|
const diffTimezone = computed(() => {
|
|
26990
|
-
const timezone =
|
|
27012
|
+
const timezone = timezoneInfo.value.label;
|
|
26991
27013
|
if (!timezone || props2.timezone === dayjs.tz.guess()) return 0;
|
|
26992
27014
|
const a2 = dayjs().utcOffset();
|
|
26993
27015
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
@@ -27004,7 +27026,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27004
27026
|
var _a, _b;
|
|
27005
27027
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
27006
27028
|
return;
|
|
27007
|
-
dateDetail.value = new DateRange(v2, format.value,
|
|
27029
|
+
dateDetail.value = new DateRange(v2, format.value, timezoneInfo.value.label);
|
|
27008
27030
|
},
|
|
27009
27031
|
{
|
|
27010
27032
|
immediate: true
|
|
@@ -27033,11 +27055,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27033
27055
|
if (enterTimer) return;
|
|
27034
27056
|
enterTimer = setTimeout(() => {
|
|
27035
27057
|
tooltipsShow.value = true;
|
|
27036
|
-
tooltipsDetail.value = new DateRange(
|
|
27037
|
-
dateDetail.value.dateValue,
|
|
27038
|
-
format.value,
|
|
27039
|
-
props2.timezone || dayjs.tz.guess()
|
|
27040
|
-
);
|
|
27058
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
27041
27059
|
enterTimer = null;
|
|
27042
27060
|
}, 100);
|
|
27043
27061
|
}
|
|
@@ -27053,7 +27071,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27053
27071
|
const [start2, end2] = val;
|
|
27054
27072
|
const [oldStart, oldEnd] = props2.modelValue || [];
|
|
27055
27073
|
if (start2 && end2 && start2 === oldStart && end2 === oldEnd) return;
|
|
27056
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
27074
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
27057
27075
|
const emitValue = dateDetail.value.toEmitValue();
|
|
27058
27076
|
emits("update:modelValue", ...emitValue);
|
|
27059
27077
|
const canStore = commonDateUseList.value.some((item) => item[0] === start2 && item[1] === end2);
|
|
@@ -27138,13 +27156,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27138
27156
|
createVNode(_sfc_main$1, {
|
|
27139
27157
|
"default-date": dateDetail.value,
|
|
27140
27158
|
"need-timezone": _ctx.needTimezone,
|
|
27141
|
-
timezone:
|
|
27159
|
+
timezone: timezoneInfo.value.label,
|
|
27142
27160
|
onChange: handleChange,
|
|
27143
27161
|
"onUpdate:timezone": handleTimezoneChange
|
|
27144
27162
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
27145
27163
|
]),
|
|
27146
27164
|
default: withCtx(() => {
|
|
27147
|
-
var _a;
|
|
27165
|
+
var _a, _b, _c, _d;
|
|
27148
27166
|
return [
|
|
27149
27167
|
withDirectives((openBlock(), createElementBlock(
|
|
27150
27168
|
"span",
|
|
@@ -27166,10 +27184,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27166
27184
|
1
|
|
27167
27185
|
/* TEXT */
|
|
27168
27186
|
),
|
|
27169
|
-
_ctx.needTimezone && timezoneInfo.value.label !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
27187
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
27170
27188
|
"span",
|
|
27171
27189
|
_hoisted_2,
|
|
27172
|
-
toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
27190
|
+
toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
27173
27191
|
1
|
|
27174
27192
|
/* TEXT */
|
|
27175
27193
|
)) : createCommentVNode("v-if", true)
|
|
@@ -27198,7 +27216,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27198
27216
|
trigger: "manual"
|
|
27199
27217
|
}, {
|
|
27200
27218
|
content: withCtx(() => {
|
|
27201
|
-
var _a, _b;
|
|
27219
|
+
var _a, _b, _c, _d, _e;
|
|
27202
27220
|
return [
|
|
27203
27221
|
createElementVNode(
|
|
27204
27222
|
"div",
|
|
@@ -27227,7 +27245,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27227
27245
|
createElementVNode(
|
|
27228
27246
|
"div",
|
|
27229
27247
|
_hoisted_3,
|
|
27230
|
-
toDisplayString(timezoneInfo.value.label === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
27248
|
+
toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
27231
27249
|
1
|
|
27232
27250
|
/* TEXT */
|
|
27233
27251
|
),
|
|
@@ -27333,6 +27351,7 @@ export {
|
|
|
27333
27351
|
CommonNaturalOptions,
|
|
27334
27352
|
DATE_REGEX_FORMAT,
|
|
27335
27353
|
DATE_REGEX_PARSE,
|
|
27354
|
+
DEFAULT_TIMEZONE,
|
|
27336
27355
|
DateRange,
|
|
27337
27356
|
DateUnitList,
|
|
27338
27357
|
NaturalOptionType,
|
|
@@ -27350,6 +27369,7 @@ export {
|
|
|
27350
27369
|
getStoreTabKey,
|
|
27351
27370
|
getTimezoneOffset,
|
|
27352
27371
|
inputVal2Dayjs,
|
|
27372
|
+
isValidTimeZone,
|
|
27353
27373
|
naturalDateRegexp,
|
|
27354
27374
|
naturalDateShortcutMap,
|
|
27355
27375
|
naturalUnitOptions,
|
package/vue2/index.iife.min.js
CHANGED
|
@@ -30255,6 +30255,7 @@ ${$(r2)}`), n2;
|
|
|
30255
30255
|
const NowConstant = "now";
|
|
30256
30256
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
30257
30257
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
30258
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
30258
30259
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
30259
30260
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
30260
30261
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -30594,6 +30595,14 @@ ${$(r2)}`), n2;
|
|
|
30594
30595
|
const offset2 = localTime.utcOffset() / 60;
|
|
30595
30596
|
return offset2;
|
|
30596
30597
|
}
|
|
30598
|
+
const isValidTimeZone = (timeZone) => {
|
|
30599
|
+
try {
|
|
30600
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
30601
|
+
return true;
|
|
30602
|
+
} catch (e) {
|
|
30603
|
+
return false;
|
|
30604
|
+
}
|
|
30605
|
+
};
|
|
30597
30606
|
dayjs.extend(utc);
|
|
30598
30607
|
dayjs.extend(tz);
|
|
30599
30608
|
const timezoneData = [
|
|
@@ -33731,8 +33740,14 @@ ${$(r2)}`), n2;
|
|
|
33731
33740
|
class: "time-zone-panel"
|
|
33732
33741
|
};
|
|
33733
33742
|
const _hoisted_7 = { class: "time-zone" };
|
|
33734
|
-
const _hoisted_8 = {
|
|
33735
|
-
|
|
33743
|
+
const _hoisted_8 = {
|
|
33744
|
+
key: 0,
|
|
33745
|
+
class: "time-zone-area"
|
|
33746
|
+
};
|
|
33747
|
+
const _hoisted_9 = {
|
|
33748
|
+
key: 0,
|
|
33749
|
+
class: "time-zone-tag"
|
|
33750
|
+
};
|
|
33736
33751
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
33737
33752
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
33738
33753
|
__name: "panel-wrapper",
|
|
@@ -33894,21 +33909,21 @@ ${$(r2)}`), n2;
|
|
|
33894
33909
|
1
|
|
33895
33910
|
/* TEXT */
|
|
33896
33911
|
),
|
|
33897
|
-
|
|
33912
|
+
unref(timezoneInfo).country ? (openBlock(), createElementBlock(
|
|
33898
33913
|
"span",
|
|
33899
33914
|
_hoisted_8,
|
|
33900
33915
|
toDisplayString(unref(timezoneInfo).country) + ", " + toDisplayString(unref(timezoneInfo).abbreviation),
|
|
33901
33916
|
1
|
|
33902
33917
|
/* TEXT */
|
|
33903
|
-
)
|
|
33918
|
+
)) : createCommentVNode("v-if", true)
|
|
33904
33919
|
]),
|
|
33905
|
-
|
|
33920
|
+
typeof unref(timezoneInfo).utc !== "undefined" ? (openBlock(), createElementBlock(
|
|
33906
33921
|
"span",
|
|
33907
33922
|
_hoisted_9,
|
|
33908
33923
|
toDisplayString(unref(timezoneInfo).utc),
|
|
33909
33924
|
1
|
|
33910
33925
|
/* TEXT */
|
|
33911
|
-
),
|
|
33926
|
+
)) : createCommentVNode("v-if", true),
|
|
33912
33927
|
createVNode(unref(__webpack_exports__default$a), {
|
|
33913
33928
|
class: "time-zone-btn",
|
|
33914
33929
|
size: "small",
|
|
@@ -34006,9 +34021,16 @@ ${$(r2)}`), n2;
|
|
|
34006
34021
|
const dateTooltipsRef = ref();
|
|
34007
34022
|
const dateContentRef = ref();
|
|
34008
34023
|
const format = computed(() => props2.format);
|
|
34009
|
-
const timezoneInfo = computed(() =>
|
|
34024
|
+
const timezoneInfo = computed(() => {
|
|
34025
|
+
let timezone2 = props2.timezone || dayjs.tz.guess();
|
|
34026
|
+
if (!isValidTimeZone(timezone2)) {
|
|
34027
|
+
console.error(`invalid timezone: ${props2.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
34028
|
+
timezone2 = DEFAULT_TIMEZONE;
|
|
34029
|
+
}
|
|
34030
|
+
return getTimezoneInfoByValue(timezone2) || { label: props2.timezone, value: props2.timezone };
|
|
34031
|
+
});
|
|
34010
34032
|
const diffTimezone = computed(() => {
|
|
34011
|
-
const timezone2 =
|
|
34033
|
+
const timezone2 = timezoneInfo.value.label;
|
|
34012
34034
|
if (!timezone2 || props2.timezone === dayjs.tz.guess()) return 0;
|
|
34013
34035
|
const a2 = dayjs().utcOffset();
|
|
34014
34036
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
@@ -34025,7 +34047,7 @@ ${$(r2)}`), n2;
|
|
|
34025
34047
|
var _a, _b;
|
|
34026
34048
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
34027
34049
|
return;
|
|
34028
|
-
dateDetail.value = new DateRange(v2, format.value,
|
|
34050
|
+
dateDetail.value = new DateRange(v2, format.value, timezoneInfo.value.label);
|
|
34029
34051
|
},
|
|
34030
34052
|
{
|
|
34031
34053
|
immediate: true
|
|
@@ -34054,11 +34076,7 @@ ${$(r2)}`), n2;
|
|
|
34054
34076
|
if (enterTimer) return;
|
|
34055
34077
|
enterTimer = setTimeout(() => {
|
|
34056
34078
|
tooltipsShow.value = true;
|
|
34057
|
-
tooltipsDetail.value = new DateRange(
|
|
34058
|
-
dateDetail.value.dateValue,
|
|
34059
|
-
format.value,
|
|
34060
|
-
props2.timezone || dayjs.tz.guess()
|
|
34061
|
-
);
|
|
34079
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
34062
34080
|
enterTimer = null;
|
|
34063
34081
|
}, 100);
|
|
34064
34082
|
}
|
|
@@ -34074,7 +34092,7 @@ ${$(r2)}`), n2;
|
|
|
34074
34092
|
const [start2, end2] = val;
|
|
34075
34093
|
const [oldStart, oldEnd] = props2.modelValue || [];
|
|
34076
34094
|
if (start2 && end2 && start2 === oldStart && end2 === oldEnd) return;
|
|
34077
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
34095
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
34078
34096
|
const emitValue = dateDetail.value.toEmitValue();
|
|
34079
34097
|
emits("update:modelValue", ...emitValue);
|
|
34080
34098
|
const canStore = commonDateUseList.value.some((item) => item[0] === start2 && item[1] === end2);
|
|
@@ -34159,13 +34177,13 @@ ${$(r2)}`), n2;
|
|
|
34159
34177
|
createVNode(_sfc_main$1, {
|
|
34160
34178
|
"default-date": dateDetail.value,
|
|
34161
34179
|
"need-timezone": _ctx.needTimezone,
|
|
34162
|
-
timezone:
|
|
34180
|
+
timezone: timezoneInfo.value.label,
|
|
34163
34181
|
onChange: handleChange,
|
|
34164
34182
|
"onUpdate:timezone": handleTimezoneChange
|
|
34165
34183
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
34166
34184
|
]),
|
|
34167
34185
|
default: withCtx(() => {
|
|
34168
|
-
var _a;
|
|
34186
|
+
var _a, _b, _c, _d;
|
|
34169
34187
|
return [
|
|
34170
34188
|
withDirectives((openBlock(), createElementBlock(
|
|
34171
34189
|
"span",
|
|
@@ -34187,10 +34205,10 @@ ${$(r2)}`), n2;
|
|
|
34187
34205
|
1
|
|
34188
34206
|
/* TEXT */
|
|
34189
34207
|
),
|
|
34190
|
-
_ctx.needTimezone && timezoneInfo.value.label !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
34208
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
34191
34209
|
"span",
|
|
34192
34210
|
_hoisted_2,
|
|
34193
|
-
toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
34211
|
+
toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
34194
34212
|
1
|
|
34195
34213
|
/* TEXT */
|
|
34196
34214
|
)) : createCommentVNode("v-if", true)
|
|
@@ -34219,7 +34237,7 @@ ${$(r2)}`), n2;
|
|
|
34219
34237
|
trigger: "manual"
|
|
34220
34238
|
}, {
|
|
34221
34239
|
content: withCtx(() => {
|
|
34222
|
-
var _a, _b;
|
|
34240
|
+
var _a, _b, _c, _d, _e;
|
|
34223
34241
|
return [
|
|
34224
34242
|
createBaseVNode(
|
|
34225
34243
|
"div",
|
|
@@ -34248,7 +34266,7 @@ ${$(r2)}`), n2;
|
|
|
34248
34266
|
createBaseVNode(
|
|
34249
34267
|
"div",
|
|
34250
34268
|
_hoisted_3,
|
|
34251
|
-
toDisplayString(timezoneInfo.value.label === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
34269
|
+
toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
34252
34270
|
1
|
|
34253
34271
|
/* TEXT */
|
|
34254
34272
|
),
|
|
@@ -34353,6 +34371,7 @@ ${$(r2)}`), n2;
|
|
|
34353
34371
|
exports.CommonNaturalOptions = CommonNaturalOptions;
|
|
34354
34372
|
exports.DATE_REGEX_FORMAT = DATE_REGEX_FORMAT;
|
|
34355
34373
|
exports.DATE_REGEX_PARSE = DATE_REGEX_PARSE;
|
|
34374
|
+
exports.DEFAULT_TIMEZONE = DEFAULT_TIMEZONE;
|
|
34356
34375
|
exports.DateRange = DateRange;
|
|
34357
34376
|
exports.DateUnitList = DateUnitList;
|
|
34358
34377
|
exports.NaturalOptionType = NaturalOptionType;
|
|
@@ -34370,6 +34389,7 @@ ${$(r2)}`), n2;
|
|
|
34370
34389
|
exports.getStoreTabKey = getStoreTabKey;
|
|
34371
34390
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
34372
34391
|
exports.inputVal2Dayjs = inputVal2Dayjs;
|
|
34392
|
+
exports.isValidTimeZone = isValidTimeZone;
|
|
34373
34393
|
exports.naturalDateRegexp = naturalDateRegexp;
|
|
34374
34394
|
exports.naturalDateShortcutMap = naturalDateShortcutMap;
|
|
34375
34395
|
exports.naturalUnitOptions = naturalUnitOptions;
|
package/vue2/index.umd.min.js
CHANGED
|
@@ -23249,6 +23249,7 @@ ${$(r2)}`), n2;
|
|
|
23249
23249
|
const NowConstant = "now";
|
|
23250
23250
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
23251
23251
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
23252
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
23252
23253
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23253
23254
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23254
23255
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -23588,6 +23589,14 @@ ${$(r2)}`), n2;
|
|
|
23588
23589
|
const offset2 = localTime.utcOffset() / 60;
|
|
23589
23590
|
return offset2;
|
|
23590
23591
|
}
|
|
23592
|
+
const isValidTimeZone = (timeZone) => {
|
|
23593
|
+
try {
|
|
23594
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
23595
|
+
return true;
|
|
23596
|
+
} catch (e) {
|
|
23597
|
+
return false;
|
|
23598
|
+
}
|
|
23599
|
+
};
|
|
23591
23600
|
dayjs.extend(utc);
|
|
23592
23601
|
dayjs.extend(tz);
|
|
23593
23602
|
const timezoneData = [
|
|
@@ -26725,8 +26734,14 @@ ${$(r2)}`), n2;
|
|
|
26725
26734
|
class: "time-zone-panel"
|
|
26726
26735
|
};
|
|
26727
26736
|
const _hoisted_7 = { class: "time-zone" };
|
|
26728
|
-
const _hoisted_8 = {
|
|
26729
|
-
|
|
26737
|
+
const _hoisted_8 = {
|
|
26738
|
+
key: 0,
|
|
26739
|
+
class: "time-zone-area"
|
|
26740
|
+
};
|
|
26741
|
+
const _hoisted_9 = {
|
|
26742
|
+
key: 0,
|
|
26743
|
+
class: "time-zone-tag"
|
|
26744
|
+
};
|
|
26730
26745
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
26731
26746
|
const _sfc_main$1 = /* @__PURE__ */ __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent({
|
|
26732
26747
|
__name: "panel-wrapper",
|
|
@@ -26888,21 +26903,21 @@ ${$(r2)}`), n2;
|
|
|
26888
26903
|
1
|
|
26889
26904
|
/* TEXT */
|
|
26890
26905
|
),
|
|
26891
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
26906
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).country ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
26892
26907
|
"span",
|
|
26893
26908
|
_hoisted_8,
|
|
26894
26909
|
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).country) + ", " + __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).abbreviation),
|
|
26895
26910
|
1
|
|
26896
26911
|
/* TEXT */
|
|
26897
|
-
)
|
|
26912
|
+
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true)
|
|
26898
26913
|
]),
|
|
26899
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
26914
|
+
typeof __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).utc !== "undefined" ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
26900
26915
|
"span",
|
|
26901
26916
|
_hoisted_9,
|
|
26902
26917
|
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).utc),
|
|
26903
26918
|
1
|
|
26904
26919
|
/* TEXT */
|
|
26905
|
-
),
|
|
26920
|
+
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true),
|
|
26906
26921
|
__WEBPACK_EXTERNAL_MODULE_vue__.createVNode(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$a), {
|
|
26907
26922
|
class: "time-zone-btn",
|
|
26908
26923
|
size: "small",
|
|
@@ -27000,9 +27015,16 @@ ${$(r2)}`), n2;
|
|
|
27000
27015
|
const dateTooltipsRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
27001
27016
|
const dateContentRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
27002
27017
|
const format = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => props2.format);
|
|
27003
|
-
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() =>
|
|
27018
|
+
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
27019
|
+
let timezone = props2.timezone || dayjs.tz.guess();
|
|
27020
|
+
if (!isValidTimeZone(timezone)) {
|
|
27021
|
+
console.error(`invalid timezone: ${props2.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
27022
|
+
timezone = DEFAULT_TIMEZONE;
|
|
27023
|
+
}
|
|
27024
|
+
return getTimezoneInfoByValue(timezone) || { label: props2.timezone, value: props2.timezone };
|
|
27025
|
+
});
|
|
27004
27026
|
const diffTimezone = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
27005
|
-
const timezone =
|
|
27027
|
+
const timezone = timezoneInfo.value.label;
|
|
27006
27028
|
if (!timezone || props2.timezone === dayjs.tz.guess()) return 0;
|
|
27007
27029
|
const a2 = dayjs().utcOffset();
|
|
27008
27030
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
@@ -27019,7 +27041,7 @@ ${$(r2)}`), n2;
|
|
|
27019
27041
|
var _a, _b;
|
|
27020
27042
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
27021
27043
|
return;
|
|
27022
|
-
dateDetail.value = new DateRange(v2, format.value,
|
|
27044
|
+
dateDetail.value = new DateRange(v2, format.value, timezoneInfo.value.label);
|
|
27023
27045
|
},
|
|
27024
27046
|
{
|
|
27025
27047
|
immediate: true
|
|
@@ -27048,11 +27070,7 @@ ${$(r2)}`), n2;
|
|
|
27048
27070
|
if (enterTimer) return;
|
|
27049
27071
|
enterTimer = setTimeout(() => {
|
|
27050
27072
|
tooltipsShow.value = true;
|
|
27051
|
-
tooltipsDetail.value = new DateRange(
|
|
27052
|
-
dateDetail.value.dateValue,
|
|
27053
|
-
format.value,
|
|
27054
|
-
props2.timezone || dayjs.tz.guess()
|
|
27055
|
-
);
|
|
27073
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
27056
27074
|
enterTimer = null;
|
|
27057
27075
|
}, 100);
|
|
27058
27076
|
}
|
|
@@ -27068,7 +27086,7 @@ ${$(r2)}`), n2;
|
|
|
27068
27086
|
const [start2, end2] = val;
|
|
27069
27087
|
const [oldStart, oldEnd] = props2.modelValue || [];
|
|
27070
27088
|
if (start2 && end2 && start2 === oldStart && end2 === oldEnd) return;
|
|
27071
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
27089
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
27072
27090
|
const emitValue = dateDetail.value.toEmitValue();
|
|
27073
27091
|
emits("update:modelValue", ...emitValue);
|
|
27074
27092
|
const canStore = commonDateUseList.value.some((item) => item[0] === start2 && item[1] === end2);
|
|
@@ -27153,13 +27171,13 @@ ${$(r2)}`), n2;
|
|
|
27153
27171
|
__WEBPACK_EXTERNAL_MODULE_vue__.createVNode(_sfc_main$1, {
|
|
27154
27172
|
"default-date": dateDetail.value,
|
|
27155
27173
|
"need-timezone": _ctx.needTimezone,
|
|
27156
|
-
timezone:
|
|
27174
|
+
timezone: timezoneInfo.value.label,
|
|
27157
27175
|
onChange: handleChange,
|
|
27158
27176
|
"onUpdate:timezone": handleTimezoneChange
|
|
27159
27177
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
27160
27178
|
]),
|
|
27161
27179
|
default: __WEBPACK_EXTERNAL_MODULE_vue__.withCtx(() => {
|
|
27162
|
-
var _a;
|
|
27180
|
+
var _a, _b, _c, _d;
|
|
27163
27181
|
return [
|
|
27164
27182
|
__WEBPACK_EXTERNAL_MODULE_vue__.withDirectives((__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27165
27183
|
"span",
|
|
@@ -27181,10 +27199,10 @@ ${$(r2)}`), n2;
|
|
|
27181
27199
|
1
|
|
27182
27200
|
/* TEXT */
|
|
27183
27201
|
),
|
|
27184
|
-
_ctx.needTimezone && timezoneInfo.value.label !== __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27202
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27185
27203
|
"span",
|
|
27186
27204
|
_hoisted_2,
|
|
27187
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
27205
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
27188
27206
|
1
|
|
27189
27207
|
/* TEXT */
|
|
27190
27208
|
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true)
|
|
@@ -27213,7 +27231,7 @@ ${$(r2)}`), n2;
|
|
|
27213
27231
|
trigger: "manual"
|
|
27214
27232
|
}, {
|
|
27215
27233
|
content: __WEBPACK_EXTERNAL_MODULE_vue__.withCtx(() => {
|
|
27216
|
-
var _a, _b;
|
|
27234
|
+
var _a, _b, _c, _d, _e;
|
|
27217
27235
|
return [
|
|
27218
27236
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
27219
27237
|
"div",
|
|
@@ -27242,7 +27260,7 @@ ${$(r2)}`), n2;
|
|
|
27242
27260
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
27243
27261
|
"div",
|
|
27244
27262
|
_hoisted_3,
|
|
27245
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(timezoneInfo.value.label === __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? `${__WEBPACK_EXTERNAL_MODULE_vue__.unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
27263
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? `${__WEBPACK_EXTERNAL_MODULE_vue__.unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
27246
27264
|
1
|
|
27247
27265
|
/* TEXT */
|
|
27248
27266
|
),
|
|
@@ -27347,6 +27365,7 @@ ${$(r2)}`), n2;
|
|
|
27347
27365
|
exports2.CommonNaturalOptions = CommonNaturalOptions;
|
|
27348
27366
|
exports2.DATE_REGEX_FORMAT = DATE_REGEX_FORMAT;
|
|
27349
27367
|
exports2.DATE_REGEX_PARSE = DATE_REGEX_PARSE;
|
|
27368
|
+
exports2.DEFAULT_TIMEZONE = DEFAULT_TIMEZONE;
|
|
27350
27369
|
exports2.DateRange = DateRange;
|
|
27351
27370
|
exports2.DateUnitList = DateUnitList;
|
|
27352
27371
|
exports2.NaturalOptionType = NaturalOptionType;
|
|
@@ -27364,6 +27383,7 @@ ${$(r2)}`), n2;
|
|
|
27364
27383
|
exports2.getStoreTabKey = getStoreTabKey;
|
|
27365
27384
|
exports2.getTimezoneOffset = getTimezoneOffset;
|
|
27366
27385
|
exports2.inputVal2Dayjs = inputVal2Dayjs;
|
|
27386
|
+
exports2.isValidTimeZone = isValidTimeZone;
|
|
27367
27387
|
exports2.naturalDateRegexp = naturalDateRegexp;
|
|
27368
27388
|
exports2.naturalDateShortcutMap = naturalDateShortcutMap;
|
|
27369
27389
|
exports2.naturalUnitOptions = naturalUnitOptions;
|
package/vue3/index.es.min.js
CHANGED
|
@@ -319,6 +319,7 @@ const commonDateList = [
|
|
|
319
319
|
const NowConstant = "now";
|
|
320
320
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
321
321
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
322
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
322
323
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
323
324
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
324
325
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -658,6 +659,14 @@ function getTimezoneOffset(timezone) {
|
|
|
658
659
|
const offset = localTime.utcOffset() / 60;
|
|
659
660
|
return offset;
|
|
660
661
|
}
|
|
662
|
+
const isValidTimeZone = (timeZone) => {
|
|
663
|
+
try {
|
|
664
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
665
|
+
return true;
|
|
666
|
+
} catch (e) {
|
|
667
|
+
return false;
|
|
668
|
+
}
|
|
669
|
+
};
|
|
661
670
|
dayjs.extend(utc);
|
|
662
671
|
dayjs.extend(tz);
|
|
663
672
|
const timezoneData = [
|
|
@@ -3795,8 +3804,14 @@ const _hoisted_6 = {
|
|
|
3795
3804
|
class: "time-zone-panel"
|
|
3796
3805
|
};
|
|
3797
3806
|
const _hoisted_7 = { class: "time-zone" };
|
|
3798
|
-
const _hoisted_8 = {
|
|
3799
|
-
|
|
3807
|
+
const _hoisted_8 = {
|
|
3808
|
+
key: 0,
|
|
3809
|
+
class: "time-zone-area"
|
|
3810
|
+
};
|
|
3811
|
+
const _hoisted_9 = {
|
|
3812
|
+
key: 0,
|
|
3813
|
+
class: "time-zone-tag"
|
|
3814
|
+
};
|
|
3800
3815
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
3801
3816
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3802
3817
|
__name: "panel-wrapper",
|
|
@@ -3958,21 +3973,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3958
3973
|
1
|
|
3959
3974
|
/* TEXT */
|
|
3960
3975
|
),
|
|
3961
|
-
|
|
3976
|
+
unref(timezoneInfo).country ? (openBlock(), createElementBlock(
|
|
3962
3977
|
"span",
|
|
3963
3978
|
_hoisted_8,
|
|
3964
3979
|
toDisplayString(unref(timezoneInfo).country) + ", " + toDisplayString(unref(timezoneInfo).abbreviation),
|
|
3965
3980
|
1
|
|
3966
3981
|
/* TEXT */
|
|
3967
|
-
)
|
|
3982
|
+
)) : createCommentVNode("v-if", true)
|
|
3968
3983
|
]),
|
|
3969
|
-
|
|
3984
|
+
typeof unref(timezoneInfo).utc !== "undefined" ? (openBlock(), createElementBlock(
|
|
3970
3985
|
"span",
|
|
3971
3986
|
_hoisted_9,
|
|
3972
3987
|
toDisplayString(unref(timezoneInfo).utc),
|
|
3973
3988
|
1
|
|
3974
3989
|
/* TEXT */
|
|
3975
|
-
),
|
|
3990
|
+
)) : createCommentVNode("v-if", true),
|
|
3976
3991
|
createVNode(unref(Button), {
|
|
3977
3992
|
class: "time-zone-btn",
|
|
3978
3993
|
size: "small",
|
|
@@ -4070,9 +4085,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4070
4085
|
const dateTooltipsRef = ref();
|
|
4071
4086
|
const dateContentRef = ref();
|
|
4072
4087
|
const format = computed(() => props.format);
|
|
4073
|
-
const timezoneInfo = computed(() =>
|
|
4088
|
+
const timezoneInfo = computed(() => {
|
|
4089
|
+
let timezone = props.timezone || dayjs.tz.guess();
|
|
4090
|
+
if (!isValidTimeZone(timezone)) {
|
|
4091
|
+
console.error(`invalid timezone: ${props.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
4092
|
+
timezone = DEFAULT_TIMEZONE;
|
|
4093
|
+
}
|
|
4094
|
+
return getTimezoneInfoByValue(timezone) || { label: props.timezone, value: props.timezone };
|
|
4095
|
+
});
|
|
4074
4096
|
const diffTimezone = computed(() => {
|
|
4075
|
-
const timezone =
|
|
4097
|
+
const timezone = timezoneInfo.value.label;
|
|
4076
4098
|
if (!timezone || props.timezone === dayjs.tz.guess()) return 0;
|
|
4077
4099
|
const a = dayjs().utcOffset();
|
|
4078
4100
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
@@ -4089,7 +4111,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4089
4111
|
var _a, _b;
|
|
4090
4112
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v == null ? void 0 : v[index])))
|
|
4091
4113
|
return;
|
|
4092
|
-
dateDetail.value = new DateRange(v, format.value,
|
|
4114
|
+
dateDetail.value = new DateRange(v, format.value, timezoneInfo.value.label);
|
|
4093
4115
|
},
|
|
4094
4116
|
{
|
|
4095
4117
|
immediate: true
|
|
@@ -4118,11 +4140,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4118
4140
|
if (enterTimer) return;
|
|
4119
4141
|
enterTimer = setTimeout(() => {
|
|
4120
4142
|
tooltipsShow.value = true;
|
|
4121
|
-
tooltipsDetail.value = new DateRange(
|
|
4122
|
-
dateDetail.value.dateValue,
|
|
4123
|
-
format.value,
|
|
4124
|
-
props.timezone || dayjs.tz.guess()
|
|
4125
|
-
);
|
|
4143
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4126
4144
|
enterTimer = null;
|
|
4127
4145
|
}, 100);
|
|
4128
4146
|
}
|
|
@@ -4138,7 +4156,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4138
4156
|
const [start, end] = val;
|
|
4139
4157
|
const [oldStart, oldEnd] = props.modelValue || [];
|
|
4140
4158
|
if (start && end && start === oldStart && end === oldEnd) return;
|
|
4141
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
4159
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
4142
4160
|
const emitValue = dateDetail.value.toEmitValue();
|
|
4143
4161
|
emits("update:modelValue", ...emitValue);
|
|
4144
4162
|
const canStore = commonDateUseList.value.some((item) => item[0] === start && item[1] === end);
|
|
@@ -4223,13 +4241,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4223
4241
|
createVNode(_sfc_main$1, {
|
|
4224
4242
|
"default-date": dateDetail.value,
|
|
4225
4243
|
"need-timezone": _ctx.needTimezone,
|
|
4226
|
-
timezone:
|
|
4244
|
+
timezone: timezoneInfo.value.label,
|
|
4227
4245
|
onChange: handleChange,
|
|
4228
4246
|
"onUpdate:timezone": handleTimezoneChange
|
|
4229
4247
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
4230
4248
|
]),
|
|
4231
4249
|
default: withCtx(() => {
|
|
4232
|
-
var _a;
|
|
4250
|
+
var _a, _b, _c, _d;
|
|
4233
4251
|
return [
|
|
4234
4252
|
withDirectives((openBlock(), createElementBlock(
|
|
4235
4253
|
"span",
|
|
@@ -4251,10 +4269,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4251
4269
|
1
|
|
4252
4270
|
/* TEXT */
|
|
4253
4271
|
),
|
|
4254
|
-
_ctx.needTimezone && timezoneInfo.value.label !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
4272
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
4255
4273
|
"span",
|
|
4256
4274
|
_hoisted_2,
|
|
4257
|
-
toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
4275
|
+
toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
4258
4276
|
1
|
|
4259
4277
|
/* TEXT */
|
|
4260
4278
|
)) : createCommentVNode("v-if", true)
|
|
@@ -4283,7 +4301,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4283
4301
|
trigger: "manual"
|
|
4284
4302
|
}, {
|
|
4285
4303
|
content: withCtx(() => {
|
|
4286
|
-
var _a, _b;
|
|
4304
|
+
var _a, _b, _c, _d, _e;
|
|
4287
4305
|
return [
|
|
4288
4306
|
createElementVNode(
|
|
4289
4307
|
"div",
|
|
@@ -4312,7 +4330,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4312
4330
|
createElementVNode(
|
|
4313
4331
|
"div",
|
|
4314
4332
|
_hoisted_3,
|
|
4315
|
-
toDisplayString(timezoneInfo.value.label === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
4333
|
+
toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
4316
4334
|
1
|
|
4317
4335
|
/* TEXT */
|
|
4318
4336
|
),
|
|
@@ -4350,6 +4368,7 @@ export {
|
|
|
4350
4368
|
CommonNaturalOptions,
|
|
4351
4369
|
DATE_REGEX_FORMAT,
|
|
4352
4370
|
DATE_REGEX_PARSE,
|
|
4371
|
+
DEFAULT_TIMEZONE,
|
|
4353
4372
|
_sfc_main as DatePicker,
|
|
4354
4373
|
DateRange,
|
|
4355
4374
|
DateUnitList,
|
|
@@ -4369,6 +4388,7 @@ export {
|
|
|
4369
4388
|
getStoreTabKey,
|
|
4370
4389
|
getTimezoneOffset,
|
|
4371
4390
|
inputVal2Dayjs,
|
|
4391
|
+
isValidTimeZone,
|
|
4372
4392
|
naturalDateRegexp,
|
|
4373
4393
|
naturalDateShortcutMap,
|
|
4374
4394
|
naturalUnitOptions,
|
package/vue3/index.iife.min.js
CHANGED
|
@@ -23855,6 +23855,7 @@ ${$(r2)}`), n2;
|
|
|
23855
23855
|
const NowConstant = "now";
|
|
23856
23856
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
23857
23857
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
23858
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
23858
23859
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23859
23860
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
23860
23861
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -24194,6 +24195,14 @@ ${$(r2)}`), n2;
|
|
|
24194
24195
|
const offset2 = localTime.utcOffset() / 60;
|
|
24195
24196
|
return offset2;
|
|
24196
24197
|
}
|
|
24198
|
+
const isValidTimeZone = (timeZone) => {
|
|
24199
|
+
try {
|
|
24200
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
24201
|
+
return true;
|
|
24202
|
+
} catch (e) {
|
|
24203
|
+
return false;
|
|
24204
|
+
}
|
|
24205
|
+
};
|
|
24197
24206
|
dayjs.extend(utc);
|
|
24198
24207
|
dayjs.extend(tz);
|
|
24199
24208
|
const timezoneData = [
|
|
@@ -27331,8 +27340,14 @@ ${$(r2)}`), n2;
|
|
|
27331
27340
|
class: "time-zone-panel"
|
|
27332
27341
|
};
|
|
27333
27342
|
const _hoisted_7 = { class: "time-zone" };
|
|
27334
|
-
const _hoisted_8 = {
|
|
27335
|
-
|
|
27343
|
+
const _hoisted_8 = {
|
|
27344
|
+
key: 0,
|
|
27345
|
+
class: "time-zone-area"
|
|
27346
|
+
};
|
|
27347
|
+
const _hoisted_9 = {
|
|
27348
|
+
key: 0,
|
|
27349
|
+
class: "time-zone-tag"
|
|
27350
|
+
};
|
|
27336
27351
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
27337
27352
|
const _sfc_main$1 = /* @__PURE__ */ __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent({
|
|
27338
27353
|
__name: "panel-wrapper",
|
|
@@ -27494,21 +27509,21 @@ ${$(r2)}`), n2;
|
|
|
27494
27509
|
1
|
|
27495
27510
|
/* TEXT */
|
|
27496
27511
|
),
|
|
27497
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
27512
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).country ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27498
27513
|
"span",
|
|
27499
27514
|
_hoisted_8,
|
|
27500
27515
|
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).country) + ", " + __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).abbreviation),
|
|
27501
27516
|
1
|
|
27502
27517
|
/* TEXT */
|
|
27503
|
-
)
|
|
27518
|
+
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true)
|
|
27504
27519
|
]),
|
|
27505
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
27520
|
+
typeof __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).utc !== "undefined" ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27506
27521
|
"span",
|
|
27507
27522
|
_hoisted_9,
|
|
27508
27523
|
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(__WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).utc),
|
|
27509
27524
|
1
|
|
27510
27525
|
/* TEXT */
|
|
27511
|
-
),
|
|
27526
|
+
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true),
|
|
27512
27527
|
__WEBPACK_EXTERNAL_MODULE_vue__.createVNode(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$a), {
|
|
27513
27528
|
class: "time-zone-btn",
|
|
27514
27529
|
size: "small",
|
|
@@ -27606,9 +27621,16 @@ ${$(r2)}`), n2;
|
|
|
27606
27621
|
const dateTooltipsRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
27607
27622
|
const dateContentRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
27608
27623
|
const format = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => props2.format);
|
|
27609
|
-
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() =>
|
|
27624
|
+
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
27625
|
+
let timezone2 = props2.timezone || dayjs.tz.guess();
|
|
27626
|
+
if (!isValidTimeZone(timezone2)) {
|
|
27627
|
+
console.error(`invalid timezone: ${props2.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
27628
|
+
timezone2 = DEFAULT_TIMEZONE;
|
|
27629
|
+
}
|
|
27630
|
+
return getTimezoneInfoByValue(timezone2) || { label: props2.timezone, value: props2.timezone };
|
|
27631
|
+
});
|
|
27610
27632
|
const diffTimezone = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
27611
|
-
const timezone2 =
|
|
27633
|
+
const timezone2 = timezoneInfo.value.label;
|
|
27612
27634
|
if (!timezone2 || props2.timezone === dayjs.tz.guess()) return 0;
|
|
27613
27635
|
const a2 = dayjs().utcOffset();
|
|
27614
27636
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
@@ -27625,7 +27647,7 @@ ${$(r2)}`), n2;
|
|
|
27625
27647
|
var _a, _b;
|
|
27626
27648
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
27627
27649
|
return;
|
|
27628
|
-
dateDetail.value = new DateRange(v2, format.value,
|
|
27650
|
+
dateDetail.value = new DateRange(v2, format.value, timezoneInfo.value.label);
|
|
27629
27651
|
},
|
|
27630
27652
|
{
|
|
27631
27653
|
immediate: true
|
|
@@ -27654,11 +27676,7 @@ ${$(r2)}`), n2;
|
|
|
27654
27676
|
if (enterTimer) return;
|
|
27655
27677
|
enterTimer = setTimeout(() => {
|
|
27656
27678
|
tooltipsShow.value = true;
|
|
27657
|
-
tooltipsDetail.value = new DateRange(
|
|
27658
|
-
dateDetail.value.dateValue,
|
|
27659
|
-
format.value,
|
|
27660
|
-
props2.timezone || dayjs.tz.guess()
|
|
27661
|
-
);
|
|
27679
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
27662
27680
|
enterTimer = null;
|
|
27663
27681
|
}, 100);
|
|
27664
27682
|
}
|
|
@@ -27674,7 +27692,7 @@ ${$(r2)}`), n2;
|
|
|
27674
27692
|
const [start2, end2] = val;
|
|
27675
27693
|
const [oldStart, oldEnd] = props2.modelValue || [];
|
|
27676
27694
|
if (start2 && end2 && start2 === oldStart && end2 === oldEnd) return;
|
|
27677
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
27695
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
27678
27696
|
const emitValue = dateDetail.value.toEmitValue();
|
|
27679
27697
|
emits("update:modelValue", ...emitValue);
|
|
27680
27698
|
const canStore = commonDateUseList.value.some((item) => item[0] === start2 && item[1] === end2);
|
|
@@ -27759,13 +27777,13 @@ ${$(r2)}`), n2;
|
|
|
27759
27777
|
__WEBPACK_EXTERNAL_MODULE_vue__.createVNode(_sfc_main$1, {
|
|
27760
27778
|
"default-date": dateDetail.value,
|
|
27761
27779
|
"need-timezone": _ctx.needTimezone,
|
|
27762
|
-
timezone:
|
|
27780
|
+
timezone: timezoneInfo.value.label,
|
|
27763
27781
|
onChange: handleChange,
|
|
27764
27782
|
"onUpdate:timezone": handleTimezoneChange
|
|
27765
27783
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
27766
27784
|
]),
|
|
27767
27785
|
default: __WEBPACK_EXTERNAL_MODULE_vue__.withCtx(() => {
|
|
27768
|
-
var _a;
|
|
27786
|
+
var _a, _b, _c, _d;
|
|
27769
27787
|
return [
|
|
27770
27788
|
__WEBPACK_EXTERNAL_MODULE_vue__.withDirectives((__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27771
27789
|
"span",
|
|
@@ -27787,10 +27805,10 @@ ${$(r2)}`), n2;
|
|
|
27787
27805
|
1
|
|
27788
27806
|
/* TEXT */
|
|
27789
27807
|
),
|
|
27790
|
-
_ctx.needTimezone && timezoneInfo.value.label !== __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27808
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock(
|
|
27791
27809
|
"span",
|
|
27792
27810
|
_hoisted_2,
|
|
27793
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
27811
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
27794
27812
|
1
|
|
27795
27813
|
/* TEXT */
|
|
27796
27814
|
)) : __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode("v-if", true)
|
|
@@ -27819,7 +27837,7 @@ ${$(r2)}`), n2;
|
|
|
27819
27837
|
trigger: "manual"
|
|
27820
27838
|
}, {
|
|
27821
27839
|
content: __WEBPACK_EXTERNAL_MODULE_vue__.withCtx(() => {
|
|
27822
|
-
var _a, _b;
|
|
27840
|
+
var _a, _b, _c, _d, _e;
|
|
27823
27841
|
return [
|
|
27824
27842
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
27825
27843
|
"div",
|
|
@@ -27848,7 +27866,7 @@ ${$(r2)}`), n2;
|
|
|
27848
27866
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
27849
27867
|
"div",
|
|
27850
27868
|
_hoisted_3,
|
|
27851
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(timezoneInfo.value.label === __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? `${__WEBPACK_EXTERNAL_MODULE_vue__.unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
27869
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === __WEBPACK_EXTERNAL_MODULE_vue__.unref(dayjs).tz.guess() ? `${__WEBPACK_EXTERNAL_MODULE_vue__.unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
27852
27870
|
1
|
|
27853
27871
|
/* TEXT */
|
|
27854
27872
|
),
|
|
@@ -27885,6 +27903,7 @@ ${$(r2)}`), n2;
|
|
|
27885
27903
|
exports.CommonNaturalOptions = CommonNaturalOptions;
|
|
27886
27904
|
exports.DATE_REGEX_FORMAT = DATE_REGEX_FORMAT;
|
|
27887
27905
|
exports.DATE_REGEX_PARSE = DATE_REGEX_PARSE;
|
|
27906
|
+
exports.DEFAULT_TIMEZONE = DEFAULT_TIMEZONE;
|
|
27888
27907
|
exports.DatePicker = _sfc_main;
|
|
27889
27908
|
exports.DateRange = DateRange;
|
|
27890
27909
|
exports.DateUnitList = DateUnitList;
|
|
@@ -27904,6 +27923,7 @@ ${$(r2)}`), n2;
|
|
|
27904
27923
|
exports.getStoreTabKey = getStoreTabKey;
|
|
27905
27924
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
27906
27925
|
exports.inputVal2Dayjs = inputVal2Dayjs;
|
|
27926
|
+
exports.isValidTimeZone = isValidTimeZone;
|
|
27907
27927
|
exports.naturalDateRegexp = naturalDateRegexp;
|
|
27908
27928
|
exports.naturalDateShortcutMap = naturalDateShortcutMap;
|
|
27909
27929
|
exports.naturalUnitOptions = naturalUnitOptions;
|
package/vue3/index.umd.min.js
CHANGED
|
@@ -315,6 +315,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
315
315
|
const NowConstant = "now";
|
|
316
316
|
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
317
317
|
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
318
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
318
319
|
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
319
320
|
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
320
321
|
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
@@ -654,6 +655,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
654
655
|
const offset = localTime.utcOffset() / 60;
|
|
655
656
|
return offset;
|
|
656
657
|
}
|
|
658
|
+
const isValidTimeZone = (timeZone) => {
|
|
659
|
+
try {
|
|
660
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
661
|
+
return true;
|
|
662
|
+
} catch (e) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
};
|
|
657
666
|
dayjs.extend(utc);
|
|
658
667
|
dayjs.extend(tz);
|
|
659
668
|
const timezoneData = [
|
|
@@ -3791,8 +3800,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3791
3800
|
class: "time-zone-panel"
|
|
3792
3801
|
};
|
|
3793
3802
|
const _hoisted_7 = { class: "time-zone" };
|
|
3794
|
-
const _hoisted_8 = {
|
|
3795
|
-
|
|
3803
|
+
const _hoisted_8 = {
|
|
3804
|
+
key: 0,
|
|
3805
|
+
class: "time-zone-area"
|
|
3806
|
+
};
|
|
3807
|
+
const _hoisted_9 = {
|
|
3808
|
+
key: 0,
|
|
3809
|
+
class: "time-zone-tag"
|
|
3810
|
+
};
|
|
3796
3811
|
const _hoisted_10 = { class: "time-zone-picker" };
|
|
3797
3812
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
3798
3813
|
__name: "panel-wrapper",
|
|
@@ -3954,21 +3969,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3954
3969
|
1
|
|
3955
3970
|
/* TEXT */
|
|
3956
3971
|
),
|
|
3957
|
-
vue.
|
|
3972
|
+
vue.unref(timezoneInfo).country ? (vue.openBlock(), vue.createElementBlock(
|
|
3958
3973
|
"span",
|
|
3959
3974
|
_hoisted_8,
|
|
3960
3975
|
vue.toDisplayString(vue.unref(timezoneInfo).country) + ", " + vue.toDisplayString(vue.unref(timezoneInfo).abbreviation),
|
|
3961
3976
|
1
|
|
3962
3977
|
/* TEXT */
|
|
3963
|
-
)
|
|
3978
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
3964
3979
|
]),
|
|
3965
|
-
vue.
|
|
3980
|
+
typeof vue.unref(timezoneInfo).utc !== "undefined" ? (vue.openBlock(), vue.createElementBlock(
|
|
3966
3981
|
"span",
|
|
3967
3982
|
_hoisted_9,
|
|
3968
3983
|
vue.toDisplayString(vue.unref(timezoneInfo).utc),
|
|
3969
3984
|
1
|
|
3970
3985
|
/* TEXT */
|
|
3971
|
-
),
|
|
3986
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
3972
3987
|
vue.createVNode(vue.unref(bkuiVue.Button), {
|
|
3973
3988
|
class: "time-zone-btn",
|
|
3974
3989
|
size: "small",
|
|
@@ -4066,9 +4081,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4066
4081
|
const dateTooltipsRef = vue.ref();
|
|
4067
4082
|
const dateContentRef = vue.ref();
|
|
4068
4083
|
const format = vue.computed(() => props.format);
|
|
4069
|
-
const timezoneInfo = vue.computed(() =>
|
|
4084
|
+
const timezoneInfo = vue.computed(() => {
|
|
4085
|
+
let timezone = props.timezone || dayjs.tz.guess();
|
|
4086
|
+
if (!isValidTimeZone(timezone)) {
|
|
4087
|
+
console.error(`invalid timezone: ${props.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
4088
|
+
timezone = DEFAULT_TIMEZONE;
|
|
4089
|
+
}
|
|
4090
|
+
return getTimezoneInfoByValue(timezone) || { label: props.timezone, value: props.timezone };
|
|
4091
|
+
});
|
|
4070
4092
|
const diffTimezone = vue.computed(() => {
|
|
4071
|
-
const timezone =
|
|
4093
|
+
const timezone = timezoneInfo.value.label;
|
|
4072
4094
|
if (!timezone || props.timezone === dayjs.tz.guess()) return 0;
|
|
4073
4095
|
const a = dayjs().utcOffset();
|
|
4074
4096
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
@@ -4085,7 +4107,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4085
4107
|
var _a, _b;
|
|
4086
4108
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v == null ? void 0 : v[index])))
|
|
4087
4109
|
return;
|
|
4088
|
-
dateDetail.value = new DateRange(v, format.value,
|
|
4110
|
+
dateDetail.value = new DateRange(v, format.value, timezoneInfo.value.label);
|
|
4089
4111
|
},
|
|
4090
4112
|
{
|
|
4091
4113
|
immediate: true
|
|
@@ -4114,11 +4136,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4114
4136
|
if (enterTimer) return;
|
|
4115
4137
|
enterTimer = setTimeout(() => {
|
|
4116
4138
|
tooltipsShow.value = true;
|
|
4117
|
-
tooltipsDetail.value = new DateRange(
|
|
4118
|
-
dateDetail.value.dateValue,
|
|
4119
|
-
format.value,
|
|
4120
|
-
props.timezone || dayjs.tz.guess()
|
|
4121
|
-
);
|
|
4139
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4122
4140
|
enterTimer = null;
|
|
4123
4141
|
}, 100);
|
|
4124
4142
|
}
|
|
@@ -4134,7 +4152,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4134
4152
|
const [start, end] = val;
|
|
4135
4153
|
const [oldStart, oldEnd] = props.modelValue || [];
|
|
4136
4154
|
if (start && end && start === oldStart && end === oldEnd) return;
|
|
4137
|
-
dateDetail.value = new DateRange(val, format.value,
|
|
4155
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
4138
4156
|
const emitValue = dateDetail.value.toEmitValue();
|
|
4139
4157
|
emits("update:modelValue", ...emitValue);
|
|
4140
4158
|
const canStore = commonDateUseList.value.some((item) => item[0] === start && item[1] === end);
|
|
@@ -4219,13 +4237,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4219
4237
|
vue.createVNode(_sfc_main$1, {
|
|
4220
4238
|
"default-date": dateDetail.value,
|
|
4221
4239
|
"need-timezone": _ctx.needTimezone,
|
|
4222
|
-
timezone:
|
|
4240
|
+
timezone: timezoneInfo.value.label,
|
|
4223
4241
|
onChange: handleChange,
|
|
4224
4242
|
"onUpdate:timezone": handleTimezoneChange
|
|
4225
4243
|
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
4226
4244
|
]),
|
|
4227
4245
|
default: vue.withCtx(() => {
|
|
4228
|
-
var _a;
|
|
4246
|
+
var _a, _b, _c, _d;
|
|
4229
4247
|
return [
|
|
4230
4248
|
vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
|
4231
4249
|
"span",
|
|
@@ -4247,10 +4265,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4247
4265
|
1
|
|
4248
4266
|
/* TEXT */
|
|
4249
4267
|
),
|
|
4250
|
-
_ctx.needTimezone && timezoneInfo.value.label !== vue.unref(dayjs).tz.guess() ? (vue.openBlock(), vue.createElementBlock(
|
|
4268
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== vue.unref(dayjs).tz.guess() ? (vue.openBlock(), vue.createElementBlock(
|
|
4251
4269
|
"span",
|
|
4252
4270
|
_hoisted_2,
|
|
4253
|
-
vue.toDisplayString(timezoneInfo.value.abbreviation || ((
|
|
4271
|
+
vue.toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
4254
4272
|
1
|
|
4255
4273
|
/* TEXT */
|
|
4256
4274
|
)) : vue.createCommentVNode("v-if", true)
|
|
@@ -4279,7 +4297,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4279
4297
|
trigger: "manual"
|
|
4280
4298
|
}, {
|
|
4281
4299
|
content: vue.withCtx(() => {
|
|
4282
|
-
var _a, _b;
|
|
4300
|
+
var _a, _b, _c, _d, _e;
|
|
4283
4301
|
return [
|
|
4284
4302
|
vue.createElementVNode(
|
|
4285
4303
|
"div",
|
|
@@ -4308,7 +4326,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4308
4326
|
vue.createElementVNode(
|
|
4309
4327
|
"div",
|
|
4310
4328
|
_hoisted_3,
|
|
4311
|
-
vue.toDisplayString(timezoneInfo.value.label === vue.unref(dayjs).tz.guess() ? `${vue.unref(t)("浏览器时区")} (${timezoneInfo.value.label})` : timezoneInfo.value.label),
|
|
4329
|
+
vue.toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === vue.unref(dayjs).tz.guess() ? `${vue.unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
4312
4330
|
1
|
|
4313
4331
|
/* TEXT */
|
|
4314
4332
|
),
|
|
@@ -4346,6 +4364,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4346
4364
|
exports2.CommonNaturalOptions = CommonNaturalOptions;
|
|
4347
4365
|
exports2.DATE_REGEX_FORMAT = DATE_REGEX_FORMAT;
|
|
4348
4366
|
exports2.DATE_REGEX_PARSE = DATE_REGEX_PARSE;
|
|
4367
|
+
exports2.DEFAULT_TIMEZONE = DEFAULT_TIMEZONE;
|
|
4349
4368
|
exports2.DatePicker = _sfc_main;
|
|
4350
4369
|
exports2.DateRange = DateRange;
|
|
4351
4370
|
exports2.DateUnitList = DateUnitList;
|
|
@@ -4364,6 +4383,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4364
4383
|
exports2.getStoreTabKey = getStoreTabKey;
|
|
4365
4384
|
exports2.getTimezoneOffset = getTimezoneOffset;
|
|
4366
4385
|
exports2.inputVal2Dayjs = inputVal2Dayjs;
|
|
4386
|
+
exports2.isValidTimeZone = isValidTimeZone;
|
|
4367
4387
|
exports2.naturalDateRegexp = naturalDateRegexp;
|
|
4368
4388
|
exports2.naturalDateShortcutMap = naturalDateShortcutMap;
|
|
4369
4389
|
exports2.naturalUnitOptions = naturalUnitOptions;
|