temporal-polyfill-lite 0.3.2 → 0.3.4
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 +16 -0
- package/README.md +5 -1
- 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-BRD2b69b.js} +111 -93
- 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-D8HHiqs0.js} +90 -66
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ 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.4 (2026-04-14)
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fix discrepancy of date time format between timestamp and Temporal objects in `Intl.DateTimeFormat` ([#27](https://github.com/fabon-f/temporal-polyfill-lite/pull/27))
|
|
13
|
+
|
|
14
|
+
## 0.3.3 (2026-03-21)
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Introduce opt-in cache for system time zone ID ([#22](https://github.com/fabon-f/temporal-polyfill-lite/pull/22))
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Fix bugs related to extreme dates in `persian` calendar ([#23](https://github.com/fabon-f/temporal-polyfill-lite/pull/23))
|
|
23
|
+
|
|
8
24
|
## 0.3.2 (2026-03-12)
|
|
9
25
|
|
|
10
26
|
### Changed
|
package/README.md
CHANGED
|
@@ -48,4 +48,8 @@ This polyfill doesn't internally rely on `bigint`, thus you can support older br
|
|
|
48
48
|
|
|
49
49
|
## Spec compliance
|
|
50
50
|
|
|
51
|
-
It supports the latest spec with few intentional deviations (see
|
|
51
|
+
It supports the latest spec with few intentional deviations (see `tests/expectedFailures` directory for details).
|
|
52
|
+
|
|
53
|
+
## Docs
|
|
54
|
+
|
|
55
|
+
- `docs/restrictions.md`: caveats and restrictions of this polyfill
|
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-BRD2b69b.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-BRD2b69b.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) {
|
|
@@ -1829,8 +1823,8 @@ function nudgeToCalendarUnit(e, t, o, n, r, a, i, c, s, l) {
|
|
|
1829
1823
|
return roundNumberToIncrement(m.he + ((e, t, o) => signTimeDuration(e) ? ve(e, t) ? ve(addTimeDuration(e, e), t) * o / 5 + .5 : 1 : 0)(u, T, e) * c * e, c, l) === m.De && (d = !0, D = m.Ie, h = m.ge), {
|
|
1830
1824
|
Oe: {
|
|
1831
1825
|
Fe: combineDateAndTimeDuration(D, createTimeDurationFromSeconds(0)),
|
|
1832
|
-
|
|
1833
|
-
|
|
1826
|
+
ye: h,
|
|
1827
|
+
Se: d
|
|
1834
1828
|
},
|
|
1835
1829
|
we: m.he + divideTimeDurationToFloatingPoint(u, 1e9) / divideTimeDurationToFloatingPoint(T, 1e9) * c * e
|
|
1836
1830
|
};
|
|
@@ -1843,18 +1837,18 @@ function roundRelativeDuration(e, t, o, n, r, a, i, c, s, l) {
|
|
|
1843
1837
|
let I, O = !1, F = 0;
|
|
1844
1838
|
return vt(f) !== -e ? (O = !0, F = e, p = roundTimeDurationToIncrement(f, a * D, c), I = addTimeDurationToEpochNanoseconds(u, p)) : I = addTimeDurationToEpochNanoseconds(u, p), {
|
|
1845
1839
|
Fe: combineDateAndTimeDuration(adjustDateDurationRecord(t.A, t.A.K + F), p),
|
|
1846
|
-
|
|
1847
|
-
|
|
1840
|
+
ye: I,
|
|
1841
|
+
Se: O
|
|
1848
1842
|
};
|
|
1849
1843
|
})(d, e, n, r, a, c, s, l) : (function(e, t, o, n, r, a) {
|
|
1850
1844
|
const i = add24HourDaysToTimeDuration(e.p, e.A.K), c = r === H ? roundTimeDurationByDays(i, n, a) : roundTimeDurationToIncrement(i, nanosecondsForTimeUnit(r) * n, a), s = c[0], [l, d] = isDateUnit(o) ? [s, addTimeDuration(c, timeDurationFromComponents(24 * -s, 0, 0, 0, 0, 0))] : [0, c];
|
|
1851
1845
|
return {
|
|
1852
1846
|
Fe: combineDateAndTimeDuration(adjustDateDurationRecord(e.A, l), d),
|
|
1853
|
-
|
|
1854
|
-
|
|
1847
|
+
ye: addTimeDurationToEpochNanoseconds(t, addTimeDuration(c, negateTimeDuration(i))),
|
|
1848
|
+
Se: sign(s - i[0]) === vt(i)
|
|
1855
1849
|
};
|
|
1856
1850
|
})(e, o, i, c, s, l);
|
|
1857
|
-
return m.
|
|
1851
|
+
return m.Se && s !== x ? ((e, t, o, n, r, a, i, c) => {
|
|
1858
1852
|
if (c === i) return t;
|
|
1859
1853
|
const s = i;
|
|
1860
1854
|
let l;
|
|
@@ -1865,7 +1859,7 @@ function roundRelativeDuration(e, t, o, n, r, a, i, c, s, l) {
|
|
|
1865
1859
|
t = combineDateAndTimeDuration(l, createTimeDurationFromSeconds(0));
|
|
1866
1860
|
}
|
|
1867
1861
|
return t;
|
|
1868
|
-
})(d, m.Fe, m.
|
|
1862
|
+
})(d, m.Fe, m.ye, n, r, a, i, largerOfTwoTemporalUnits(s, H)) : m.Fe;
|
|
1869
1863
|
}
|
|
1870
1864
|
function totalRelativeDuration(e, t, o, n, r, a, i) {
|
|
1871
1865
|
return isCalendarUnit(i) || r && i === H ? nudgeToCalendarUnit(internalDurationSign(e) || 1, e, t, o, n, r, a, 1, i, M).we : totalTimeDuration(add24HourDaysToTimeDuration(e.p, e.A.K), i);
|
|
@@ -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) {
|
|
@@ -2197,14 +2191,34 @@ function createDateTimeFormat(e, t = createNullPrototypeObject({}), o, n, r = Ob
|
|
|
2197
2191
|
for (const n of t) o[n] = e[n];
|
|
2198
2192
|
return o;
|
|
2199
2193
|
})(Object(t), Rt);
|
|
2200
|
-
a.hour12 = mapUnlessUndefined(a.hour12, toBoolean)
|
|
2194
|
+
a.hour12 = mapUnlessUndefined(a.hour12, toBoolean);
|
|
2195
|
+
for (const e of [
|
|
2196
|
+
"hourCycle",
|
|
2197
|
+
"formatMatcher",
|
|
2198
|
+
"era",
|
|
2199
|
+
"year",
|
|
2200
|
+
"month",
|
|
2201
|
+
"day",
|
|
2202
|
+
"weekday"
|
|
2203
|
+
]) mapUnlessUndefined(a[e], toString);
|
|
2204
|
+
void 0 !== n && (void 0 !== a.timeZone && throwTypeError("disallowed field: timeZone"), a.timeZone = n, hasAnyOptions(a, [
|
|
2201
2205
|
...Zt,
|
|
2202
2206
|
...$t,
|
|
2203
2207
|
"timeZoneName"
|
|
2204
2208
|
]) || (a.timeZoneName = "short"));
|
|
2205
2209
|
const i = new Pt(e, a), c = i.resolvedOptions(), d = createNullPrototypeObject(c);
|
|
2206
2210
|
for (const e of Object.keys(d)) void 0 === a[e] && (d[e] = void 0);
|
|
2207
|
-
|
|
2211
|
+
for (const e of [
|
|
2212
|
+
"hour12",
|
|
2213
|
+
"hourCycle",
|
|
2214
|
+
"formatMatcher",
|
|
2215
|
+
"era",
|
|
2216
|
+
"year",
|
|
2217
|
+
"month",
|
|
2218
|
+
"day",
|
|
2219
|
+
"weekday"
|
|
2220
|
+
]) d[e] = a[e];
|
|
2221
|
+
return d.timeZone = c.timeZone, d.calendar = c.calendar, (o === s && d.timeStyle || o === l && d.dateStyle) && throwTypeError(Te), Nt.set(r, createNullPrototypeObject({
|
|
2208
2222
|
Pe: i,
|
|
2209
2223
|
Re: d,
|
|
2210
2224
|
Ne: i.resolvedOptions().locale
|
|
@@ -2284,7 +2298,10 @@ function clampEpochNanoseconds(e) {
|
|
|
2284
2298
|
return compareEpochNanoseconds(e, we) > 0 ? we : compareEpochNanoseconds(e, ye) < 0 ? ye : e;
|
|
2285
2299
|
}
|
|
2286
2300
|
function systemTimeZoneIdentifier() {
|
|
2287
|
-
return new Pt().resolvedOptions().timeZone;
|
|
2301
|
+
return Vt && xt + Vt > Date.now() && zt ? zt : (xt = Date.now(), zt = new Pt().resolvedOptions().timeZone);
|
|
2302
|
+
}
|
|
2303
|
+
function setSystemTimeZoneIdCacheTtl(e) {
|
|
2304
|
+
Vt = e, e || (zt = void 0, xt = -Infinity);
|
|
2288
2305
|
}
|
|
2289
2306
|
function systemUtcEpochNanoseconds() {
|
|
2290
2307
|
return createEpochNanosecondsFromEpochMilliseconds(Date.now());
|
|
@@ -2478,7 +2495,7 @@ var Me = class {
|
|
|
2478
2495
|
], A))(o);
|
|
2479
2496
|
validateTemporalUnitValue(c, l), c === q && throwRangeError(invalidField("smallestUnit"));
|
|
2480
2497
|
const d = toSecondsStringPrecisionRecord(c, r);
|
|
2481
|
-
return temporalZonedDateTimeToString(t, d.$e, n, s, a, d.
|
|
2498
|
+
return temporalZonedDateTimeToString(t, d.$e, n, s, a, d.Ee, d.ve, i);
|
|
2482
2499
|
}
|
|
2483
2500
|
toLocaleString(e = void 0, t = void 0) {
|
|
2484
2501
|
const o = getInternalSlotOrThrowForZonedDateTime(this), n = createDateTimeFormat(e, t, d, o.P), r = getInternalSlotOrThrowForDateTimeFormat(n);
|
|
@@ -2674,7 +2691,7 @@ var Ne = class {
|
|
|
2674
2691
|
const t = getInternalSlotOrThrowForPlainDateTime(this), o = getOptionsObject(e), n = getTemporalShowCalendarNameOption(o), r = getTemporalFractionalSecondDigitsOption(o), a = getRoundingModeOption(o, M), i = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2675
2692
|
validateTemporalUnitValue(i, l), i === q && throwRangeError(invalidField("smallestUnit"));
|
|
2676
2693
|
const c = toSecondsStringPrecisionRecord(i, r);
|
|
2677
|
-
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, c.
|
|
2694
|
+
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, c.Ee, c.ve, a)), t.Y, c.$e, n);
|
|
2678
2695
|
}
|
|
2679
2696
|
toLocaleString(e = void 0, t = void 0) {
|
|
2680
2697
|
return getInternalSlotOrThrowForPlainDateTime(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -2770,7 +2787,7 @@ var $e = class {
|
|
|
2770
2787
|
const t = getInternalSlotOrThrowForPlainTime(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2771
2788
|
validateTemporalUnitValue(a, l), a === q && throwRangeError(invalidField("smallestUnit"));
|
|
2772
2789
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
2773
|
-
return timeRecordToString(roundTime(t, i.
|
|
2790
|
+
return timeRecordToString(roundTime(t, i.Ee, i.ve, r), i.$e);
|
|
2774
2791
|
}
|
|
2775
2792
|
toLocaleString(e = void 0, t = void 0) {
|
|
2776
2793
|
return getInternalSlotOrThrowForPlainTime(this), formatDateTime(createDateTimeFormat(e, t, l), this);
|
|
@@ -3283,9 +3300,9 @@ var Et = class {
|
|
|
3283
3300
|
const t = getInternalSlotOrThrowForDuration(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
3284
3301
|
validateTemporalUnitValue(a, l), a !== q && a !== B || throwRangeError(disallowedUnit(a));
|
|
3285
3302
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
3286
|
-
if (i.
|
|
3303
|
+
if (i.ve === G && 1 === i.Ee) return temporalDurationToString(t, i.$e);
|
|
3287
3304
|
const c = toInternalDurationRecord(t);
|
|
3288
|
-
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(c.A, roundTimeDuration(c.p, i.
|
|
3305
|
+
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(c.A, roundTimeDuration(c.p, i.Ee, i.ve, r)), largerOfTwoTemporalUnits(defaultTemporalLargestUnit(t), J)), i.$e);
|
|
3289
3306
|
}
|
|
3290
3307
|
toJSON() {
|
|
3291
3308
|
return temporalDurationToString(getInternalSlotOrThrowForDuration(this));
|
|
@@ -3424,7 +3441,7 @@ var Wt = class {
|
|
|
3424
3441
|
const t = getInternalSlotOrThrowForInstant(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, M), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0), i = o.timeZone;
|
|
3425
3442
|
validateTemporalUnitValue(a, l), a === q && throwRangeError(invalidField("smallestUnit"));
|
|
3426
3443
|
const c = mapUnlessUndefined(i, toTemporalTimeZoneIdentifier), s = toSecondsStringPrecisionRecord(a, n);
|
|
3427
|
-
return temporalInstantToString(roundTemporalInstant(t.U, s.
|
|
3444
|
+
return temporalInstantToString(roundTemporalInstant(t.U, s.Ee, s.ve, r), c, s.$e);
|
|
3428
3445
|
}
|
|
3429
3446
|
toLocaleString(e = void 0, t = void 0) {
|
|
3430
3447
|
return getInternalSlotOrThrowForInstant(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -3449,7 +3466,8 @@ const At = class {
|
|
|
3449
3466
|
Lt.DateTimeFormat.value = DateTimeFormat;
|
|
3450
3467
|
const kt = {};
|
|
3451
3468
|
Object.defineProperties(kt, Lt);
|
|
3452
|
-
|
|
3469
|
+
let zt, Vt = 0, xt = -Infinity;
|
|
3470
|
+
const Ht = {
|
|
3453
3471
|
timeZoneId: () => systemTimeZoneIdentifier(),
|
|
3454
3472
|
instant: () => createTemporalInstant(systemUtcEpochNanoseconds()),
|
|
3455
3473
|
plainDateTimeISO: (e = void 0) => createTemporalDateTime(systemDateTime(e), "iso8601"),
|
|
@@ -3457,8 +3475,8 @@ const zt = {
|
|
|
3457
3475
|
plainDateISO: (e = void 0) => createTemporalDate(systemDateTime(e).o, "iso8601"),
|
|
3458
3476
|
plainTimeISO: (e = void 0) => createTemporalTime(systemDateTime(e).p)
|
|
3459
3477
|
};
|
|
3460
|
-
defineStringTag(
|
|
3461
|
-
const
|
|
3478
|
+
defineStringTag(Ht, "Temporal.Now"), makePropertiesNonEnumerable(Ht);
|
|
3479
|
+
const qt = {
|
|
3462
3480
|
Instant: Wt,
|
|
3463
3481
|
PlainDateTime: Ne,
|
|
3464
3482
|
PlainDate: Tt,
|
|
@@ -3467,7 +3485,7 @@ const Vt = {
|
|
|
3467
3485
|
PlainMonthDay: lt,
|
|
3468
3486
|
Duration: Et,
|
|
3469
3487
|
ZonedDateTime: Me,
|
|
3470
|
-
Now:
|
|
3488
|
+
Now: Ht
|
|
3471
3489
|
};
|
|
3472
|
-
defineStringTag(
|
|
3473
|
-
export { defineNonEnumerableProperty as i,
|
|
3490
|
+
defineStringTag(qt, "Temporal"), makePropertiesNonEnumerable(qt);
|
|
3491
|
+
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-D8HHiqs0.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-D8HHiqs0.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
|
};
|
|
@@ -1245,18 +1245,18 @@ function computeNudgeWindow(e, t, o, n, r, a, i, l, c) {
|
|
|
1245
1245
|
return {
|
|
1246
1246
|
Te: s,
|
|
1247
1247
|
De: d,
|
|
1248
|
-
|
|
1249
|
-
|
|
1248
|
+
he: u,
|
|
1249
|
+
pe: r ? getEpochNanosecondsFor(r, D, g) : getUtcEpochNanoseconds(D),
|
|
1250
1250
|
ge: m,
|
|
1251
1251
|
fe: T
|
|
1252
1252
|
};
|
|
1253
1253
|
}
|
|
1254
1254
|
function nudgeToCalendarUnit(e, t, o, n, r, a, i, l, c, s) {
|
|
1255
1255
|
let d = !1, m = computeNudgeWindow(e, t, o, r, a, 0, l, c, !1);
|
|
1256
|
-
compareEpochNanoseconds(m.
|
|
1257
|
-
const T = differenceEpochNanoseconds(m.
|
|
1258
|
-
let D = m.ge, p = m.
|
|
1259
|
-
return roundNumberToIncrement(m.Te + ((e, t, o) => signTimeDuration(e) ? ye(e, t) ? ye(addTimeDuration(e, e), t) * o / 5 + .5 : 1 : 0)(T, u, e) * l * e, l, s) === m.De && (d = !0, D = m.fe, p = m.
|
|
1256
|
+
compareEpochNanoseconds(m.he, n) * compareEpochNanoseconds(m.pe, n) > 0 && (m = computeNudgeWindow(e, t, o, r, a, 0, l, c, !0), d = !0);
|
|
1257
|
+
const T = differenceEpochNanoseconds(m.he, n), u = differenceEpochNanoseconds(m.he, m.pe);
|
|
1258
|
+
let D = m.ge, p = m.he;
|
|
1259
|
+
return roundNumberToIncrement(m.Te + ((e, t, o) => signTimeDuration(e) ? ye(e, t) ? ye(addTimeDuration(e, e), t) * o / 5 + .5 : 1 : 0)(T, u, e) * l * e, l, s) === m.De && (d = !0, D = m.fe, p = m.pe), {
|
|
1260
1260
|
Ie: {
|
|
1261
1261
|
Oe: combineDateAndTimeDuration(D, createTimeDurationFromSeconds(0)),
|
|
1262
1262
|
Se: p,
|
|
@@ -1416,12 +1416,12 @@ function getTemporalFractionalSecondDigitsOption(e) {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
function toSecondsStringPrecisionRecord(e, t) {
|
|
1418
1418
|
return e ? {
|
|
1419
|
-
|
|
1420
|
-
|
|
1419
|
+
ye: e === q ? D : 3 * (e - 6),
|
|
1420
|
+
ve: e,
|
|
1421
1421
|
Ee: 1
|
|
1422
1422
|
} : {
|
|
1423
|
-
|
|
1424
|
-
|
|
1423
|
+
ye: t,
|
|
1424
|
+
ve: divFloor((t ?? 9) - 1, 3) + 7,
|
|
1425
1425
|
Ee: 10 ** ((9 - (t ?? 9)) % 3)
|
|
1426
1426
|
};
|
|
1427
1427
|
}
|
|
@@ -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
|
}
|
|
@@ -1627,17 +1627,37 @@ function createDateTimeFormat(e, t = createNullPrototypeObject({}), o, n, r = Ob
|
|
|
1627
1627
|
for (const n of t) o[n] = e[n];
|
|
1628
1628
|
return o;
|
|
1629
1629
|
})(Object(t), wt);
|
|
1630
|
-
a.hour12 = mapUnlessUndefined(a.hour12, toBoolean)
|
|
1630
|
+
a.hour12 = mapUnlessUndefined(a.hour12, toBoolean);
|
|
1631
|
+
for (const e of [
|
|
1632
|
+
"hourCycle",
|
|
1633
|
+
"formatMatcher",
|
|
1634
|
+
"era",
|
|
1635
|
+
"year",
|
|
1636
|
+
"month",
|
|
1637
|
+
"day",
|
|
1638
|
+
"weekday"
|
|
1639
|
+
]) mapUnlessUndefined(a[e], toString);
|
|
1640
|
+
void 0 !== n && (void 0 !== a.timeZone && throwTypeError("disallowed field: timeZone"), a.timeZone = n, hasAnyOptions(a, [
|
|
1631
1641
|
...yt,
|
|
1632
1642
|
...Et,
|
|
1633
1643
|
"timeZoneName"
|
|
1634
1644
|
]) || (a.timeZoneName = "short"));
|
|
1635
1645
|
const i = new Ft(e, a), l = i.resolvedOptions(), d = createNullPrototypeObject(l);
|
|
1636
1646
|
for (const e of Object.keys(d)) void 0 === a[e] && (d[e] = void 0);
|
|
1637
|
-
|
|
1647
|
+
for (const e of [
|
|
1648
|
+
"hour12",
|
|
1649
|
+
"hourCycle",
|
|
1650
|
+
"formatMatcher",
|
|
1651
|
+
"era",
|
|
1652
|
+
"year",
|
|
1653
|
+
"month",
|
|
1654
|
+
"day",
|
|
1655
|
+
"weekday"
|
|
1656
|
+
]) d[e] = a[e];
|
|
1657
|
+
return d.timeZone = l.timeZone, d.calendar = l.calendar, (o === c && d.timeStyle || o === s && d.dateStyle) && throwTypeError(ue), vt.set(r, createNullPrototypeObject({
|
|
1638
1658
|
Re: i,
|
|
1639
|
-
|
|
1640
|
-
|
|
1659
|
+
Ze: d,
|
|
1660
|
+
Ne: i.resolvedOptions().locale
|
|
1641
1661
|
})), r;
|
|
1642
1662
|
}
|
|
1643
1663
|
function validateSameTemporalType(e, t) {
|
|
@@ -1656,7 +1676,7 @@ function toDateTimeFormattable(e) {
|
|
|
1656
1676
|
}
|
|
1657
1677
|
function handleDateTimeValue(e, t) {
|
|
1658
1678
|
const o = getInternalSlotForPlainDate(t), n = getInternalSlotForPlainDateTime(t), r = getInternalSlotForPlainYearMonth(t), a = getInternalSlotForPlainMonthDay(t);
|
|
1659
|
-
return isPlainTime(t) ? [e.$e ||= new Ft(e.
|
|
1679
|
+
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
1680
|
}
|
|
1661
1681
|
function DateTimeFormat(e, t) {
|
|
1662
1682
|
return new bt(e, t);
|
|
@@ -1671,7 +1691,7 @@ function toTemporalInstant$1(e) {
|
|
|
1671
1691
|
e = toPrimitive(e);
|
|
1672
1692
|
}
|
|
1673
1693
|
validateString(e);
|
|
1674
|
-
const t = parseIsoDateTime(e, [et]), o = t.
|
|
1694
|
+
const t = parseIsoDateTime(e, [et]), o = t.Z.M ? 0 : parseDateTimeUtcOffset(t.Z.$), n = t.p;
|
|
1675
1695
|
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
1696
|
}
|
|
1677
1697
|
function addInstant(e, t) {
|
|
@@ -1714,7 +1734,10 @@ function clampEpochNanoseconds(e) {
|
|
|
1714
1734
|
return compareEpochNanoseconds(e, ve) > 0 ? ve : compareEpochNanoseconds(e, we) < 0 ? we : e;
|
|
1715
1735
|
}
|
|
1716
1736
|
function systemTimeZoneIdentifier() {
|
|
1717
|
-
return new Ft().resolvedOptions().timeZone;
|
|
1737
|
+
return Ct && Yt + Ct > Date.now() && $t ? $t : (Yt = Date.now(), $t = new Ft().resolvedOptions().timeZone);
|
|
1738
|
+
}
|
|
1739
|
+
function setSystemTimeZoneIdCacheTtl(e) {
|
|
1740
|
+
Ct = e, e || ($t = void 0, Yt = -Infinity);
|
|
1718
1741
|
}
|
|
1719
1742
|
function systemUtcEpochNanoseconds() {
|
|
1720
1743
|
return createEpochNanosecondsFromEpochMilliseconds(Date.now());
|
|
@@ -1759,7 +1782,7 @@ var Pe = class {
|
|
|
1759
1782
|
return getInternalSlotOrThrowForZonedDateTime(this).U;
|
|
1760
1783
|
}
|
|
1761
1784
|
get timeZoneId() {
|
|
1762
|
-
return getInternalSlotOrThrowForZonedDateTime(this).
|
|
1785
|
+
return getInternalSlotOrThrowForZonedDateTime(this).Z;
|
|
1763
1786
|
}
|
|
1764
1787
|
get era() {
|
|
1765
1788
|
return calendarIsoToDateForZonedDateTimeSlot(getInternalSlotOrThrowForZonedDateTime(this)).oe;
|
|
@@ -1817,7 +1840,7 @@ var Pe = class {
|
|
|
1817
1840
|
}
|
|
1818
1841
|
get hoursInDay() {
|
|
1819
1842
|
const e = getInternalSlotOrThrowForZonedDateTime(this), t = getIsoDateTimeForZonedDateTimeSlot(e).o;
|
|
1820
|
-
return timeDurationToSubsecondsNumber(differenceEpochNanoseconds(getStartOfDay(e.
|
|
1843
|
+
return timeDurationToSubsecondsNumber(differenceEpochNanoseconds(getStartOfDay(e.Z, t), getStartOfDay(e.Z, addDaysToIsoDate(t, 1))), -9) / o;
|
|
1821
1844
|
}
|
|
1822
1845
|
get daysInWeek() {
|
|
1823
1846
|
return calendarIsoToDateForZonedDateTimeSlot(getInternalSlotOrThrowForZonedDateTime(this)).ce;
|
|
@@ -1859,11 +1882,11 @@ var Pe = class {
|
|
|
1859
1882
|
Dt.v,
|
|
1860
1883
|
Dt.R
|
|
1861
1884
|
])), 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.
|
|
1885
|
+
return createTemporalZonedDateTime(interpretISODateTimeOffset(d.o, d.p, S, parseDateTimeUtcOffset(a[Dt.R]), o.Z, l, c, !0), o.Z, o.U);
|
|
1863
1886
|
}
|
|
1864
1887
|
withPlainTime(e = void 0) {
|
|
1865
1888
|
const t = getInternalSlotOrThrowForZonedDateTime(this), o = getIsoDateTimeForZonedDateTimeSlot(t);
|
|
1866
|
-
return createTemporalZonedDateTime(void 0 === e ? getStartOfDay(t.
|
|
1889
|
+
return createTemporalZonedDateTime(void 0 === e ? getStartOfDay(t.Z, o.o) : getEpochNanosecondsFor(t.Z, combineIsoDateAndTimeRecord(o.o, toTemporalTime(e)), g), t.Z, t.U);
|
|
1867
1890
|
}
|
|
1868
1891
|
withTimeZone(e) {
|
|
1869
1892
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
@@ -1871,7 +1894,7 @@ var Pe = class {
|
|
|
1871
1894
|
}
|
|
1872
1895
|
withCalendar(e) {
|
|
1873
1896
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
1874
|
-
return createTemporalZonedDateTime(t.Y, t.
|
|
1897
|
+
return createTemporalZonedDateTime(t.Y, t.Z, toTemporalCalendarIdentifier(e));
|
|
1875
1898
|
}
|
|
1876
1899
|
add(e, t = void 0) {
|
|
1877
1900
|
return addDurationToZonedDateTime(1, getInternalSlotOrThrowForZonedDateTime(this), e, t);
|
|
@@ -1890,15 +1913,15 @@ var Pe = class {
|
|
|
1890
1913
|
if (validateTemporalUnitValue(a, s, [L]), validateTemporalRoundingIncrement(n, a === L ? 1 : maximumTemporalDurationRoundingIncrement(a), a === L), a === G && 1 === n) return createTemporalZonedDateTimeFromSlot(t);
|
|
1891
1914
|
const i = getIsoDateTimeForZonedDateTimeSlot(t);
|
|
1892
1915
|
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.
|
|
1916
|
+
const e = getStartOfDay(t.Z, i.o), o = getStartOfDay(t.Z, addDaysToIsoDate(i.o, 1));
|
|
1917
|
+
return createTemporalZonedDateTime(addNanosecondsToEpochSeconds(e, roundNumberToIncrement(timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, t.Y), -9), timeDurationToSubsecondsNumber(differenceEpochNanoseconds(e, o), -9), r)), t.Z, t.U);
|
|
1895
1918
|
}
|
|
1896
1919
|
const l = roundIsoDateTime(i, n, a, r), c = getOffsetNanosecondsForZonedDateTimeSlot(t);
|
|
1897
|
-
return createTemporalZonedDateTime(interpretISODateTimeOffset(l.o, l.p, S, c, t.
|
|
1920
|
+
return createTemporalZonedDateTime(interpretISODateTimeOffset(l.o, l.p, S, c, t.Z, g, I, !0), t.Z, t.U);
|
|
1898
1921
|
}
|
|
1899
1922
|
equals(e) {
|
|
1900
1923
|
const t = getInternalSlotOrThrowForZonedDateTime(this), o = toTemporalZonedDateTime(e);
|
|
1901
|
-
return !compareEpochNanoseconds(t.Y, o.Y) && timeZoneEquals(t.
|
|
1924
|
+
return !compareEpochNanoseconds(t.Y, o.Y) && timeZoneEquals(t.Z, o.Z) && calendarEquals(t.U, o.U);
|
|
1902
1925
|
}
|
|
1903
1926
|
toString(e = void 0) {
|
|
1904
1927
|
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", [
|
|
@@ -1908,11 +1931,11 @@ var Pe = class {
|
|
|
1908
1931
|
], W))(o);
|
|
1909
1932
|
validateTemporalUnitValue(l, s), l === B && throwRangeError(invalidField("smallestUnit"));
|
|
1910
1933
|
const d = toSecondsStringPrecisionRecord(l, r);
|
|
1911
|
-
return temporalZonedDateTimeToString(t, d.
|
|
1934
|
+
return temporalZonedDateTimeToString(t, d.ye, n, c, a, d.Ee, d.ve, i);
|
|
1912
1935
|
}
|
|
1913
1936
|
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.
|
|
1937
|
+
const o = getInternalSlotOrThrowForZonedDateTime(this), n = createDateTimeFormat(e, t, d, o.Z), r = getInternalSlotOrThrowForDateTimeFormat(n);
|
|
1938
|
+
return "iso8601" === o.U || calendarEquals(o.U, r.Ze.calendar) || throwRangeError(De), formatDateTime(n, createTemporalInstant(o.Y));
|
|
1916
1939
|
}
|
|
1917
1940
|
toJSON() {
|
|
1918
1941
|
return temporalZonedDateTimeToString(getInternalSlotOrThrowForZonedDateTime(this), void 0, U, W, Y);
|
|
@@ -1922,7 +1945,7 @@ var Pe = class {
|
|
|
1922
1945
|
}
|
|
1923
1946
|
startOfDay() {
|
|
1924
1947
|
const e = getInternalSlotOrThrowForZonedDateTime(this);
|
|
1925
|
-
return createTemporalZonedDateTime(getStartOfDay(e.
|
|
1948
|
+
return createTemporalZonedDateTime(getStartOfDay(e.Z, getIsoDateTimeForZonedDateTimeSlot(e).o), e.Z, e.U);
|
|
1926
1949
|
}
|
|
1927
1950
|
getTimeZoneTransition(e) {
|
|
1928
1951
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
@@ -1931,8 +1954,8 @@ var Pe = class {
|
|
|
1931
1954
|
if ("UTC" === e || isOffsetTimeZoneIdentifier(e)) return null;
|
|
1932
1955
|
const n = -4e9, r = Math.floor((Date.now() + 31536e7) / 1e3), a = clamp(epochSeconds(addNanosecondsToEpochSeconds(t, o > 0 ? 0 : -1)), n, Infinity);
|
|
1933
1956
|
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.
|
|
1957
|
+
})(t.Z, t.Y, "next" === o ? 1 : -1);
|
|
1958
|
+
return null === n ? null : createTemporalZonedDateTime(n, t.Z, t.U);
|
|
1936
1959
|
}
|
|
1937
1960
|
toInstant() {
|
|
1938
1961
|
return createTemporalInstant(getInternalSlotOrThrowForZonedDateTime(this).Y);
|
|
@@ -2104,7 +2127,7 @@ var Ne = class {
|
|
|
2104
2127
|
const t = getInternalSlotOrThrowForPlainDateTime(this), o = getOptionsObject(e), n = getTemporalShowCalendarNameOption(o), r = getTemporalFractionalSecondDigitsOption(o), a = getRoundingModeOption(o, P), i = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2105
2128
|
validateTemporalUnitValue(i, s), i === B && throwRangeError(invalidField("smallestUnit"));
|
|
2106
2129
|
const l = toSecondsStringPrecisionRecord(i, r);
|
|
2107
|
-
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, l.Ee, l.
|
|
2130
|
+
return isoDateTimeToString(validateIsoDateTime(roundIsoDateTime(t._, l.Ee, l.ve, a)), t.U, l.ye, n);
|
|
2108
2131
|
}
|
|
2109
2132
|
toLocaleString(e = void 0, t = void 0) {
|
|
2110
2133
|
return getInternalSlotOrThrowForPlainDateTime(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -2200,7 +2223,7 @@ var Ue = class {
|
|
|
2200
2223
|
const t = getInternalSlotOrThrowForPlainTime(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, P), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2201
2224
|
validateTemporalUnitValue(a, s), a === B && throwRangeError(invalidField("smallestUnit"));
|
|
2202
2225
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
2203
|
-
return timeRecordToString(roundTime(t, i.Ee, i.
|
|
2226
|
+
return timeRecordToString(roundTime(t, i.Ee, i.ve, r), i.ye);
|
|
2204
2227
|
}
|
|
2205
2228
|
toLocaleString(e = void 0, t = void 0) {
|
|
2206
2229
|
return getInternalSlotOrThrowForPlainTime(this), formatDateTime(createDateTimeFormat(e, t, s), this);
|
|
@@ -2537,7 +2560,7 @@ const Dt = {
|
|
|
2537
2560
|
F: "microsecond",
|
|
2538
2561
|
v: "nanosecond",
|
|
2539
2562
|
R: "offset",
|
|
2540
|
-
|
|
2563
|
+
Z: "timeZone"
|
|
2541
2564
|
}, pt = [
|
|
2542
2565
|
Dt.oe,
|
|
2543
2566
|
Dt.ne,
|
|
@@ -2552,7 +2575,7 @@ const Dt = {
|
|
|
2552
2575
|
Dt.F,
|
|
2553
2576
|
Dt.v,
|
|
2554
2577
|
Dt.R,
|
|
2555
|
-
Dt.
|
|
2578
|
+
Dt.Z
|
|
2556
2579
|
], ht = {
|
|
2557
2580
|
[Dt.oe]: [toString],
|
|
2558
2581
|
[Dt.ne]: [toIntegerWithTruncation],
|
|
@@ -2570,7 +2593,7 @@ const Dt = {
|
|
|
2570
2593
|
const t = toPrimitive(e);
|
|
2571
2594
|
return validateString(t), parseDateTimeUtcOffset(t), t;
|
|
2572
2595
|
}],
|
|
2573
|
-
[Dt.
|
|
2596
|
+
[Dt.Z]: [toTemporalTimeZoneIdentifier]
|
|
2574
2597
|
}, gt = /* @__PURE__ */ new WeakMap(), ft = signTimeDuration;
|
|
2575
2598
|
var It = class {
|
|
2576
2599
|
constructor(e = 0, t = 0, o = 0, n = 0, r = 0, a = 0, i = 0, l = 0, c = 0, s = 0) {
|
|
@@ -2658,7 +2681,7 @@ var It = class {
|
|
|
2658
2681
|
const c = void 0 !== l;
|
|
2659
2682
|
l ??= G;
|
|
2660
2683
|
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.
|
|
2684
|
+
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
2685
|
if (r.be) {
|
|
2663
2686
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2664
2687
|
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 +2694,7 @@ var It = class {
|
|
|
2671
2694
|
const t = getInternalSlotOrThrowForDuration(this);
|
|
2672
2695
|
void 0 === e && throwTypeError(Se);
|
|
2673
2696
|
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.
|
|
2697
|
+
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
2698
|
if (n.be) {
|
|
2676
2699
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2677
2700
|
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);
|
|
@@ -2682,9 +2705,9 @@ var It = class {
|
|
|
2682
2705
|
const t = getInternalSlotOrThrowForDuration(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, P), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0);
|
|
2683
2706
|
validateTemporalUnitValue(a, s), a !== B && a !== q || throwRangeError(disallowedUnit(a));
|
|
2684
2707
|
const i = toSecondsStringPrecisionRecord(a, n);
|
|
2685
|
-
if (i.
|
|
2708
|
+
if (i.ve === G && 1 === i.Ee) return temporalDurationToString(t, i.ye);
|
|
2686
2709
|
const l = toInternalDurationRecord(t);
|
|
2687
|
-
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(l.W, roundTimeDuration(l.p, i.Ee, i.
|
|
2710
|
+
return temporalDurationToString(temporalDurationFromInternal(combineDateAndTimeDuration(l.W, roundTimeDuration(l.p, i.Ee, i.ve, r)), largerOfTwoTemporalUnits(defaultTemporalLargestUnit(t), J)), i.ye);
|
|
2688
2711
|
}
|
|
2689
2712
|
toJSON() {
|
|
2690
2713
|
return temporalDurationToString(getInternalSlotOrThrowForDuration(this));
|
|
@@ -2823,7 +2846,7 @@ var Nt = class {
|
|
|
2823
2846
|
const t = getInternalSlotOrThrowForInstant(this), o = getOptionsObject(e), n = getTemporalFractionalSecondDigitsOption(o), r = getRoundingModeOption(o, P), a = getTemporalUnitValuedOption(o, "smallestUnit", void 0), i = o.timeZone;
|
|
2824
2847
|
validateTemporalUnitValue(a, s), a === B && throwRangeError(invalidField("smallestUnit"));
|
|
2825
2848
|
const l = mapUnlessUndefined(i, toTemporalTimeZoneIdentifier), c = toSecondsStringPrecisionRecord(a, n);
|
|
2826
|
-
return temporalInstantToString(roundTemporalInstant(t.Y, c.Ee, c.
|
|
2849
|
+
return temporalInstantToString(roundTemporalInstant(t.Y, c.Ee, c.ve, r), l, c.ye);
|
|
2827
2850
|
}
|
|
2828
2851
|
toLocaleString(e = void 0, t = void 0) {
|
|
2829
2852
|
return getInternalSlotOrThrowForInstant(this), formatDateTime(createDateTimeFormat(e, t, d), this);
|
|
@@ -2848,7 +2871,8 @@ const Mt = class {
|
|
|
2848
2871
|
Ut.DateTimeFormat.value = DateTimeFormat;
|
|
2849
2872
|
const jt = {};
|
|
2850
2873
|
Object.defineProperties(jt, Ut);
|
|
2851
|
-
|
|
2874
|
+
let $t, Ct = 0, Yt = -Infinity;
|
|
2875
|
+
const At = {
|
|
2852
2876
|
timeZoneId: () => systemTimeZoneIdentifier(),
|
|
2853
2877
|
instant: () => createTemporalInstant(systemUtcEpochNanoseconds()),
|
|
2854
2878
|
plainDateTimeISO: (e = void 0) => createTemporalDateTime(systemDateTime(e), "iso8601"),
|
|
@@ -2856,8 +2880,8 @@ const $t = {
|
|
|
2856
2880
|
plainDateISO: (e = void 0) => createTemporalDate(systemDateTime(e).o, "iso8601"),
|
|
2857
2881
|
plainTimeISO: (e = void 0) => createTemporalTime(systemDateTime(e).p)
|
|
2858
2882
|
};
|
|
2859
|
-
defineStringTag(
|
|
2860
|
-
const
|
|
2883
|
+
defineStringTag(At, "Temporal.Now"), makePropertiesNonEnumerable(At);
|
|
2884
|
+
const Wt = {
|
|
2861
2885
|
Instant: Nt,
|
|
2862
2886
|
PlainDateTime: Ne,
|
|
2863
2887
|
PlainDate: ut,
|
|
@@ -2866,7 +2890,7 @@ const Ct = {
|
|
|
2866
2890
|
PlainMonthDay: st,
|
|
2867
2891
|
Duration: It,
|
|
2868
2892
|
ZonedDateTime: Pe,
|
|
2869
|
-
Now:
|
|
2893
|
+
Now: At
|
|
2870
2894
|
};
|
|
2871
|
-
defineStringTag(
|
|
2872
|
-
export { defineNonEnumerableProperty as i,
|
|
2895
|
+
defineStringTag(Wt, "Temporal"), makePropertiesNonEnumerable(Wt);
|
|
2896
|
+
export { defineNonEnumerableProperty as a, Mt as i, setSystemTimeZoneIdCacheTtl as n, jt as r, Wt as t };
|