temporal-polyfill-lite 0.3.2 → 0.3.3
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/CHANGELOG.md +10 -0
- package/dist/calendars/index.js +2 -2
- package/dist/calendars/shim.d.ts +5 -0
- package/dist/calendars/shim.js +6 -3
- package/dist/calendars/{src-VKlRcbzl.js → src-m77GJsdB.js} +81 -83
- package/dist/index.js +2 -2
- package/dist/shim.d.ts +5 -0
- package/dist/shim.js +6 -3
- package/dist/{src-D8sFgi35.js → src-CfkGat92.js} +52 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 0.3.3 (2026-03-21)
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Introduce opt-in cache for system time zone ID ([#22](https://github.com/fabon-f/temporal-polyfill-lite/pull/22))
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix bugs related to extreme dates in `persian` calendar ([#23](https://github.com/fabon-f/temporal-polyfill-lite/pull/23))
|
|
17
|
+
|
|
8
18
|
## 0.3.2 (2026-03-12)
|
|
9
19
|
|
|
10
20
|
### Changed
|
package/dist/calendars/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { i as a, r as s, t as r } from "./src-m77GJsdB.js";
|
|
2
|
+
export { s as Intl, r as Temporal, a as toTemporalInstant };
|
package/dist/calendars/shim.d.ts
CHANGED
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
* @param overwrite Whether to overwrite an existing Temporal implementation
|
|
4
4
|
*/
|
|
5
5
|
export declare function install(overwrite: boolean): void;
|
|
6
|
+
/**
|
|
7
|
+
* Set TTL for `Temporal.Now.timeZoneId` cache (`Infinity` means no expiration). Pass `0` to clear and disable cache again.
|
|
8
|
+
* @param ttl TTL in milliseconds
|
|
9
|
+
*/
|
|
10
|
+
export declare function setSystemTimeZoneIdCacheTtl(ttl: number): void;
|
package/dist/calendars/shim.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
function install(s) {
|
|
2
|
-
(s || "object" != typeof globalThis.Temporal) && (
|
|
2
|
+
(s || "object" != typeof globalThis.Temporal) && (t(globalThis, "Temporal", l), t(globalThis, "Intl", e), t(Date.prototype, "toTemporalInstant", a));
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
function setSystemTimeZoneIdCacheTtl(t) {
|
|
5
|
+
s(t);
|
|
6
|
+
}
|
|
7
|
+
import { a as t, i as a, n as s, r as e, t as l } from "./src-m77GJsdB.js";
|
|
8
|
+
export { install, setSystemTimeZoneIdCacheTtl };
|
|
@@ -1053,9 +1053,7 @@ function monthNumber(e, t) {
|
|
|
1053
1053
|
function newYearEpochDays(e) {
|
|
1054
1054
|
const t = monthNumber(e, 1) - 1, o = modFloor(13753 * t + 5604, 25920);
|
|
1055
1055
|
let n = 29 * t - 2092590 + divFloor(13753 * t + 5604, 25920);
|
|
1056
|
-
(o >= 19440 || !isLeapYear$2(e) && 5 === modFloor(n, 7) && o >= 9924 || isLeapYear$2(e - 1) && 4 === modFloor(n, 7) && o >= 16789) && n
|
|
1057
|
-
const r = modFloor(n, 7);
|
|
1058
|
-
return 1 !== r && 3 !== r && 6 !== r || n++, n;
|
|
1056
|
+
return (o >= 19440 || !isLeapYear$2(e) && 5 === modFloor(n, 7) && o >= 9924 || isLeapYear$2(e - 1) && 4 === modFloor(n, 7) && o >= 16789) && n++, n + +(modFloor(3 * n + 5, 7) < 3);
|
|
1059
1057
|
}
|
|
1060
1058
|
function calendarIntegersToEpochDays$4(e, t, o) {
|
|
1061
1059
|
const n = (newYearEpochDays(e + 1) - newYearEpochDays(e)) % 30 - 24;
|
|
@@ -1077,7 +1075,7 @@ function calendarIntegersToEpochDays$3(e, t, o) {
|
|
|
1077
1075
|
return firstDayOfYear(e) - 1 + 30 * (t - 1) + o + clamp(t - 1, 0, 6) + (1 === t || mathematicalInLeapYear$1(e) ? 0 : -1);
|
|
1078
1076
|
}
|
|
1079
1077
|
function epoch(e) {
|
|
1080
|
-
return "islamic-civil" === e
|
|
1078
|
+
return +("islamic-civil" === e) - 492149;
|
|
1081
1079
|
}
|
|
1082
1080
|
function isLeapYear$1(e) {
|
|
1083
1081
|
return modFloor(11 * (e + 4), 30) < 11;
|
|
@@ -1089,8 +1087,7 @@ function calendarIntegersToEpochDays$2(e, t, o, n) {
|
|
|
1089
1087
|
return epoch(e) + 354 * (t - 1) + divFloor(11 * (t + 3), 30) - 1 + Math.ceil(29.5 * (o - 1)) + n - 1;
|
|
1090
1088
|
}
|
|
1091
1089
|
function epochDaysToDate$2(e, t) {
|
|
1092
|
-
|
|
1093
|
-
for (; calendarIntegersToEpochDays$2(e, o, 1, 1) > t; o--);
|
|
1090
|
+
const o = divFloor(30 * (t - epoch(e) - 5315), 10631) + 16;
|
|
1094
1091
|
let n = 12;
|
|
1095
1092
|
for (; calendarIntegersToEpochDays$2(e, o, n, 1) > t; n--);
|
|
1096
1093
|
return {
|
|
@@ -1108,7 +1105,7 @@ function epochDaysToDate$2(e, t) {
|
|
|
1108
1105
|
},
|
|
1109
1106
|
se: 7,
|
|
1110
1107
|
le: daysInMonth$1(o, n),
|
|
1111
|
-
de: isLeapYear$1(o)
|
|
1108
|
+
de: +isLeapYear$1(o) + 354,
|
|
1112
1109
|
me: 12,
|
|
1113
1110
|
ue: isLeapYear$1(o)
|
|
1114
1111
|
};
|
|
@@ -1132,8 +1129,8 @@ function constrainDay$2(e, t, o) {
|
|
|
1132
1129
|
function startOfYear(e) {
|
|
1133
1130
|
const t = ft.C(e);
|
|
1134
1131
|
if (t) return t;
|
|
1135
|
-
const o = isoDateToEpochDays(e + 621,
|
|
1136
|
-
return ft.B(e,
|
|
1132
|
+
const o = isoDateToEpochDays(e + 621, 4, 1), n = extractYearMonthDay("persian", o), r = o - dayOfYearFromMonthDay(n.u, n.T) + 1;
|
|
1133
|
+
return ft.B(e, r), r;
|
|
1137
1134
|
}
|
|
1138
1135
|
function dayOfYearFromMonthDay(e, t) {
|
|
1139
1136
|
return 30 * (e - 1) + t + clamp(e - 1, 0, 6);
|
|
@@ -1145,18 +1142,18 @@ function isLeapYear(e) {
|
|
|
1145
1142
|
return startOfYear(e + 1) - startOfYear(e) > 365;
|
|
1146
1143
|
}
|
|
1147
1144
|
function getDate(e) {
|
|
1148
|
-
const t =
|
|
1149
|
-
let o =
|
|
1150
|
-
n >
|
|
1145
|
+
const t = epochDaysToIsoDate(e).t;
|
|
1146
|
+
let o = t - 622 + +(isoDateToEpochDays(t, 2, isWithin(t, 1827, 2120) ? 19 : -5) < e), n = startOfYear(o);
|
|
1147
|
+
n > e && (o--, n = startOfYear(o));
|
|
1151
1148
|
const r = ((e) => {
|
|
1152
1149
|
const t = e <= 186 ? divFloor(e - 1, 31) + 1 : divFloor(e - 7, 30) + 1;
|
|
1153
1150
|
return [t, e - dayOfYearFromMonthDay(t, 1) + 1];
|
|
1154
|
-
})(
|
|
1151
|
+
})(e - n + 1);
|
|
1155
1152
|
return {
|
|
1156
1153
|
t: o,
|
|
1157
1154
|
u: r[0],
|
|
1158
1155
|
T: r[1],
|
|
1159
|
-
ae:
|
|
1156
|
+
ae: e - n + 1
|
|
1160
1157
|
};
|
|
1161
1158
|
}
|
|
1162
1159
|
function canonicalizeCalendar(e) {
|
|
@@ -1277,70 +1274,67 @@ function nonIsoCalendarIsoToDate(e, t) {
|
|
|
1277
1274
|
ue: !!mathematicalInLeapYear$2(o)
|
|
1278
1275
|
};
|
|
1279
1276
|
})(e, o) : "indian" === e ? ((e) => {
|
|
1280
|
-
const t = epochDaysToIsoDate(e), o = firstDayOfYear(t.t - 78) <= e ? t.t - 78 : t.t - 79, n = mathematicalInLeapYear$1(o)
|
|
1281
|
-
let
|
|
1282
|
-
for (;
|
|
1277
|
+
const t = epochDaysToIsoDate(e), o = firstDayOfYear(t.t - 78) <= e ? t.t - 78 : t.t - 79, n = mathematicalInLeapYear$1(o);
|
|
1278
|
+
let r = 12;
|
|
1279
|
+
for (; calendarIntegersToEpochDays$3(o, r, 1) > e; r--);
|
|
1283
1280
|
return {
|
|
1284
1281
|
oe: "shaka",
|
|
1285
1282
|
ne: o,
|
|
1286
1283
|
t: o,
|
|
1287
|
-
u:
|
|
1288
|
-
v: createMonthCode(
|
|
1289
|
-
T: e - calendarIntegersToEpochDays$3(o,
|
|
1284
|
+
u: r,
|
|
1285
|
+
v: createMonthCode(r),
|
|
1286
|
+
T: e - calendarIntegersToEpochDays$3(o, r, 1) + 1,
|
|
1290
1287
|
re: isoDayOfWeek(t),
|
|
1291
|
-
ae:
|
|
1288
|
+
ae: e - firstDayOfYear(o) + 1,
|
|
1292
1289
|
ie: {
|
|
1293
1290
|
ce: void 0,
|
|
1294
1291
|
t: void 0
|
|
1295
1292
|
},
|
|
1296
1293
|
se: 7,
|
|
1297
|
-
le: daysInMonth$2(o,
|
|
1294
|
+
le: daysInMonth$2(o, r),
|
|
1298
1295
|
de: 365 + n,
|
|
1299
1296
|
me: 12,
|
|
1300
1297
|
ue: !!n
|
|
1301
1298
|
};
|
|
1302
|
-
})(o) : "persian" === e ? ((e) => {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
};
|
|
1342
|
-
})(o) : isChineseDangi(e) ? epochDaysToDate$6(e, o) : "islamic-umalqura" === e ? ((e) => {
|
|
1343
|
-
const t = epochDaysToDate$2("islamic-civil", e), o = epochDaysToIsoDate(e);
|
|
1299
|
+
})(o) : "persian" === e ? ((e) => ({
|
|
1300
|
+
oe: "ap",
|
|
1301
|
+
get ne() {
|
|
1302
|
+
return getDate(e).t;
|
|
1303
|
+
},
|
|
1304
|
+
get t() {
|
|
1305
|
+
return getDate(e).t;
|
|
1306
|
+
},
|
|
1307
|
+
get u() {
|
|
1308
|
+
return getDate(e).u;
|
|
1309
|
+
},
|
|
1310
|
+
get v() {
|
|
1311
|
+
return createMonthCode(getDate(e).u);
|
|
1312
|
+
},
|
|
1313
|
+
get T() {
|
|
1314
|
+
return getDate(e).T;
|
|
1315
|
+
},
|
|
1316
|
+
re: isoDayOfWeek(epochDaysToIsoDate(e)),
|
|
1317
|
+
get ae() {
|
|
1318
|
+
return getDate(e).ae;
|
|
1319
|
+
},
|
|
1320
|
+
ie: {
|
|
1321
|
+
ce: void 0,
|
|
1322
|
+
t: void 0
|
|
1323
|
+
},
|
|
1324
|
+
se: 7,
|
|
1325
|
+
get le() {
|
|
1326
|
+
const t = getDate(e);
|
|
1327
|
+
return t.u <= 6 ? 31 : 12 !== t.u || isLeapYear(t.t) ? 30 : 29;
|
|
1328
|
+
},
|
|
1329
|
+
get de() {
|
|
1330
|
+
return isLeapYear(getDate(e).t) ? 366 : 365;
|
|
1331
|
+
},
|
|
1332
|
+
me: 12,
|
|
1333
|
+
get ue() {
|
|
1334
|
+
return isLeapYear(getDate(e).t);
|
|
1335
|
+
}
|
|
1336
|
+
}))(o) : isChineseDangi(e) ? epochDaysToDate$6(e, o) : "islamic-umalqura" === e ? ((e) => {
|
|
1337
|
+
const t = epochDaysToDate$2("islamic-civil", e);
|
|
1344
1338
|
return e < -33600 || e > 76200 ? t : {
|
|
1345
1339
|
oe: "ah",
|
|
1346
1340
|
get ne() {
|
|
@@ -1358,7 +1352,7 @@ function nonIsoCalendarIsoToDate(e, t) {
|
|
|
1358
1352
|
get T() {
|
|
1359
1353
|
return getYearMonthDay(e).T;
|
|
1360
1354
|
},
|
|
1361
|
-
re: isoDayOfWeek(
|
|
1355
|
+
re: isoDayOfWeek(epochDaysToIsoDate(e)),
|
|
1362
1356
|
get ae() {
|
|
1363
1357
|
return e - getFirstDayOfMonth(getYearMonthDay(e).t, 1) + 1;
|
|
1364
1358
|
},
|
|
@@ -1582,7 +1576,7 @@ function calendarMonthDayFromFields(e, t, o) {
|
|
|
1582
1576
|
return t <= 1095 ? t : calendarIntegersToEpochDays$6(e, 1971, 12, n);
|
|
1583
1577
|
}
|
|
1584
1578
|
return calendarIntegersToEpochDays$6(e, ((e, t, o, n) => 12 === t ? 1971 : !o && (n < 30 || 2 === t || 5 === t || 7 === t || 9 === t || 10 === t) ? 1972 : o ? 2 === t ? 1947 : 3 === t ? 30 === n ? 1955 : 1966 : 4 === t ? 30 === n ? 1944 : 1963 : 5 === t ? 30 === n ? 1952 : 1971 : 6 === t ? 30 === n ? 1941 : 1960 : 7 === t ? 30 === n ? 1938 : 1968 : 8 === t ? 1957 : 9 === t ? 2014 : 10 === t ? 1984 : 2033 : 1 === t || 4 === t ? 1970 : 3 === t ? "chinese" === e ? 1966 : 1968 : 1971)(e, t, o, n), r, n);
|
|
1585
|
-
})(e, a[0], a[1], i)) : epochDaysToIsoDate(((e, t, o) => 12 === t && 30 === o ?
|
|
1579
|
+
})(e, a[0], a[1], i)) : epochDaysToIsoDate(((e, t, o) => calendarIntegersToEpochDays$2(e, 12 === t && 30 === o ? 1390 : +(30 * t + o <= 356 - +("islamic-civil" === e)) + 1391, t, o))(e, a[0], i));
|
|
1586
1580
|
})(e, t, o);
|
|
1587
1581
|
}
|
|
1588
1582
|
function formatCalendarAnnotation(e, t) {
|
|
@@ -1987,12 +1981,12 @@ function getTemporalFractionalSecondDigitsOption(e) {
|
|
|
1987
1981
|
function toSecondsStringPrecisionRecord(e, t) {
|
|
1988
1982
|
return e ? {
|
|
1989
1983
|
$e: e === B ? D : 3 * (e - 6),
|
|
1990
|
-
|
|
1991
|
-
|
|
1984
|
+
ve: e,
|
|
1985
|
+
Ee: 1
|
|
1992
1986
|
} : {
|
|
1993
1987
|
$e: t,
|
|
1994
|
-
|
|
1995
|
-
|
|
1988
|
+
ve: divFloor((t ?? 9) - 1, 3) + 7,
|
|
1989
|
+
Ee: 10 ** ((9 - (t ?? 9)) % 3)
|
|
1996
1990
|
};
|
|
1997
1991
|
}
|
|
1998
1992
|
function getTemporalUnitValuedOption(e, t, o) {
|
|
@@ -2284,7 +2278,10 @@ function clampEpochNanoseconds(e) {
|
|
|
2284
2278
|
return compareEpochNanoseconds(e, we) > 0 ? we : compareEpochNanoseconds(e, ye) < 0 ? ye : e;
|
|
2285
2279
|
}
|
|
2286
2280
|
function systemTimeZoneIdentifier() {
|
|
2287
|
-
return new Pt().resolvedOptions().timeZone;
|
|
2281
|
+
return Vt && xt + Vt > Date.now() && zt ? zt : (xt = Date.now(), zt = new Pt().resolvedOptions().timeZone);
|
|
2282
|
+
}
|
|
2283
|
+
function setSystemTimeZoneIdCacheTtl(e) {
|
|
2284
|
+
Vt = e, e || (zt = void 0, xt = -Infinity);
|
|
2288
2285
|
}
|
|
2289
2286
|
function systemUtcEpochNanoseconds() {
|
|
2290
2287
|
return createEpochNanosecondsFromEpochMilliseconds(Date.now());
|
|
@@ -2478,7 +2475,7 @@ var Me = class {
|
|
|
2478
2475
|
], A))(o);
|
|
2479
2476
|
validateTemporalUnitValue(c, l), c === q && throwRangeError(invalidField("smallestUnit"));
|
|
2480
2477
|
const d = toSecondsStringPrecisionRecord(c, r);
|
|
2481
|
-
return temporalZonedDateTimeToString(t, d.$e, n, s, a, d.
|
|
2478
|
+
return temporalZonedDateTimeToString(t, d.$e, n, s, a, d.Ee, d.ve, i);
|
|
2482
2479
|
}
|
|
2483
2480
|
toLocaleString(e = void 0, t = void 0) {
|
|
2484
2481
|
const o = getInternalSlotOrThrowForZonedDateTime(this), n = createDateTimeFormat(e, t, d, o.P), r = getInternalSlotOrThrowForDateTimeFormat(n);
|
|
@@ -2674,7 +2671,7 @@ var Ne = class {
|
|
|
2674
2671
|
const t = getInternalSlotOrThrowForPlainDateTime(this), o = getOptionsObject(e), n = getTemporalShowCalendarNameOption(o), r = getTemporalFractionalSecondDigitsOption(o), a = getRoundingModeOption(o, M), i = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2675
2672
|
validateTemporalUnitValue(i, l), i === q && throwRangeError(invalidField("smallestUnit"));
|
|
2676
2673
|
const c = toSecondsStringPrecisionRecord(i, r);
|
|
2677
|
-
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, c.
|
|
2674
|
+
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, c.Ee, c.ve, a)), t.Y, c.$e, n);
|
|
2678
2675
|
}
|
|
2679
2676
|
toLocaleString(e = void 0, t = void 0) {
|
|
2680
2677
|
return getInternalSlotOrThrowForPlainDateTime(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -2770,7 +2767,7 @@ var $e = class {
|
|
|
2770
2767
|
const t = getInternalSlotOrThrowForPlainTime(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2771
2768
|
validateTemporalUnitValue(a, l), a === q && throwRangeError(invalidField("smallestUnit"));
|
|
2772
2769
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
2773
|
-
return timeRecordToString(roundTime(t, i.
|
|
2770
|
+
return timeRecordToString(roundTime(t, i.Ee, i.ve, r), i.$e);
|
|
2774
2771
|
}
|
|
2775
2772
|
toLocaleString(e = void 0, t = void 0) {
|
|
2776
2773
|
return getInternalSlotOrThrowForPlainTime(this), formatDateTime(createDateTimeFormat(e, t, l), this);
|
|
@@ -3283,9 +3280,9 @@ var Et = class {
|
|
|
3283
3280
|
const t = getInternalSlotOrThrowForDuration(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
3284
3281
|
validateTemporalUnitValue(a, l), a !== q && a !== B || throwRangeError(disallowedUnit(a));
|
|
3285
3282
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
3286
|
-
if (i.
|
|
3283
|
+
if (i.ve === G && 1 === i.Ee) return temporalDurationToString(t, i.$e);
|
|
3287
3284
|
const c = toInternalDurationRecord(t);
|
|
3288
|
-
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(c.A, roundTimeDuration(c.p, i.
|
|
3285
|
+
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(c.A, roundTimeDuration(c.p, i.Ee, i.ve, r)), largerOfTwoTemporalUnits(defaultTemporalLargestUnit(t), J)), i.$e);
|
|
3289
3286
|
}
|
|
3290
3287
|
toJSON() {
|
|
3291
3288
|
return temporalDurationToString(getInternalSlotOrThrowForDuration(this));
|
|
@@ -3424,7 +3421,7 @@ var Wt = class {
|
|
|
3424
3421
|
const t = getInternalSlotOrThrowForInstant(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0), i = o.timeZone;
|
|
3425
3422
|
validateTemporalUnitValue(a, l), a === q && throwRangeError(invalidField("smallestUnit"));
|
|
3426
3423
|
const c = mapUnlessUndefined(i, toTemporalTimeZoneIdentifier), s = toSecondsStringPrecisionRecord(a, n);
|
|
3427
|
-
return temporalInstantToString(roundTemporalInstant(t.U, s.
|
|
3424
|
+
return temporalInstantToString(roundTemporalInstant(t.U, s.Ee, s.ve, r), c, s.$e);
|
|
3428
3425
|
}
|
|
3429
3426
|
toLocaleString(e = void 0, t = void 0) {
|
|
3430
3427
|
return getInternalSlotOrThrowForInstant(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -3449,7 +3446,8 @@ const At = class {
|
|
|
3449
3446
|
Lt.DateTimeFormat.value = DateTimeFormat;
|
|
3450
3447
|
const kt = {};
|
|
3451
3448
|
Object.defineProperties(kt, Lt);
|
|
3452
|
-
|
|
3449
|
+
let zt, Vt = 0, xt = -Infinity;
|
|
3450
|
+
const Ht = {
|
|
3453
3451
|
timeZoneId: () => systemTimeZoneIdentifier(),
|
|
3454
3452
|
instant: () => createTemporalInstant(systemUtcEpochNanoseconds()),
|
|
3455
3453
|
plainDateTimeISO: (e = void 0) => createTemporalDateTime(systemDateTime(e), "iso8601"),
|
|
@@ -3457,8 +3455,8 @@ const zt = {
|
|
|
3457
3455
|
plainDateISO: (e = void 0) => createTemporalDate(systemDateTime(e).o, "iso8601"),
|
|
3458
3456
|
plainTimeISO: (e = void 0) => createTemporalTime(systemDateTime(e).p)
|
|
3459
3457
|
};
|
|
3460
|
-
defineStringTag(
|
|
3461
|
-
const
|
|
3458
|
+
defineStringTag(Ht, "Temporal.Now"), makePropertiesNonEnumerable(Ht);
|
|
3459
|
+
const qt = {
|
|
3462
3460
|
Instant: Wt,
|
|
3463
3461
|
PlainDateTime: Ne,
|
|
3464
3462
|
PlainDate: Tt,
|
|
@@ -3467,7 +3465,7 @@ const Vt = {
|
|
|
3467
3465
|
PlainMonthDay: lt,
|
|
3468
3466
|
Duration: Et,
|
|
3469
3467
|
ZonedDateTime: Me,
|
|
3470
|
-
Now:
|
|
3468
|
+
Now: Ht
|
|
3471
3469
|
};
|
|
3472
|
-
defineStringTag(
|
|
3473
|
-
export { defineNonEnumerableProperty as i,
|
|
3470
|
+
defineStringTag(qt, "Temporal"), makePropertiesNonEnumerable(qt);
|
|
3471
|
+
export { defineNonEnumerableProperty as a, At as i, setSystemTimeZoneIdCacheTtl as n, kt as r, qt as t };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { i as a, r as s, t as r } from "./src-CfkGat92.js";
|
|
2
|
+
export { s as Intl, r as Temporal, a as toTemporalInstant };
|
package/dist/shim.d.ts
CHANGED
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
* @param overwrite Whether to overwrite an existing Temporal implementation
|
|
4
4
|
*/
|
|
5
5
|
export declare function install(overwrite: boolean): void;
|
|
6
|
+
/**
|
|
7
|
+
* Set TTL for `Temporal.Now.timeZoneId` cache (`Infinity` means no expiration). Pass `0` to clear and disable cache again.
|
|
8
|
+
* @param ttl TTL in milliseconds
|
|
9
|
+
*/
|
|
10
|
+
export declare function setSystemTimeZoneIdCacheTtl(ttl: number): void;
|
package/dist/shim.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
function install(s) {
|
|
2
|
-
(s || "object" != typeof globalThis.Temporal) && (
|
|
2
|
+
(s || "object" != typeof globalThis.Temporal) && (t(globalThis, "Temporal", l), t(globalThis, "Intl", e), t(Date.prototype, "toTemporalInstant", a));
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
function setSystemTimeZoneIdCacheTtl(t) {
|
|
5
|
+
s(t);
|
|
6
|
+
}
|
|
7
|
+
import { a as t, i as a, n as s, r as e, t as l } from "./src-CfkGat92.js";
|
|
8
|
+
export { install, setSystemTimeZoneIdCacheTtl };
|
|
@@ -214,8 +214,8 @@ function toTemporalZonedDateTime(e, t) {
|
|
|
214
214
|
Dt.F,
|
|
215
215
|
Dt.v,
|
|
216
216
|
Dt.R,
|
|
217
|
-
Dt.
|
|
218
|
-
], [Dt.
|
|
217
|
+
Dt.Z
|
|
218
|
+
], [Dt.Z]);
|
|
219
219
|
o = s.timeZone, n = s.offset;
|
|
220
220
|
const d = getOptionsObject(t);
|
|
221
221
|
r = getTemporalDisambiguationOption(d), a = getTemporalOffsetOption(d, h);
|
|
@@ -224,7 +224,7 @@ function toTemporalZonedDateTime(e, t) {
|
|
|
224
224
|
} else {
|
|
225
225
|
validateString(e);
|
|
226
226
|
const m = parseIsoDateTime(e, [Xe]);
|
|
227
|
-
o = toTemporalTimeZoneIdentifier(m.N
|
|
227
|
+
o = toTemporalTimeZoneIdentifier(m.Z.N), n = m.Z.$, s = m.Z.M, i = canonicalizeCalendar(m.U || "iso8601"), d = !1, n && (d = hasUtcOffsetSubMinuteParts(n));
|
|
228
228
|
const T = getOptionsObject(t);
|
|
229
229
|
r = getTemporalDisambiguationOption(T), a = getTemporalOffsetOption(T, h), getTemporalOverflowOption(T), l = createIsoDateRecord(m.t, m.u, m.T), c = m.p;
|
|
230
230
|
}
|
|
@@ -237,19 +237,19 @@ function createTemporalZonedDateTime(e, t, o, n) {
|
|
|
237
237
|
function createZonedDateTimeSlot(e, t, o, n) {
|
|
238
238
|
return {
|
|
239
239
|
Y: e,
|
|
240
|
-
|
|
240
|
+
Z: t,
|
|
241
241
|
U: o,
|
|
242
242
|
A: n
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
245
|
function temporalZonedDateTimeToString(e, t, o, n, r, a = 1, i = G, l = P) {
|
|
246
|
-
const c = roundTemporalInstant(e.Y, a, i, l), s = epochSeconds(c) === epochSeconds(e.Y) ? getOffsetNanosecondsForZonedDateTimeSlot(e) : getOffsetNanosecondsFor(e.
|
|
247
|
-
return `${isoDateTimeToString(getIsoDateTimeFromOffsetNanoseconds(c, s), "iso8601", t, $)}${r === A ? "" : formatDateTimeUtcOffsetRounded(s)}${n === z ? "" : `[${n === V ? "!" : ""}${e.
|
|
246
|
+
const c = roundTemporalInstant(e.Y, a, i, l), s = epochSeconds(c) === epochSeconds(e.Y) ? getOffsetNanosecondsForZonedDateTimeSlot(e) : getOffsetNanosecondsFor(e.Z, c);
|
|
247
|
+
return `${isoDateTimeToString(getIsoDateTimeFromOffsetNanoseconds(c, s), "iso8601", t, $)}${r === A ? "" : formatDateTimeUtcOffsetRounded(s)}${n === z ? "" : `[${n === V ? "!" : ""}${e.Z}]`}${formatCalendarAnnotation(e.U, o)}`;
|
|
248
248
|
}
|
|
249
249
|
function addZonedDateTime(e, t, o) {
|
|
250
250
|
if (0 === dateDurationSign(t.W)) return addInstant(e.Y, t.p);
|
|
251
251
|
const n = getIsoDateTimeForZonedDateTimeSlot(e);
|
|
252
|
-
return addInstant(getEpochNanosecondsFor(e.
|
|
252
|
+
return addInstant(getEpochNanosecondsFor(e.Z, validateIsoDateTime(combineIsoDateAndTimeRecord(calendarDateAdd(e.U, n.o, t.W, o), n.p)), g), t.p);
|
|
253
253
|
}
|
|
254
254
|
function differenceZonedDateTime(e, t, o) {
|
|
255
255
|
const n = compareEpochNanoseconds(e.Y, t.Y);
|
|
@@ -257,19 +257,19 @@ function differenceZonedDateTime(e, t, o) {
|
|
|
257
257
|
const r = getIsoDateTimeForZonedDateTimeSlot(e), a = getIsoDateTimeForZonedDateTimeSlot(t);
|
|
258
258
|
if (!compareIsoDate(r.o, a.o)) return combineDateAndTimeDuration(zeroDateDuration(), timeDurationFromEpochNanosecondsDifference(t.Y, e.Y));
|
|
259
259
|
let i, l = differenceTime(r.p, a.p);
|
|
260
|
-
for (let o = ft(l) === n ? 1 : 0; o <= (3 - n) / 2 && (i = combineIsoDateAndTimeRecord(addDaysToIsoDate(a.o, o * n), r.p), l = timeDurationFromEpochNanosecondsDifference(t.Y, getEpochNanosecondsFor(e.
|
|
260
|
+
for (let o = ft(l) === n ? 1 : 0; o <= (3 - n) / 2 && (i = combineIsoDateAndTimeRecord(addDaysToIsoDate(a.o, o * n), r.p), l = timeDurationFromEpochNanosecondsDifference(t.Y, getEpochNanosecondsFor(e.Z, i, g)), ft(l) === n); o++);
|
|
261
261
|
return combineDateAndTimeDuration(calendarDateUntil(e.U, r.o, i.o, largerOfTwoTemporalUnits(o, L)), l);
|
|
262
262
|
}
|
|
263
263
|
function differenceZonedDateTimeWithRounding(e, t, o, n, r, a) {
|
|
264
264
|
if (!isDateUnit(o)) return differenceInstant(e.Y, t.Y, n, r, a);
|
|
265
265
|
const i = differenceZonedDateTime(e, t, o);
|
|
266
|
-
return r === G && 1 === n ? i : roundRelativeDuration(i, e.Y, t.Y, getIsoDateTimeForZonedDateTimeSlot(e), e.
|
|
266
|
+
return r === G && 1 === n ? i : roundRelativeDuration(i, e.Y, t.Y, getIsoDateTimeForZonedDateTimeSlot(e), e.Z, e.U, o, n, r, a);
|
|
267
267
|
}
|
|
268
268
|
function differenceTemporalZonedDateTime(e, t, o, n) {
|
|
269
269
|
const r = toTemporalZonedDateTime(o);
|
|
270
270
|
calendarEquals(t.U, r.U) || throwRangeError(De);
|
|
271
271
|
const a = getDifferenceSettings(e, getOptionsObject(n), d, [], G, B);
|
|
272
|
-
return isDateUnit(a.V) ? (timeZoneEquals(t.
|
|
272
|
+
return isDateUnit(a.V) ? (timeZoneEquals(t.Z, r.Z) || throwRangeError("time zone mismatch"), compareEpochNanoseconds(t.Y, r.Y) ? createTemporalDuration(applySignToDurationSlot(temporalDurationFromInternal(differenceZonedDateTimeWithRounding(t, r, a.V, a.H, a.L, a.B), B), e)) : createTemporalDuration(createTemporalDurationSlot([
|
|
273
273
|
0,
|
|
274
274
|
0,
|
|
275
275
|
0,
|
|
@@ -283,10 +283,10 @@ function differenceTemporalZonedDateTime(e, t, o, n) {
|
|
|
283
283
|
]))) : createTemporalDuration(applySignToDurationSlot(temporalDurationFromInternal(differenceInstant(t.Y, r.Y, a.H, a.L, a.B), a.V), e));
|
|
284
284
|
}
|
|
285
285
|
function addDurationToZonedDateTime(e, t, o, n) {
|
|
286
|
-
return createTemporalZonedDateTime(addZonedDateTime(t, toInternalDurationRecord(applySignToDurationSlot(toTemporalDuration(o), e)), getTemporalOverflowOption(getOptionsObject(n))), t.
|
|
286
|
+
return createTemporalZonedDateTime(addZonedDateTime(t, toInternalDurationRecord(applySignToDurationSlot(toTemporalDuration(o), e)), getTemporalOverflowOption(getOptionsObject(n))), t.Z, t.U);
|
|
287
287
|
}
|
|
288
288
|
function getOffsetNanosecondsForZonedDateTimeSlot(e) {
|
|
289
|
-
return e.A ??= getOffsetNanosecondsFor(e.
|
|
289
|
+
return e.A ??= getOffsetNanosecondsFor(e.Z, e.Y);
|
|
290
290
|
}
|
|
291
291
|
function getIsoDateTimeForZonedDateTimeSlot(e) {
|
|
292
292
|
return getIsoDateTimeFromOffsetNanoseconds(e.Y, getOffsetNanosecondsForZonedDateTimeSlot(e));
|
|
@@ -387,7 +387,7 @@ function formatDateTimeUtcOffsetRounded(e) {
|
|
|
387
387
|
return formatOffsetTimeZoneIdentifier(roundNumberToIncrement(e, t, Z) / t);
|
|
388
388
|
}
|
|
389
389
|
function toTemporalTimeZoneIdentifier(e) {
|
|
390
|
-
if (isZonedDateTime(e)) return getInternalSlotOrThrowForZonedDateTime(e).
|
|
390
|
+
if (isZonedDateTime(e)) return getInternalSlotOrThrowForZonedDateTime(e).Z;
|
|
391
391
|
validateString(e);
|
|
392
392
|
const t = ((e) => {
|
|
393
393
|
if (isTimeZoneIdentifier(e)) return parseTimeZoneIdentifier(e);
|
|
@@ -398,7 +398,7 @@ function toTemporalTimeZoneIdentifier(e) {
|
|
|
398
398
|
tt,
|
|
399
399
|
ot,
|
|
400
400
|
nt
|
|
401
|
-
]).
|
|
401
|
+
]).Z, o = t.N || t.M && "UTC" || t.$;
|
|
402
402
|
return o || throwRangeError(invalidTimeZone(e)), parseTimeZoneIdentifier(o);
|
|
403
403
|
})(e);
|
|
404
404
|
return t.J ? getAvailableNamedTimeZoneIdentifier(t.J) : formatOffsetTimeZoneIdentifier(t.G);
|
|
@@ -693,10 +693,10 @@ function parseIsoDateTime(e, t) {
|
|
|
693
693
|
u: Fe(n.b || n.m || 1),
|
|
694
694
|
T: Fe(n.c || n.n || 1),
|
|
695
695
|
p: n.d ? getTimeRecordFromMatchedGroups(n) : void 0,
|
|
696
|
-
|
|
696
|
+
Z: {
|
|
697
697
|
M: !!n.i,
|
|
698
698
|
$: n.h,
|
|
699
|
-
|
|
699
|
+
N: n.j
|
|
700
700
|
},
|
|
701
701
|
U: r
|
|
702
702
|
};
|
|
@@ -1460,13 +1460,13 @@ function getTemporalRelativeToOption(e) {
|
|
|
1460
1460
|
Dt.F,
|
|
1461
1461
|
Dt.v,
|
|
1462
1462
|
Dt.R,
|
|
1463
|
-
Dt.
|
|
1463
|
+
Dt.Z
|
|
1464
1464
|
], []), s = interpretTemporalDateTimeFields(r, l, p);
|
|
1465
1465
|
a = s.o, i = s.p, o = l.timeZone, n = l.offset, c = n ? S : w;
|
|
1466
1466
|
} else {
|
|
1467
1467
|
validateString(t);
|
|
1468
1468
|
const e = parseIsoDateTime(t, [Xe, Qe]);
|
|
1469
|
-
n = e.
|
|
1469
|
+
n = e.Z.$, e.Z.N ? (o = toTemporalTimeZoneIdentifier(e.Z.N), c = e.Z.M ? F : n ? S : w, l = void 0 !== n && hasUtcOffsetSubMinuteParts(n)) : o = void 0, r = canonicalizeCalendar(e.U || "iso8601"), a = createIsoDateRecord(e.t, e.u, e.T), i = e.p;
|
|
1470
1470
|
}
|
|
1471
1471
|
return createNullPrototypeObject(o ? { Pe: getInternalSlotOrThrowForZonedDateTime(createTemporalZonedDateTime(interpretISODateTimeOffset(a, i, c, c === S ? parseDateTimeUtcOffset(n) : 0, o, g, O, l), o, r)) } : { be: getInternalSlotOrThrowForPlainDate(createTemporalDate(a, r)) });
|
|
1472
1472
|
}
|
|
@@ -1636,8 +1636,8 @@ function createDateTimeFormat(e, t = createNullPrototypeObject({}), o, n, r = Ob
|
|
|
1636
1636
|
for (const e of Object.keys(d)) void 0 === a[e] && (d[e] = void 0);
|
|
1637
1637
|
return d.hour12 = a.hour12, d.hourCycle = a.hourCycle, d.formatMatcher = a.formatMatcher, d.timeZone = l.timeZone, d.calendar = l.calendar, (o === c && d.timeStyle || o === s && d.dateStyle) && throwTypeError(ue), vt.set(r, createNullPrototypeObject({
|
|
1638
1638
|
Re: i,
|
|
1639
|
-
|
|
1640
|
-
|
|
1639
|
+
Ze: d,
|
|
1640
|
+
Ne: i.resolvedOptions().locale
|
|
1641
1641
|
})), r;
|
|
1642
1642
|
}
|
|
1643
1643
|
function validateSameTemporalType(e, t) {
|
|
@@ -1656,7 +1656,7 @@ function toDateTimeFormattable(e) {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
function handleDateTimeValue(e, t) {
|
|
1658
1658
|
const o = getInternalSlotForPlainDate(t), n = getInternalSlotForPlainDateTime(t), r = getInternalSlotForPlainYearMonth(t), a = getInternalSlotForPlainMonthDay(t);
|
|
1659
|
-
return isPlainTime(t) ? [e.$e ||= new Ft(e.
|
|
1659
|
+
return isPlainTime(t) ? [e.$e ||= new Ft(e.Ne, amendOptionsForPlainTime(e.Ze)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(createIsoDateRecord(1970, 1, 1), getInternalSlotOrThrowForPlainTime(t))))] : o ? (o.U !== e.Ze.calendar && "iso8601" !== o.U && throwRangeError(De), [e.Me ||= new Ft(e.Ne, amendOptionsForPlainDate(e.Ze)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(o.o, midnightTimeRecord())))]) : n ? (n.U !== e.Ze.calendar && "iso8601" !== n.U && throwRangeError(De), [e.Ue ||= new Ft(e.Ne, amendOptionsForPlainDateTime(e.Ze)), epochMilliseconds(getUtcEpochNanoseconds(n._))]) : r ? (r.U !== e.Ze.calendar && throwRangeError(De), [e.je ||= new Ft(e.Ne, amendOptionsForPlainYearMonth(e.Ze)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(r.o, midnightTimeRecord())))]) : a ? (a.U !== e.Ze.calendar && throwRangeError(De), [e.Ce ||= new Ft(e.Ne, amendOptionsForPlainMonthDay(e.Ze)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(a.o, midnightTimeRecord())))]) : isInstant(t) ? [e.Ye ||= new Ft(e.Ne, amendOptionsForInstant(e.Ze)), epochMilliseconds(getInternalSlotOrThrowForInstant(t).Y)] : (isZonedDateTime(t) && throwTypeError(fe), [e.Re, t]);
|
|
1660
1660
|
}
|
|
1661
1661
|
function DateTimeFormat(e, t) {
|
|
1662
1662
|
return new bt(e, t);
|
|
@@ -1671,7 +1671,7 @@ function toTemporalInstant$1(e) {
|
|
|
1671
1671
|
e = toPrimitive(e);
|
|
1672
1672
|
}
|
|
1673
1673
|
validateString(e);
|
|
1674
|
-
const t = parseIsoDateTime(e, [et]), o = t.
|
|
1674
|
+
const t = parseIsoDateTime(e, [et]), o = t.Z.M ? 0 : parseDateTimeUtcOffset(t.Z.$), n = t.p;
|
|
1675
1675
|
return createTemporalInstant(validateEpochNanoseconds(getUtcEpochNanoseconds(balanceIsoDateTime(t.t, t.u, t.T, n.D, n.I, n.O, n.S, n.F, n.v - o))));
|
|
1676
1676
|
}
|
|
1677
1677
|
function addInstant(e, t) {
|
|
@@ -1714,7 +1714,10 @@ function clampEpochNanoseconds(e) {
|
|
|
1714
1714
|
return compareEpochNanoseconds(e, ve) > 0 ? ve : compareEpochNanoseconds(e, we) < 0 ? we : e;
|
|
1715
1715
|
}
|
|
1716
1716
|
function systemTimeZoneIdentifier() {
|
|
1717
|
-
return new Ft().resolvedOptions().timeZone;
|
|
1717
|
+
return Ct && Yt + Ct > Date.now() && $t ? $t : (Yt = Date.now(), $t = new Ft().resolvedOptions().timeZone);
|
|
1718
|
+
}
|
|
1719
|
+
function setSystemTimeZoneIdCacheTtl(e) {
|
|
1720
|
+
Ct = e, e || ($t = void 0, Yt = -Infinity);
|
|
1718
1721
|
}
|
|
1719
1722
|
function systemUtcEpochNanoseconds() {
|
|
1720
1723
|
return createEpochNanosecondsFromEpochMilliseconds(Date.now());
|
|
@@ -1759,7 +1762,7 @@ var Pe = class {
|
|
|
1759
1762
|
return getInternalSlotOrThrowForZonedDateTime(this).U;
|
|
1760
1763
|
}
|
|
1761
1764
|
get timeZoneId() {
|
|
1762
|
-
return getInternalSlotOrThrowForZonedDateTime(this).
|
|
1765
|
+
return getInternalSlotOrThrowForZonedDateTime(this).Z;
|
|
1763
1766
|
}
|
|
1764
1767
|
get era() {
|
|
1765
1768
|
return calendarIsoToDateForZonedDateTimeSlot(getInternalSlotOrThrowForZonedDateTime(this)).oe;
|
|
@@ -1817,7 +1820,7 @@ var Pe = class {
|
|
|
1817
1820
|
}
|
|
1818
1821
|
get hoursInDay() {
|
|
1819
1822
|
const e = getInternalSlotOrThrowForZonedDateTime(this), t = getIsoDateTimeForZonedDateTimeSlot(e).o;
|
|
1820
|
-
return timeDurationToSubsecondsNumber(differenceEpochNanoseconds(getStartOfDay(e.
|
|
1823
|
+
return timeDurationToSubsecondsNumber(differenceEpochNanoseconds(getStartOfDay(e.Z, t), getStartOfDay(e.Z, addDaysToIsoDate(t, 1))), -9) / o;
|
|
1821
1824
|
}
|
|
1822
1825
|
get daysInWeek() {
|
|
1823
1826
|
return calendarIsoToDateForZonedDateTimeSlot(getInternalSlotOrThrowForZonedDateTime(this)).ce;
|
|
@@ -1859,11 +1862,11 @@ var Pe = class {
|
|
|
1859
1862
|
Dt.v,
|
|
1860
1863
|
Dt.R
|
|
1861
1864
|
])), i = getOptionsObject(t), l = getTemporalDisambiguationOption(i), c = getTemporalOffsetOption(i, I), s = getTemporalOverflowOption(i), d = interpretTemporalDateTimeFields(o.U, a, s);
|
|
1862
|
-
return createTemporalZonedDateTime(interpretISODateTimeOffset(d.o, d.p, S, parseDateTimeUtcOffset(a[Dt.R]), o.
|
|
1865
|
+
return createTemporalZonedDateTime(interpretISODateTimeOffset(d.o, d.p, S, parseDateTimeUtcOffset(a[Dt.R]), o.Z, l, c, !0), o.Z, o.U);
|
|
1863
1866
|
}
|
|
1864
1867
|
withPlainTime(e = void 0) {
|
|
1865
1868
|
const t = getInternalSlotOrThrowForZonedDateTime(this), o = getIsoDateTimeForZonedDateTimeSlot(t);
|
|
1866
|
-
return createTemporalZonedDateTime(void 0 === e ? getStartOfDay(t.
|
|
1869
|
+
return createTemporalZonedDateTime(void 0 === e ? getStartOfDay(t.Z, o.o) : getEpochNanosecondsFor(t.Z, combineIsoDateAndTimeRecord(o.o, toTemporalTime(e)), g), t.Z, t.U);
|
|
1867
1870
|
}
|
|
1868
1871
|
withTimeZone(e) {
|
|
1869
1872
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
@@ -1871,7 +1874,7 @@ var Pe = class {
|
|
|
1871
1874
|
}
|
|
1872
1875
|
withCalendar(e) {
|
|
1873
1876
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
1874
|
-
return createTemporalZonedDateTime(t.Y, t.
|
|
1877
|
+
return createTemporalZonedDateTime(t.Y, t.Z, toTemporalCalendarIdentifier(e));
|
|
1875
1878
|
}
|
|
1876
1879
|
add(e, t = void 0) {
|
|
1877
1880
|
return addDurationToZonedDateTime(1, getInternalSlotOrThrowForZonedDateTime(this), e, t);
|
|
@@ -1890,15 +1893,15 @@ var Pe = class {
|
|
|
1890
1893
|
if (validateTemporalUnitValue(a, s, [L]), validateTemporalRoundingIncrement(n, a === L ? 1 : maximumTemporalDurationRoundingIncrement(a), a === L), a === G && 1 === n) return createTemporalZonedDateTimeFromSlot(t);
|
|
1891
1894
|
const i = getIsoDateTimeForZonedDateTimeSlot(t);
|
|
1892
1895
|
if (a === L) {
|
|
1893
|
-
const e = getStartOfDay(t.
|
|
1894
|
-
return createTemporalZonedDateTime(addNanosecondsToEpochSeconds(e, roundNumberToIncrement(timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, t.Y), -9), timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, o), -9), r)), t.
|
|
1896
|
+
const e = getStartOfDay(t.Z, i.o), o = getStartOfDay(t.Z, addDaysToIsoDate(i.o, 1));
|
|
1897
|
+
return createTemporalZonedDateTime(addNanosecondsToEpochSeconds(e, roundNumberToIncrement(timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, t.Y), -9), timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, o), -9), r)), t.Z, t.U);
|
|
1895
1898
|
}
|
|
1896
1899
|
const l = roundIsoDateTime(i, n, a, r), c = getOffsetNanosecondsForZonedDateTimeSlot(t);
|
|
1897
|
-
return createTemporalZonedDateTime(interpretISODateTimeOffset(l.o, l.p, S, c, t.
|
|
1900
|
+
return createTemporalZonedDateTime(interpretISODateTimeOffset(l.o, l.p, S, c, t.Z, g, I, !0), t.Z, t.U);
|
|
1898
1901
|
}
|
|
1899
1902
|
equals(e) {
|
|
1900
1903
|
const t = getInternalSlotOrThrowForZonedDateTime(this), o = toTemporalZonedDateTime(e);
|
|
1901
|
-
return !compareEpochNanoseconds(t.Y, o.Y) && timeZoneEquals(t.
|
|
1904
|
+
return !compareEpochNanoseconds(t.Y, o.Y) && timeZoneEquals(t.Z, o.Z) && calendarEquals(t.U, o.U);
|
|
1902
1905
|
}
|
|
1903
1906
|
toString(e = void 0) {
|
|
1904
1907
|
const t = getInternalSlotOrThrowForZonedDateTime(this), o = getOptionsObject(e), n = getTemporalShowCalendarNameOption(o), r = getTemporalFractionalSecondDigitsOption(o), a = ((e) => getOption(e, "offset", [Y, A], Y))(o), i = getRoundingModeOption(o, P), l = getTemporalUnitValuedOption(o, "smallestUnit", void 0), c = ((e) => getOption(e, "timeZoneName", [
|
|
@@ -1911,8 +1914,8 @@ var Pe = class {
|
|
|
1911
1914
|
return temporalZonedDateTimeToString(t, d.ve, n, c, a, d.Ee, d.ye, i);
|
|
1912
1915
|
}
|
|
1913
1916
|
toLocaleString(e = void 0, t = void 0) {
|
|
1914
|
-
const o = getInternalSlotOrThrowForZonedDateTime(this), n = createDateTimeFormat(e, t, d, o.
|
|
1915
|
-
return "iso8601" === o.U || calendarEquals(o.U, r.
|
|
1917
|
+
const o = getInternalSlotOrThrowForZonedDateTime(this), n = createDateTimeFormat(e, t, d, o.Z), r = getInternalSlotOrThrowForDateTimeFormat(n);
|
|
1918
|
+
return "iso8601" === o.U || calendarEquals(o.U, r.Ze.calendar) || throwRangeError(De), formatDateTime(n, createTemporalInstant(o.Y));
|
|
1916
1919
|
}
|
|
1917
1920
|
toJSON() {
|
|
1918
1921
|
return temporalZonedDateTimeToString(getInternalSlotOrThrowForZonedDateTime(this), void 0, U, W, Y);
|
|
@@ -1922,7 +1925,7 @@ var Pe = class {
|
|
|
1922
1925
|
}
|
|
1923
1926
|
startOfDay() {
|
|
1924
1927
|
const e = getInternalSlotOrThrowForZonedDateTime(this);
|
|
1925
|
-
return createTemporalZonedDateTime(getStartOfDay(e.
|
|
1928
|
+
return createTemporalZonedDateTime(getStartOfDay(e.Z, getIsoDateTimeForZonedDateTimeSlot(e).o), e.Z, e.U);
|
|
1926
1929
|
}
|
|
1927
1930
|
getTimeZoneTransition(e) {
|
|
1928
1931
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
@@ -1931,8 +1934,8 @@ var Pe = class {
|
|
|
1931
1934
|
if ("UTC" === e || isOffsetTimeZoneIdentifier(e)) return null;
|
|
1932
1935
|
const n = -4e9, r = Math.floor((Date.now() + 31536e7) / 1e3), a = clamp(epochSeconds(addNanosecondsToEpochSeconds(t, o > 0 ? 0 : -1)), n, Infinity);
|
|
1933
1936
|
return -1 === o ? a === n ? null : a > r ? searchTimeZoneTransition(e, a, a - 31536e3, o) || searchTimeZoneTransition(e, r, n, o) : searchTimeZoneTransition(e, a, n, o) : searchTimeZoneTransition(e, a, a > r ? a + 31536e3 : r, o);
|
|
1934
|
-
})(t.
|
|
1935
|
-
return null === n ? null : createTemporalZonedDateTime(n, t.
|
|
1937
|
+
})(t.Z, t.Y, "next" === o ? 1 : -1);
|
|
1938
|
+
return null === n ? null : createTemporalZonedDateTime(n, t.Z, t.U);
|
|
1936
1939
|
}
|
|
1937
1940
|
toInstant() {
|
|
1938
1941
|
return createTemporalInstant(getInternalSlotOrThrowForZonedDateTime(this).Y);
|
|
@@ -2537,7 +2540,7 @@ const Dt = {
|
|
|
2537
2540
|
F: "microsecond",
|
|
2538
2541
|
v: "nanosecond",
|
|
2539
2542
|
R: "offset",
|
|
2540
|
-
|
|
2543
|
+
Z: "timeZone"
|
|
2541
2544
|
}, pt = [
|
|
2542
2545
|
Dt.oe,
|
|
2543
2546
|
Dt.ne,
|
|
@@ -2552,7 +2555,7 @@ const Dt = {
|
|
|
2552
2555
|
Dt.F,
|
|
2553
2556
|
Dt.v,
|
|
2554
2557
|
Dt.R,
|
|
2555
|
-
Dt.
|
|
2558
|
+
Dt.Z
|
|
2556
2559
|
], ht = {
|
|
2557
2560
|
[Dt.oe]: [toString],
|
|
2558
2561
|
[Dt.ne]: [toIntegerWithTruncation],
|
|
@@ -2570,7 +2573,7 @@ const Dt = {
|
|
|
2570
2573
|
const t = toPrimitive(e);
|
|
2571
2574
|
return validateString(t), parseDateTimeUtcOffset(t), t;
|
|
2572
2575
|
}],
|
|
2573
|
-
[Dt.
|
|
2576
|
+
[Dt.Z]: [toTemporalTimeZoneIdentifier]
|
|
2574
2577
|
}, gt = /* @__PURE__ */ new WeakMap(), ft = signTimeDuration;
|
|
2575
2578
|
var It = class {
|
|
2576
2579
|
constructor(e = 0, t = 0, o = 0, n = 0, r = 0, a = 0, i = 0, l = 0, c = 0, s = 0) {
|
|
@@ -2658,7 +2661,7 @@ var It = class {
|
|
|
2658
2661
|
const c = void 0 !== l;
|
|
2659
2662
|
l ??= G;
|
|
2660
2663
|
const s = defaultTemporalLargestUnit(t), m = largerOfTwoTemporalUnits(s, l), T = void 0 !== n;
|
|
2661
|
-
if (void 0 !== n && "auto" !== n || (n = m), (!c && !T || n > l) && throwRangeError(he), isDateUnit(l) || validateTemporalRoundingIncrement(a, maximumTemporalDurationRoundingIncrement(l), !1), a > 1 && n !== l && isDateUnit(l) && throwRangeError(he), r.Pe) return createTemporalDuration(temporalDurationFromInternal(differenceZonedDateTimeWithRounding(r.Pe, createZonedDateTimeSlot(addZonedDateTime(r.Pe, toInternalDurationRecord(t), p), r.Pe.
|
|
2664
|
+
if (void 0 !== n && "auto" !== n || (n = m), (!c && !T || n > l) && throwRangeError(he), isDateUnit(l) || validateTemporalRoundingIncrement(a, maximumTemporalDurationRoundingIncrement(l), !1), a > 1 && n !== l && isDateUnit(l) && throwRangeError(he), r.Pe) return createTemporalDuration(temporalDurationFromInternal(differenceZonedDateTimeWithRounding(r.Pe, createZonedDateTimeSlot(addZonedDateTime(r.Pe, toInternalDurationRecord(t), p), r.Pe.Z, r.Pe.U), n, a, l, i), isDateUnit(n) ? B : n));
|
|
2662
2665
|
if (r.be) {
|
|
2663
2666
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2664
2667
|
return createTemporalDuration(temporalDurationFromInternal(differencePlainDateTimeWithRounding(combineIsoDateAndTimeRecord(r.be.o, midnightTimeRecord()), combineIsoDateAndTimeRecord(calendarDateAdd(r.be.U, r.be.o, adjustDateDurationRecord(e.W, o.K), p), o), r.be.U, n, a, l, i), n));
|
|
@@ -2671,7 +2674,7 @@ var It = class {
|
|
|
2671
2674
|
const t = getInternalSlotOrThrowForDuration(this);
|
|
2672
2675
|
void 0 === e && throwTypeError(Se);
|
|
2673
2676
|
const o = "string" == typeof e ? createNullPrototypeObject({ unit: e }) : getOptionsObject(e), n = getTemporalRelativeToOption(o), r = getTemporalUnitValuedOption(o, "unit", u);
|
|
2674
|
-
if (validateTemporalUnitValue(r, d), n.Pe) return ((e, t, o) => isDateUnit(o) ? totalRelativeDuration(differenceZonedDateTime(e, t, o), e.Y, t.Y, getIsoDateTimeForZonedDateTimeSlot(e), e.
|
|
2677
|
+
if (validateTemporalUnitValue(r, d), n.Pe) return ((e, t, o) => isDateUnit(o) ? totalRelativeDuration(differenceZonedDateTime(e, t, o), e.Y, t.Y, getIsoDateTimeForZonedDateTimeSlot(e), e.Z, e.U, o) : totalTimeDuration(timeDurationFromEpochNanosecondsDifference(t.Y, e.Y), o))(n.Pe, createZonedDateTimeSlot(addZonedDateTime(n.Pe, toInternalDurationRecord(t), p), n.Pe.Z, n.Pe.U), r);
|
|
2675
2678
|
if (n.be) {
|
|
2676
2679
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2677
2680
|
return ((e, t, o, n) => compareIsoDateTime(e, t) ? (validateIsoDateTime(e), validateIsoDateTime(t), totalRelativeDuration(differenceISODateTime(e, t, o, n), getUtcEpochNanoseconds(e), getUtcEpochNanoseconds(t), e, void 0, 0, n)) : 0)(combineIsoDateAndTimeRecord(n.be.o, midnightTimeRecord()), combineIsoDateAndTimeRecord(calendarDateAdd(n.be.U, n.be.o, adjustDateDurationRecord(e.W, o.K), p), o), n.be.U, r);
|
|
@@ -2848,7 +2851,8 @@ const Mt = class {
|
|
|
2848
2851
|
Ut.DateTimeFormat.value = DateTimeFormat;
|
|
2849
2852
|
const jt = {};
|
|
2850
2853
|
Object.defineProperties(jt, Ut);
|
|
2851
|
-
|
|
2854
|
+
let $t, Ct = 0, Yt = -Infinity;
|
|
2855
|
+
const At = {
|
|
2852
2856
|
timeZoneId: () => systemTimeZoneIdentifier(),
|
|
2853
2857
|
instant: () => createTemporalInstant(systemUtcEpochNanoseconds()),
|
|
2854
2858
|
plainDateTimeISO: (e = void 0) => createTemporalDateTime(systemDateTime(e), "iso8601"),
|
|
@@ -2856,8 +2860,8 @@ const $t = {
|
|
|
2856
2860
|
plainDateISO: (e = void 0) => createTemporalDate(systemDateTime(e).o, "iso8601"),
|
|
2857
2861
|
plainTimeISO: (e = void 0) => createTemporalTime(systemDateTime(e).p)
|
|
2858
2862
|
};
|
|
2859
|
-
defineStringTag(
|
|
2860
|
-
const
|
|
2863
|
+
defineStringTag(At, "Temporal.Now"), makePropertiesNonEnumerable(At);
|
|
2864
|
+
const Wt = {
|
|
2861
2865
|
Instant: Nt,
|
|
2862
2866
|
PlainDateTime: Ne,
|
|
2863
2867
|
PlainDate: ut,
|
|
@@ -2866,7 +2870,7 @@ const Ct = {
|
|
|
2866
2870
|
PlainMonthDay: st,
|
|
2867
2871
|
Duration: It,
|
|
2868
2872
|
ZonedDateTime: Pe,
|
|
2869
|
-
Now:
|
|
2873
|
+
Now: At
|
|
2870
2874
|
};
|
|
2871
|
-
defineStringTag(
|
|
2872
|
-
export { defineNonEnumerableProperty as i,
|
|
2875
|
+
defineStringTag(Wt, "Temporal"), makePropertiesNonEnumerable(Wt);
|
|
2876
|
+
export { defineNonEnumerableProperty as a, Mt as i, setSystemTimeZoneIdCacheTtl as n, jt as r, Wt as t };
|