@bagelink/vue 1.2.43 → 1.2.45
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/dist/index.cjs
CHANGED
|
@@ -36497,14 +36497,18 @@ function getBrowserNavigatorLocale() {
|
|
|
36497
36497
|
if (typeof navigator !== "object") return "en-US";
|
|
36498
36498
|
return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
|
|
36499
36499
|
}
|
|
36500
|
-
function handleTimezone(date2,
|
|
36500
|
+
function handleTimezone(date2, intFmtOpt) {
|
|
36501
36501
|
if (intFmtOpt.timeZone === "UTC") {
|
|
36502
36502
|
const utcDate = new Date(date2.getTime());
|
|
36503
36503
|
utcDate.setMinutes(utcDate.getMinutes() + date2.getTimezoneOffset());
|
|
36504
36504
|
return utcDate;
|
|
36505
36505
|
}
|
|
36506
36506
|
try {
|
|
36507
|
-
const formatter = new Intl.DateTimeFormat(
|
|
36507
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
36508
|
+
...intFmtOpt,
|
|
36509
|
+
month: "numeric"
|
|
36510
|
+
// Force numeric month format
|
|
36511
|
+
});
|
|
36508
36512
|
const formattedParts = formatter.formatToParts(date2);
|
|
36509
36513
|
const parts = {};
|
|
36510
36514
|
formattedParts.forEach((part) => {
|
|
@@ -36528,7 +36532,8 @@ function handleTimezone(date2, locale2, intFmtOpt) {
|
|
|
36528
36532
|
}
|
|
36529
36533
|
}
|
|
36530
36534
|
function getDatePartsMap(date2, locale2, intFmtOpt) {
|
|
36531
|
-
const d2 = (intFmtOpt == null ? void 0 : intFmtOpt.timeZone) ? handleTimezone(date2,
|
|
36535
|
+
const d2 = (intFmtOpt == null ? void 0 : intFmtOpt.timeZone) ? handleTimezone(date2, intFmtOpt) : date2;
|
|
36536
|
+
const year = d2.getFullYear().toString();
|
|
36532
36537
|
return {
|
|
36533
36538
|
AmPm: d2.toLocaleString(locale2, { hour: "numeric", hour12: true, minute: "numeric" }).split(" ")[1],
|
|
36534
36539
|
DD: String(d2.getDate()).padStart(2, "0"),
|
|
@@ -36541,8 +36546,9 @@ function getDatePartsMap(date2, locale2, intFmtOpt) {
|
|
|
36541
36546
|
MMMM: d2.toLocaleString(locale2, { month: "long" }),
|
|
36542
36547
|
ss: String(d2.getSeconds()).padStart(2, "0"),
|
|
36543
36548
|
sss: String(d2.getMilliseconds()).padStart(3, "0"),
|
|
36544
|
-
|
|
36545
|
-
|
|
36549
|
+
// Always use Latin numerals for year to ensure consistency
|
|
36550
|
+
YY: year.slice(-2),
|
|
36551
|
+
YYYY: year
|
|
36546
36552
|
};
|
|
36547
36553
|
}
|
|
36548
36554
|
const _datePartsMapNow = getDatePartsMap(/* @__PURE__ */ new Date(), getBrowserNavigatorLocale());
|
package/dist/index.mjs
CHANGED
|
@@ -36495,14 +36495,18 @@ function getBrowserNavigatorLocale() {
|
|
|
36495
36495
|
if (typeof navigator !== "object") return "en-US";
|
|
36496
36496
|
return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
|
|
36497
36497
|
}
|
|
36498
|
-
function handleTimezone(date2,
|
|
36498
|
+
function handleTimezone(date2, intFmtOpt) {
|
|
36499
36499
|
if (intFmtOpt.timeZone === "UTC") {
|
|
36500
36500
|
const utcDate = new Date(date2.getTime());
|
|
36501
36501
|
utcDate.setMinutes(utcDate.getMinutes() + date2.getTimezoneOffset());
|
|
36502
36502
|
return utcDate;
|
|
36503
36503
|
}
|
|
36504
36504
|
try {
|
|
36505
|
-
const formatter = new Intl.DateTimeFormat(
|
|
36505
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
36506
|
+
...intFmtOpt,
|
|
36507
|
+
month: "numeric"
|
|
36508
|
+
// Force numeric month format
|
|
36509
|
+
});
|
|
36506
36510
|
const formattedParts = formatter.formatToParts(date2);
|
|
36507
36511
|
const parts = {};
|
|
36508
36512
|
formattedParts.forEach((part) => {
|
|
@@ -36526,7 +36530,8 @@ function handleTimezone(date2, locale2, intFmtOpt) {
|
|
|
36526
36530
|
}
|
|
36527
36531
|
}
|
|
36528
36532
|
function getDatePartsMap(date2, locale2, intFmtOpt) {
|
|
36529
|
-
const d2 = (intFmtOpt == null ? void 0 : intFmtOpt.timeZone) ? handleTimezone(date2,
|
|
36533
|
+
const d2 = (intFmtOpt == null ? void 0 : intFmtOpt.timeZone) ? handleTimezone(date2, intFmtOpt) : date2;
|
|
36534
|
+
const year = d2.getFullYear().toString();
|
|
36530
36535
|
return {
|
|
36531
36536
|
AmPm: d2.toLocaleString(locale2, { hour: "numeric", hour12: true, minute: "numeric" }).split(" ")[1],
|
|
36532
36537
|
DD: String(d2.getDate()).padStart(2, "0"),
|
|
@@ -36539,8 +36544,9 @@ function getDatePartsMap(date2, locale2, intFmtOpt) {
|
|
|
36539
36544
|
MMMM: d2.toLocaleString(locale2, { month: "long" }),
|
|
36540
36545
|
ss: String(d2.getSeconds()).padStart(2, "0"),
|
|
36541
36546
|
sss: String(d2.getMilliseconds()).padStart(3, "0"),
|
|
36542
|
-
|
|
36543
|
-
|
|
36547
|
+
// Always use Latin numerals for year to ensure consistency
|
|
36548
|
+
YY: year.slice(-2),
|
|
36549
|
+
YYYY: year
|
|
36544
36550
|
};
|
|
36545
36551
|
}
|
|
36546
36552
|
const _datePartsMapNow = getDatePartsMap(/* @__PURE__ */ new Date(), getBrowserNavigatorLocale());
|
|
@@ -17,7 +17,7 @@ export declare function timeAgo(date: string | Date, lang?: AvailableTimeLanguag
|
|
|
17
17
|
* @param timeZone The timezone to use (e.g., 'UTC', 'America/New_York')
|
|
18
18
|
* @returns Date parts with timezone adjustment applied
|
|
19
19
|
*/
|
|
20
|
-
export declare function handleTimezone(date: Date,
|
|
20
|
+
export declare function handleTimezone(date: Date, intFmtOpt: Intl.DateTimeFormatOptions): Date;
|
|
21
21
|
export declare function getDatePartsMap(date: Date, locale: Intl.LocalesArgument, intFmtOpt?: Intl.DateTimeFormatOptions): {
|
|
22
22
|
AmPm: string;
|
|
23
23
|
DD: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/calendar/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAkC,MAAM,sBAAsB,CAAA;AAE3H,UAAU,gBAAgB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAyBvE;AAqDD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UAsD/E;AASD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/calendar/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAkC,MAAM,sBAAsB,CAAA;AAE3H,UAAU,gBAAgB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAyBvE;AAqDD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAE,sBAA6B,UAsD/E;AASD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CA2CtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,qBAAqB;;;;;;;;;;;;;;EAyB/G;AAcD,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IAC7F,GAAG,CAAC,EAAE,uBAAuB,CAAA;IAC7B,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,CAAA;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;CACX;AACD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACzB,IAAI,CAAC,EAAE,QAAQ,EACf,IAAI,GAAE,iBAAsB,GAC1B,MAAM,CAuER;AACD,eAAO,MAAM,OAAO,mBAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -158,7 +158,7 @@ function getBrowserNavigatorLocale(): string {
|
|
|
158
158
|
* @param timeZone The timezone to use (e.g., 'UTC', 'America/New_York')
|
|
159
159
|
* @returns Date parts with timezone adjustment applied
|
|
160
160
|
*/
|
|
161
|
-
export function handleTimezone(date: Date,
|
|
161
|
+
export function handleTimezone(date: Date, intFmtOpt: Intl.DateTimeFormatOptions): Date {
|
|
162
162
|
// If timeZone is UTC, convert to UTC directly
|
|
163
163
|
if (intFmtOpt.timeZone === 'UTC') {
|
|
164
164
|
const utcDate = new Date(date.getTime())
|
|
@@ -168,14 +168,18 @@ export function handleTimezone(date: Date, locale: Intl.LocalesArgument, intFmtO
|
|
|
168
168
|
|
|
169
169
|
// For other timezones, use the Intl API
|
|
170
170
|
try {
|
|
171
|
-
//
|
|
172
|
-
const formatter = new Intl.DateTimeFormat(
|
|
171
|
+
// Always use en-US locale for parsing date parts to ensure Latin numerals
|
|
172
|
+
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
173
|
+
...intFmtOpt,
|
|
174
|
+
month: 'numeric' // Force numeric month format
|
|
175
|
+
})
|
|
173
176
|
|
|
174
177
|
// Format the date in the target timezone
|
|
175
178
|
const formattedParts = formatter.formatToParts(date)
|
|
176
179
|
|
|
177
180
|
// Extract date components from formatted parts
|
|
178
181
|
const parts: Record<string, number> = {}
|
|
182
|
+
|
|
179
183
|
formattedParts.forEach((part) => {
|
|
180
184
|
if (part.type !== 'literal' && part.type !== 'timeZoneName') {
|
|
181
185
|
parts[part.type] = Number.parseInt(part.value, 10)
|
|
@@ -201,8 +205,10 @@ export function handleTimezone(date: Date, locale: Intl.LocalesArgument, intFmtO
|
|
|
201
205
|
|
|
202
206
|
export function getDatePartsMap(date: Date, locale: Intl.LocalesArgument, intFmtOpt?: Intl.DateTimeFormatOptions) {
|
|
203
207
|
// Apply timezone adjustment if specified
|
|
204
|
-
const d = intFmtOpt?.timeZone ? handleTimezone(date,
|
|
205
|
-
|
|
208
|
+
const d = intFmtOpt?.timeZone ? handleTimezone(date, intFmtOpt) : date
|
|
209
|
+
|
|
210
|
+
// Use numeric formatting for year to ensure consistency across locales
|
|
211
|
+
const year = d.getFullYear().toString()
|
|
206
212
|
|
|
207
213
|
/// keep-sorted
|
|
208
214
|
return {
|
|
@@ -217,8 +223,10 @@ export function getDatePartsMap(date: Date, locale: Intl.LocalesArgument, intFmt
|
|
|
217
223
|
MMMM: d.toLocaleString(locale, { month: 'long' }),
|
|
218
224
|
ss: String(d.getSeconds()).padStart(2, '0'),
|
|
219
225
|
sss: String(d.getMilliseconds()).padStart(3, '0'),
|
|
220
|
-
|
|
221
|
-
|
|
226
|
+
|
|
227
|
+
// Always use Latin numerals for year to ensure consistency
|
|
228
|
+
YY: year.slice(-2),
|
|
229
|
+
YYYY: year,
|
|
222
230
|
}
|
|
223
231
|
}
|
|
224
232
|
|