temporal-polyfill-lite 0.4.3 → 1.0.1
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 +45 -24
- package/README.md +2 -2
- package/dist/calendars/global.js +1 -1
- package/dist/calendars/index.js +1 -2
- package/dist/calendars/shim.js +1 -1
- package/dist/calendars/{src-BU-7y4gA.js → src-BZzXXJ4p.js} +250 -266
- package/dist/global.js +1 -1
- package/dist/index.js +1 -2
- package/dist/shim.js +1 -1
- package/dist/{src-sQY-gZ2P.js → src-BWXhKwwe.js} +60 -73
- package/package.json +1 -1
package/dist/global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { install as s } from "./shim.js";
|
|
2
|
-
s(!
|
|
2
|
+
s(!1);
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { s as Intl, r as Temporal, a as toTemporalInstant };
|
|
1
|
+
export { r as Intl, t as Temporal, i as toTemporalInstant } from "./src-BWXhKwwe.js";
|
package/dist/shim.js
CHANGED
|
@@ -4,5 +4,5 @@ function install(s) {
|
|
|
4
4
|
function setSystemTimeZoneIdCacheTtl(t) {
|
|
5
5
|
s(t);
|
|
6
6
|
}
|
|
7
|
-
import { a as t, i as a, n as s, r as e, t as l } from "./src-
|
|
7
|
+
import { a as t, i as a, n as s, r as e, t as l } from "./src-BWXhKwwe.js";
|
|
8
8
|
export { install, setSystemTimeZoneIdCacheTtl };
|
|
@@ -191,8 +191,8 @@ function divideTimeDurationToFloatingPoint(e, t) {
|
|
|
191
191
|
function interpretISODateTimeOffset(e, t, o, n, r, a, i, l) {
|
|
192
192
|
if (!t) return getStartOfDay(r, e);
|
|
193
193
|
const c = combineIsoDateAndTimeRecord(e, t);
|
|
194
|
-
if (o === ne || o === te && "ignore"
|
|
195
|
-
if (o === oe || o === te && "use"
|
|
194
|
+
if (o === ne || o === te && "ignore" === i) return getEpochNanosecondsFor(r, c, a);
|
|
195
|
+
if (o === oe || o === te && "use" === i) return validateEpochNanoseconds(getUtcEpochNanoseconds(balanceIsoDateTime(c.o.t, c.o.u, c.o.T, c.p.D, c.p.I, c.p.O, c.p.F, c.p.S, c.p.v - n)));
|
|
196
196
|
((e) => {
|
|
197
197
|
Math.abs(isoDateToEpochDays(e.t, e.u - 1, e.T)) > 1e8 && throwRangeError(R);
|
|
198
198
|
})(e);
|
|
@@ -368,17 +368,17 @@ function bisectOffsetTransition(e, t, o) {
|
|
|
368
368
|
}
|
|
369
369
|
return a;
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
return e < -85e7 ?
|
|
371
|
+
function windowDaysForEpoch(e) {
|
|
372
|
+
return e < -85e7 ? 21 : isWithin(e, -77e7, 96e7) ? 16 : isWithin(e, 129e7, 179e7) ? 27 : 6.5;
|
|
373
373
|
}
|
|
374
|
-
function searchTimeZoneTransition(e, t, o,
|
|
374
|
+
function searchTimeZoneTransition(e, t, o, r) {
|
|
375
375
|
o = clamp(o, -864e10, 864e10);
|
|
376
|
-
for (let
|
|
376
|
+
for (let a = 172800 * r, i = t, l = t + a; (o - l) * r > 0; a = windowDaysForEpoch(i) * n * r, i = l, l = clamp(l + a, -864e10, 864e10)) if (getNamedTimeZoneOffsetNanosecondsForEpochSecond(e, i, !0) !== getNamedTimeZoneOffsetNanosecondsForEpochSecond(e, l, !0)) return createEpochNanosecondsFromEpochSeconds(r > 0 ? bisectOffsetTransition(e, i, l) : bisectOffsetTransition(e, l, i));
|
|
377
377
|
return null;
|
|
378
378
|
}
|
|
379
379
|
function getAvailableNamedTimeZoneIdentifier(e) {
|
|
380
380
|
return ((e) => {
|
|
381
|
-
/^(?![cemw]et|[emh]st|prc|ro[ck]|uct|utc|gmt)
|
|
381
|
+
/^(?![cemw]et|[emh]st|prc|ro[ck]|uct|utc|gmt)...$|systemv|^u.*w$|^c.*-/i.test(e) && throwRangeError(invalidTimeZone(e));
|
|
382
382
|
})(e = asciiLowerCase(e).replace(/[^/]+/g, (e) => /^(?!etc|yap).{1,3}$|\d/.test(e) ? asciiUpperCase(e) : e.replace(/baja|mc|comod|[a-z]+/g, (e) => {
|
|
383
383
|
return /^(su|gb|nz|in|chat)$/.test(e) ? asciiUpperCase(e) : /^(of|au|es)$/.test(e) ? e : (t = e, t.replace(/^[a-z]/, (e) => e.toUpperCase())).replace(/du(?=r)|n(?=or)|i(?=slan)/, asciiUpperCase);
|
|
384
384
|
var t;
|
|
@@ -443,10 +443,8 @@ function getNamedTimeZoneEpochCandidates(e, t) {
|
|
|
443
443
|
return n === r ? [a] : [a, i].sort(compareEpochNanoseconds);
|
|
444
444
|
}
|
|
445
445
|
function getIsoDateTimeFromOffsetNanoseconds(e, t) {
|
|
446
|
-
return ((e)
|
|
447
|
-
|
|
448
|
-
return combineIsoDateAndTimeRecord(epochDaysToIsoDate(t[0]), balanceTime(0, 0, 0, 0, 0, t[1]));
|
|
449
|
-
})(addNanosecondsToEpochSeconds(e, t));
|
|
446
|
+
return combineIsoDateAndTimeRecord(epochDaysToIsoDate((o = addNanosecondsToEpochSeconds(e, t))[0]), balanceTime(0, 0, 0, 0, 0, o[1]));
|
|
447
|
+
var o;
|
|
450
448
|
}
|
|
451
449
|
function combineIsoDateAndTimeRecord(e, t) {
|
|
452
450
|
return {
|
|
@@ -609,26 +607,22 @@ function createTemporalTime(e, t = Object.create($e.prototype)) {
|
|
|
609
607
|
return je.set(t, e), t;
|
|
610
608
|
}
|
|
611
609
|
function toTemporalTimeRecord(e, t = !1) {
|
|
612
|
-
|
|
613
|
-
const n = [
|
|
610
|
+
const o = [
|
|
614
611
|
ht.D,
|
|
615
612
|
ht.S,
|
|
616
613
|
ht.F,
|
|
617
614
|
ht.I,
|
|
618
615
|
ht.v,
|
|
619
616
|
ht.O
|
|
620
|
-
].map((
|
|
621
|
-
|
|
622
|
-
return void 0 !== r ? (o = !0, toIntegerWithTruncation(r)) : t ? void 0 : 0;
|
|
623
|
-
});
|
|
624
|
-
return o || throwTypeError(C), [
|
|
617
|
+
].map((t) => mapUnlessUndefined(e[t], toIntegerWithTruncation));
|
|
618
|
+
return o.some((e) => void 0 !== e) || throwTypeError(C), [
|
|
625
619
|
0,
|
|
626
620
|
3,
|
|
627
621
|
5,
|
|
628
622
|
2,
|
|
629
623
|
1,
|
|
630
624
|
4
|
|
631
|
-
].map((e) =>
|
|
625
|
+
].map((e) => t ? o[e] : o[e] || 0);
|
|
632
626
|
}
|
|
633
627
|
function timeRecordToString(e, t) {
|
|
634
628
|
return formatTimeString(e.D, e.I, e.O, 1e6 * e.F + 1e3 * e.S + e.v, t);
|
|
@@ -637,8 +631,8 @@ function compareTimeRecord(e, t) {
|
|
|
637
631
|
return compare(e.D, t.D) || compare(e.I, t.I) || compare(e.O, t.O) || compare(e.F, t.F) || compare(e.S, t.S) || compare(e.v, t.v);
|
|
638
632
|
}
|
|
639
633
|
function addTime(e, t) {
|
|
640
|
-
const o =
|
|
641
|
-
return
|
|
634
|
+
const o = balanceTime(e.D, e.I, e.O, e.F, e.S, e.v + t[1]);
|
|
635
|
+
return o.X += t[0], o;
|
|
642
636
|
}
|
|
643
637
|
function roundTime(e, n, r, a) {
|
|
644
638
|
const i = nanosecondsForTimeUnit(clamp(r - 1, 3, 8)), l = e.D * o + e.I * t + 1e9 * e.O + 1e6 * e.F + 1e3 * e.S + e.v;
|
|
@@ -1092,9 +1086,7 @@ function isoResolveFields(e, t) {
|
|
|
1092
1086
|
}
|
|
1093
1087
|
function calendarResolveFields(e, t, o = V) {
|
|
1094
1088
|
"iso8601" === e ? isoResolveFields(t, o) : (function(e, t, o = V) {
|
|
1095
|
-
const n = t[ht.ne], r = t[ht.re];
|
|
1096
|
-
let a = t[ht.t];
|
|
1097
|
-
const i = t[ht.P], l = t[ht.u], c = t[ht.T];
|
|
1089
|
+
const n = t[ht.ne], r = t[ht.re], a = t[ht.t], i = t[ht.P], l = t[ht.u], c = t[ht.T];
|
|
1098
1090
|
if (o === B && void 0 !== i && void 0 === l || void 0 !== a || void 0 !== n && void 0 !== r || throwTypeError(missingField("year, era, eraYear")), void 0 === n != (void 0 === r) && throwTypeError(), o !== x && void 0 === c && throwTypeError(missingField("day")), l === i && throwTypeError(missingField("month, monthCode")), void 0 !== r) {
|
|
1099
1091
|
const e = ((e, t, o) => "ce" === canonicalizeEraInCalendar(0, t) ? o : 1 - o)(0, canonicalizeEraInCalendar(0, n), r);
|
|
1100
1092
|
void 0 !== a && a !== e && throwRangeError("mismatch of `year`, `era` and `eraYear`"), t[ht.t] = e;
|
|
@@ -1261,7 +1253,7 @@ function nudgeToCalendarUnit(e, t, o, n, r, a, i, l, c, s) {
|
|
|
1261
1253
|
compareEpochNanoseconds(m.he, n) * compareEpochNanoseconds(m.ge, n) > 0 && (m = computeNudgeWindow(e, t, o, r, a, 0, l, c, !0), d = !0);
|
|
1262
1254
|
const u = differenceEpochNanoseconds(m.he, n), T = differenceEpochNanoseconds(m.he, m.ge);
|
|
1263
1255
|
let D = m.fe, p = m.he;
|
|
1264
|
-
return roundNumberToIncrement(m.De + ((e, t, o) => signTimeDuration(e) ? Pe(e, t) ? Pe(addTimeDuration(e, e), t) * o / 5 + .5 : 1 : 0)(u, T, e) * l * e, l, s) === m.pe && (d = !0, D = m.Ie, p = m.ge), {
|
|
1256
|
+
return roundNumberToIncrement(m.De + ((e, t, o) => signTimeDuration(e) ? Pe(e, t) ? Pe(addTimeDuration(e, e), t) * o / 5 + .5 : 1 : 0)(u, T, e) * l * e, l, s) === m.pe && (d = !0, D = m.Ie, p = m.ge), signTimeDuration(T) || throwRangeError("internal error"), {
|
|
1265
1257
|
Oe: {
|
|
1266
1258
|
Fe: combineDateAndTimeDuration(D, ye),
|
|
1267
1259
|
Se: p,
|
|
@@ -1446,10 +1438,10 @@ function getTemporalRelativeToOption(e) {
|
|
|
1446
1438
|
if (void 0 === t) return createNullPrototypeObject();
|
|
1447
1439
|
let o, n, r, a, i, l = !0, c = te;
|
|
1448
1440
|
if (isObject(t)) {
|
|
1449
|
-
if (isZonedDateTime(t)) return createNullPrototypeObject({
|
|
1450
|
-
if (isPlainDate(t)) return createNullPrototypeObject({
|
|
1441
|
+
if (isZonedDateTime(t)) return createNullPrototypeObject({ Re: getInternalSlotOrThrowForZonedDateTime(t) });
|
|
1442
|
+
if (isPlainDate(t)) return createNullPrototypeObject({ be: getInternalSlotOrThrowForPlainDate(t) });
|
|
1451
1443
|
const e = getInternalSlotForPlainDateTime(t);
|
|
1452
|
-
if (e) return createNullPrototypeObject({
|
|
1444
|
+
if (e) return createNullPrototypeObject({ be: getInternalSlotOrThrowForPlainDate(createTemporalDate(e.K.o, e.U)) });
|
|
1453
1445
|
r = getTemporalCalendarIdentifierWithIsoDefault(t);
|
|
1454
1446
|
const l = prepareCalendarFields(r, t, [
|
|
1455
1447
|
ht.t,
|
|
@@ -1471,7 +1463,7 @@ function getTemporalRelativeToOption(e) {
|
|
|
1471
1463
|
const e = parseIsoDateTime(t, [et, tt]);
|
|
1472
1464
|
n = e.Z.N, e.Z.$ ? (o = toTemporalTimeZoneIdentifier(e.Z.$), c = e.Z.M ? oe : n ? te : ne, 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;
|
|
1473
1465
|
}
|
|
1474
|
-
return createNullPrototypeObject(o ? {
|
|
1466
|
+
return createNullPrototypeObject(o ? { Re: getInternalSlotOrThrowForZonedDateTime(createTemporalZonedDateTime(interpretISODateTimeOffset(a, i, c, c === te ? parseDateTimeUtcOffset(n) : 0, o, G, ee, l), o, r)) } : { be: getInternalSlotOrThrowForPlainDate(createTemporalDate(a, r)) });
|
|
1475
1467
|
}
|
|
1476
1468
|
function largerOfTwoTemporalUnits(e, t) {
|
|
1477
1469
|
return e < t ? e : t;
|
|
@@ -1658,14 +1650,14 @@ function handleDateTimeValue(e, t) {
|
|
|
1658
1650
|
return isPlainTime(t) ? [e.Me ||= new vt(e.Ne, amendOptionsForPlainTime(e.$e)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(createIsoDateRecord(1970, 1, 1), getInternalSlotOrThrowForPlainTime(t))))] : o ? (o.U !== e.$e.calendar && "iso8601" !== o.U && throwRangeError(M), [e.Ue ||= new vt(e.Ne, amendOptionsForPlainDate(e.$e)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(o.o, midnightTimeRecord())))]) : n ? (n.U !== e.$e.calendar && "iso8601" !== n.U && throwRangeError(M), [e.je ||= new vt(e.Ne, amendOptionsForPlainDateTime(e.$e)), epochMilliseconds(getUtcEpochNanoseconds(n.K))]) : r ? (r.U !== e.$e.calendar && throwRangeError(M), [e.Ce ||= new vt(e.Ne, amendOptionsForPlainYearMonth(e.$e)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(r.o, midnightTimeRecord())))]) : a ? (a.U !== e.$e.calendar && throwRangeError(M), [e.Ye ||= new vt(e.Ne, amendOptionsForPlainMonthDay(e.$e)), epochMilliseconds(getUtcEpochNanoseconds(combineIsoDateAndTimeRecord(a.o, midnightTimeRecord())))]) : isInstant(t) ? [e.We ||= new vt(e.Ne, amendOptionsForInstant(e.$e)), epochMilliseconds(getInternalSlotOrThrowForInstant(t).Y)] : (isZonedDateTime(t) && throwTypeError($), [e.Ze, t]);
|
|
1659
1651
|
}
|
|
1660
1652
|
function DateTimeFormat(e, t) {
|
|
1661
|
-
return new
|
|
1653
|
+
return new bt(e, t);
|
|
1662
1654
|
}
|
|
1663
|
-
function createTemporalInstant(e, t = Object.create(
|
|
1664
|
-
return
|
|
1655
|
+
function createTemporalInstant(e, t = Object.create(Mt.prototype)) {
|
|
1656
|
+
return Nt.set(t, { Y: e }), t;
|
|
1665
1657
|
}
|
|
1666
1658
|
function toTemporalInstant$1(e) {
|
|
1667
1659
|
if (isObject(e)) {
|
|
1668
|
-
const o = (t = e,
|
|
1660
|
+
const o = (t = e, Nt.get(t) || getInternalSlotForZonedDateTime(e));
|
|
1669
1661
|
if (o) return createTemporalInstant(o.Y);
|
|
1670
1662
|
e = toPrimitive(e);
|
|
1671
1663
|
}
|
|
@@ -1701,19 +1693,19 @@ function validateEpochNanoseconds(e) {
|
|
|
1701
1693
|
return ((e) => compareEpochNanoseconds(we, e) * compareEpochNanoseconds(ve, e) <= 0)(e) || throwRangeError(R), e;
|
|
1702
1694
|
}
|
|
1703
1695
|
function getInternalSlotOrThrowForInstant(e) {
|
|
1704
|
-
return getInternalSlotOrThrow(
|
|
1696
|
+
return getInternalSlotOrThrow(Nt, e);
|
|
1705
1697
|
}
|
|
1706
1698
|
function isInstant(e) {
|
|
1707
|
-
return
|
|
1699
|
+
return Nt.has(e);
|
|
1708
1700
|
}
|
|
1709
1701
|
function clampEpochNanoseconds(e) {
|
|
1710
1702
|
return compareEpochNanoseconds(e, ve) > 0 ? ve : compareEpochNanoseconds(e, we) < 0 ? we : e;
|
|
1711
1703
|
}
|
|
1712
1704
|
function systemTimeZoneIdentifier() {
|
|
1713
|
-
return
|
|
1705
|
+
return Yt && Wt + Yt > Date.now() && Ct ? Ct : (Wt = Date.now(), Ct = new vt().resolvedOptions().timeZone);
|
|
1714
1706
|
}
|
|
1715
1707
|
function setSystemTimeZoneIdCacheTtl(e) {
|
|
1716
|
-
|
|
1708
|
+
Yt = e, e || (Ct = void 0, Wt = -1 / 0);
|
|
1717
1709
|
}
|
|
1718
1710
|
function systemUtcEpochNanoseconds() {
|
|
1719
1711
|
return createEpochNanosecondsFromEpochMilliseconds(Date.now());
|
|
@@ -1946,9 +1938,8 @@ var be = class {
|
|
|
1946
1938
|
const t = getInternalSlotOrThrowForZonedDateTime(this);
|
|
1947
1939
|
void 0 === e && throwTypeError(W);
|
|
1948
1940
|
const o = getOption("string" == typeof e ? { direction: e } : getOptionsObject(e), "direction", ["next", "previous"], q), n = ((e, t, o) => {
|
|
1949
|
-
if ("UTC" === e || isOffsetTimeZoneIdentifier(e)) return null;
|
|
1950
1941
|
const n = -4e9, r = Math.floor((Date.now() + 31536e7) / 1e3), a = clamp(epochSeconds(addNanosecondsToEpochSeconds(t, o > 0 ? 0 : -1)), n, 1 / 0);
|
|
1951
|
-
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
|
|
1942
|
+
return "UTC" === e || isOffsetTimeZoneIdentifier(e) ? null : -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, Math.max(a + 31536e3, r), o);
|
|
1952
1943
|
})(t.Z, t.Y, "next" === o ? 1 : -1);
|
|
1953
1944
|
return null === n ? null : createTemporalZonedDateTime(n, t.Z, t.U);
|
|
1954
1945
|
}
|
|
@@ -2573,7 +2564,7 @@ var Ft = class {
|
|
|
2573
2564
|
if (!n.some((e, t) => r[t] !== e)) return 0;
|
|
2574
2565
|
const i = defaultTemporalLargestUnit(n), l = defaultTemporalLargestUnit(r), c = toInternalDurationRecord(n), s = toInternalDurationRecord(r);
|
|
2575
2566
|
let d, m;
|
|
2576
|
-
return a.
|
|
2567
|
+
return a.Re && (isDateUnit(i) || isDateUnit(l)) ? compareEpochNanoseconds(addZonedDateTime(a.Re, c, _), addZonedDateTime(a.Re, s, _)) : (isCalendarUnit(i) || isCalendarUnit(l) ? (a.be || throwRangeError(missingField("relativeTo")), d = dateDurationDays(c.A, a.be), m = dateDurationDays(s.A, a.be)) : (d = n[f], m = r[f]), Pe(add24HourDaysToTimeDuration(c.p, d), add24HourDaysToTimeDuration(s.p, m)));
|
|
2577
2568
|
}
|
|
2578
2569
|
get years() {
|
|
2579
2570
|
return getInternalSlotOrThrowForDuration(this)[p];
|
|
@@ -2634,10 +2625,10 @@ var Ft = class {
|
|
|
2634
2625
|
let l = getTemporalUnitValuedOption(o, "smallestUnit");
|
|
2635
2626
|
validateTemporalUnitValue(l, H);
|
|
2636
2627
|
const c = defaultTemporalLargestUnit(t), s = void 0 === l && void 0 === n;
|
|
2637
|
-
if (l ??= D, void 0 !== n && "auto" !== n || (n = largerOfTwoTemporalUnits(c, l)), (s || n > l) && throwRangeError(U), isDateUnit(l) || validateTemporalRoundingIncrement(a, maximumTemporalDurationRoundingIncrement(l), !1), a > 1 && n !== l && isDateUnit(l) && throwRangeError(U), r.
|
|
2638
|
-
if (r.
|
|
2628
|
+
if (l ??= D, void 0 !== n && "auto" !== n || (n = largerOfTwoTemporalUnits(c, l)), (s || n > l) && throwRangeError(U), isDateUnit(l) || validateTemporalRoundingIncrement(a, maximumTemporalDurationRoundingIncrement(l), !1), a > 1 && n !== l && isDateUnit(l) && throwRangeError(U), r.Re) return createTemporalDuration(temporalDurationFromInternal(differenceZonedDateTimeWithRounding(r.Re, createZonedDateTimeSlot(addZonedDateTime(r.Re, toInternalDurationRecord(t), _), r.Re.Z, r.Re.U), n, a, l, i), isDateUnit(n) ? m : n));
|
|
2629
|
+
if (r.be) {
|
|
2639
2630
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2640
|
-
return createTemporalDuration(temporalDurationFromInternal(differencePlainDateTimeWithRounding(combineIsoDateAndTimeRecord(r.
|
|
2631
|
+
return createTemporalDuration(temporalDurationFromInternal(differencePlainDateTimeWithRounding(combineIsoDateAndTimeRecord(r.be.o, midnightTimeRecord()), combineIsoDateAndTimeRecord(calendarDateAdd(r.be.U, r.be.o, adjustDateDurationRecord(e.A, o.X), _), o), r.be.U, n, a, l, i), n));
|
|
2641
2632
|
}
|
|
2642
2633
|
(isCalendarUnit(c) || isCalendarUnit(n)) && throwRangeError(missingField("relativeTo"));
|
|
2643
2634
|
const u = toInternalDurationRecordWith24HourDays(t);
|
|
@@ -2647,10 +2638,10 @@ var Ft = class {
|
|
|
2647
2638
|
const t = getInternalSlotOrThrowForDuration(this);
|
|
2648
2639
|
void 0 === e && throwTypeError(W);
|
|
2649
2640
|
const o = "string" == typeof e ? createNullPrototypeObject({ unit: e }) : getOptionsObject(e), n = getTemporalRelativeToOption(o), r = getTemporalUnitValuedOption(o, "unit", q);
|
|
2650
|
-
if (validateTemporalUnitValue(r, H), n.
|
|
2651
|
-
if (n.
|
|
2641
|
+
if (validateTemporalUnitValue(r, H), n.Re) 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.Re, createZonedDateTimeSlot(addZonedDateTime(n.Re, toInternalDurationRecord(t), _), n.Re.Z, n.Re.U), r);
|
|
2642
|
+
if (n.be) {
|
|
2652
2643
|
const e = toInternalDurationRecordWith24HourDays(t), o = addTime(midnightTimeRecord(), e.p);
|
|
2653
|
-
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.
|
|
2644
|
+
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.A, o.X), _), o), n.be.U, r);
|
|
2654
2645
|
}
|
|
2655
2646
|
return (isCalendarUnit(defaultTemporalLargestUnit(t)) || isCalendarUnit(r)) && throwRangeError(missingField("relativeTo")), totalTimeDuration(toInternalDurationRecordWith24HourDays(t).p, r);
|
|
2656
2647
|
}
|
|
@@ -2708,15 +2699,13 @@ const St = {
|
|
|
2708
2699
|
"timeStyle"
|
|
2709
2700
|
];
|
|
2710
2701
|
var bt = class {
|
|
2711
|
-
ke(e) {
|
|
2712
|
-
return formatDateTime(getInternalSlotOrThrowForDateTimeFormat(this), e);
|
|
2713
|
-
}
|
|
2714
|
-
}, Rt = class {
|
|
2715
2702
|
constructor(e, t) {
|
|
2716
2703
|
yt.set(this, createDateTimeFormat(e, t, H, void 0));
|
|
2717
2704
|
}
|
|
2718
2705
|
get format() {
|
|
2719
|
-
return Object.defineProperty(getInternalSlotOrThrowForDateTimeFormat(this).
|
|
2706
|
+
return Object.defineProperty(getInternalSlotOrThrowForDateTimeFormat(this).ke ||= { ze(e) {
|
|
2707
|
+
return formatDateTime(getInternalSlotOrThrowForDateTimeFormat(this), e);
|
|
2708
|
+
} }.ze.bind(this), "name", { value: "" });
|
|
2720
2709
|
}
|
|
2721
2710
|
formatToParts(e) {
|
|
2722
2711
|
return ((e, t) => {
|
|
@@ -2742,12 +2731,12 @@ var bt = class {
|
|
|
2742
2731
|
return getInternalSlotOrThrowForDateTimeFormat(this).Ze.resolvedOptions();
|
|
2743
2732
|
}
|
|
2744
2733
|
};
|
|
2745
|
-
const
|
|
2746
|
-
|
|
2747
|
-
for (const e of ["formatRange", "formatRangeToParts"]) vt.prototype[e] || delete
|
|
2748
|
-
Object.defineProperties(DateTimeFormat,
|
|
2749
|
-
const
|
|
2750
|
-
var
|
|
2734
|
+
const Rt = Object.getOwnPropertyDescriptors(vt), Zt = bt.prototype;
|
|
2735
|
+
Rt.prototype.value = Zt;
|
|
2736
|
+
for (const e of ["formatRange", "formatRangeToParts"]) vt.prototype[e] || delete Zt[e];
|
|
2737
|
+
Object.defineProperties(DateTimeFormat, Rt), DateTimeFormat.prototype.constructor = DateTimeFormat, defineStringTag(DateTimeFormat.prototype, "Intl.DateTimeFormat");
|
|
2738
|
+
const Nt = /* @__PURE__ */ new WeakMap();
|
|
2739
|
+
var Mt = class {
|
|
2751
2740
|
constructor(e) {
|
|
2752
2741
|
createTemporalInstant(validateEpochNanoseconds(createEpochNanosecondsFromBigInt(toBigInt(e))), this);
|
|
2753
2742
|
}
|
|
@@ -2807,16 +2796,14 @@ var Ut = class {
|
|
|
2807
2796
|
return createTemporalZonedDateTime(getInternalSlotOrThrowForInstant(this).Y, toTemporalTimeZoneIdentifier(e), "iso8601");
|
|
2808
2797
|
}
|
|
2809
2798
|
};
|
|
2810
|
-
defineStringTag(
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
let Yt, Wt = 0, At = -1 / 0;
|
|
2819
|
-
const zt = {
|
|
2799
|
+
defineStringTag(Mt.prototype, "Temporal.Instant"), renameFunction(Mt, "Instant");
|
|
2800
|
+
const Ut = { toTemporalInstant() {
|
|
2801
|
+
const e = Date.prototype.valueOf.call(this);
|
|
2802
|
+
return e != e && throwRangeError("invalid date"), createTemporalInstant(createEpochNanosecondsFromEpochMilliseconds(e));
|
|
2803
|
+
} }.toTemporalInstant, jt = {}, $t = Object.getOwnPropertyDescriptors(globalThis.Intl);
|
|
2804
|
+
$t.DateTimeFormat.value = DateTimeFormat, $t.DurationFormat && ($t.DurationFormat.value = k), Object.defineProperties(jt, $t);
|
|
2805
|
+
let Ct, Yt = 0, Wt = -1 / 0;
|
|
2806
|
+
const At = {
|
|
2820
2807
|
timeZoneId: () => systemTimeZoneIdentifier(),
|
|
2821
2808
|
instant: () => createTemporalInstant(systemUtcEpochNanoseconds()),
|
|
2822
2809
|
plainDateTimeISO: (e = void 0) => createTemporalDateTime(systemDateTime(e), "iso8601"),
|
|
@@ -2824,9 +2811,9 @@ const zt = {
|
|
|
2824
2811
|
plainDateISO: (e = void 0) => createTemporalDate(systemDateTime(e).o, "iso8601"),
|
|
2825
2812
|
plainTimeISO: (e = void 0) => createTemporalTime(systemDateTime(e).p)
|
|
2826
2813
|
};
|
|
2827
|
-
defineStringTag(
|
|
2828
|
-
const
|
|
2829
|
-
Instant:
|
|
2814
|
+
defineStringTag(At, "Temporal.Now"), makePropertiesNonEnumerable(At);
|
|
2815
|
+
const zt = {
|
|
2816
|
+
Instant: Mt,
|
|
2830
2817
|
PlainDateTime: Ue,
|
|
2831
2818
|
PlainDate: pt,
|
|
2832
2819
|
PlainTime: $e,
|
|
@@ -2834,7 +2821,7 @@ const kt = {
|
|
|
2834
2821
|
PlainMonthDay: mt,
|
|
2835
2822
|
Duration: Ft,
|
|
2836
2823
|
ZonedDateTime: be,
|
|
2837
|
-
Now:
|
|
2824
|
+
Now: At
|
|
2838
2825
|
};
|
|
2839
|
-
defineStringTag(
|
|
2840
|
-
export { defineNonEnumerableProperty as a,
|
|
2826
|
+
defineStringTag(zt, "Temporal"), makePropertiesNonEnumerable(zt);
|
|
2827
|
+
export { defineNonEnumerableProperty as a, Ut as i, setSystemTimeZoneIdCacheTtl as n, jt as r, zt as t };
|