temporal-polyfill-lite 1.0.0 → 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 +10 -0
- package/README.md +1 -1
- package/dist/calendars/index.js +1 -1
- package/dist/calendars/shim.js +1 -1
- package/dist/calendars/{src-CLej0F_-.js → src-BZzXXJ4p.js} +33 -37
- package/dist/index.js +1 -1
- package/dist/shim.js +1 -1
- package/dist/{src-DYpWRzuf.js → src-BWXhKwwe.js} +8 -10
- 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
|
+
## 1.0.1 (2026-11-09)
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Improve performance of `Temporal.ZonedDateTime.prototype.getTimeZoneTransition` when the `ZonedDateTime` represents a recent date ([#48](https://github.com/fabon-f/temporal-polyfill-lite/pull/48))
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Reject the `Canada/East-Saskatchewan` time zone ID, which was removed from the IANA Time Zone Database, during `Temporal.ZonedDateTime` construction ([#49](https://github.com/fabon-f/temporal-polyfill-lite/pull/49))
|
|
17
|
+
|
|
8
18
|
## 1.0.0 (2026-10-21)
|
|
9
19
|
|
|
10
20
|
### Changed
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Lightweight Temporal polyfill.
|
|
6
6
|
|
|
7
7
|
- **Small**: The bundle size is nearly 10% smaller than [temporal-polyfill](https://www.npmjs.com/package/temporal-polyfill), 60% smaller than [@js-temporal/polyfill](https://www.npmjs.com/package/@js-temporal/polyfill) if you need only Gregorian calendar (see [comparison](https://github.com/fabon-f/temporal-polyfill-comparison) for details).
|
|
8
|
-
- **Spec-compliant**: It supports the latest spec
|
|
8
|
+
- **Spec-compliant**: It supports the latest spec.
|
|
9
9
|
|
|
10
10
|
# Usage
|
|
11
11
|
|
package/dist/calendars/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as Intl, t as Temporal, i as toTemporalInstant } from "./src-
|
|
1
|
+
export { r as Intl, t as Temporal, i as toTemporalInstant } from "./src-BZzXXJ4p.js";
|
package/dist/calendars/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-BZzXXJ4p.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, c) {
|
|
192
192
|
if (!t) return getStartOfDay(r, e);
|
|
193
193
|
const s = 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, s, a);
|
|
195
|
+
if (o === oe || o === te && "use" === i) return validateEpochNanoseconds(getUtcEpochNanoseconds(balanceIsoDateTime(s.o.t, s.o.u, s.o.T, s.p.D, s.p.I, s.p.O, s.p.F, s.p.S, s.p.$ - n)));
|
|
196
196
|
((e) => {
|
|
197
197
|
Math.abs(isoDateToEpochDays(e.t, e.u - 1, e.T)) > 1e8 && throwRangeError(P);
|
|
198
198
|
})(e);
|
|
@@ -369,17 +369,17 @@ function bisectOffsetTransition(e, t, o) {
|
|
|
369
369
|
}
|
|
370
370
|
return a;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
return e < -85e7 ?
|
|
372
|
+
function windowDaysForEpoch(e) {
|
|
373
|
+
return e < -85e7 ? 21 : isWithin(e, -77e7, 96e7) ? 16 : isWithin(e, 129e7, 179e7) ? 27 : 6.5;
|
|
374
374
|
}
|
|
375
|
-
function searchTimeZoneTransition(e, t, o,
|
|
375
|
+
function searchTimeZoneTransition(e, t, o, r) {
|
|
376
376
|
o = clamp(o, -864e10, 864e10);
|
|
377
|
-
for (let
|
|
377
|
+
for (let a = 172800 * r, i = t, c = t + a; (o - c) * r > 0; a = windowDaysForEpoch(i) * n * r, i = c, c = clamp(c + a, -864e10, 864e10)) if (getNamedTimeZoneOffsetNanosecondsForEpochSecond(e, i, !0) !== getNamedTimeZoneOffsetNanosecondsForEpochSecond(e, c, !0)) return createEpochNanosecondsFromEpochSeconds(r > 0 ? bisectOffsetTransition(e, i, c) : bisectOffsetTransition(e, c, i));
|
|
378
378
|
return null;
|
|
379
379
|
}
|
|
380
380
|
function getAvailableNamedTimeZoneIdentifier(e) {
|
|
381
381
|
return ((e) => {
|
|
382
|
-
/^(?![cemw]et|[emh]st|prc|ro[ck]|uct|utc|gmt)
|
|
382
|
+
/^(?![cemw]et|[emh]st|prc|ro[ck]|uct|utc|gmt)...$|systemv|^u.*w$|^c.*-/i.test(e) && throwRangeError(invalidTimeZone(e));
|
|
383
383
|
})(e = asciiLowerCase(e).replace(/[^/]+/g, (e) => /^(?!etc|yap).{1,3}$|\d/.test(e) ? asciiUpperCase(e) : e.replace(/baja|mc|comod|[a-z]+/g, (e) => {
|
|
384
384
|
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);
|
|
385
385
|
var t;
|
|
@@ -1003,8 +1003,7 @@ function epochDaysToDate$6(e, t) {
|
|
|
1003
1003
|
},
|
|
1004
1004
|
ae: isoDayOfWeek(epochDaysToIsoDate(t)),
|
|
1005
1005
|
get ie() {
|
|
1006
|
-
|
|
1007
|
-
return t - getNewYear(e, o) + 1;
|
|
1006
|
+
return t - getNewYear(e, yearMonthDay(e, t).t) + 1;
|
|
1008
1007
|
},
|
|
1009
1008
|
ce: {
|
|
1010
1009
|
se: void 0,
|
|
@@ -1535,29 +1534,9 @@ function calendarMonthDayFromFields(e, t, o) {
|
|
|
1535
1534
|
return o !== r && "reject" === n ? throwRangeError(b) : r;
|
|
1536
1535
|
}
|
|
1537
1536
|
return "hebrew" === e ? t[1] ? constrainDay(e, 3, 6, o, n) : constrainDay(e, 1, t[0], o, n) : constrainDay(e, isCopticOrEthiopic(e) ? 3 : 2, t[0], o, n);
|
|
1538
|
-
})(e, a, i, o), isChineseDangi(e)
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
}
|
|
1542
|
-
const o = calendarIntegersToEpochDays(1351, e, t);
|
|
1543
|
-
return o <= 1095 ? o : calendarIntegersToEpochDays(1350, e, t);
|
|
1544
|
-
})(a[0], i)) : "islamic-umalqura" === e ? epochDaysToIsoDate(((e, t) => {
|
|
1545
|
-
for (let o = 1392;; o--) if (constrainDay$2(o, e, t) === t) {
|
|
1546
|
-
const n = calendarIntegersToEpochDays$1(o, e, t);
|
|
1547
|
-
if (n <= 1095) return n;
|
|
1548
|
-
}
|
|
1549
|
-
})(a[0], i)) : "hebrew" === e ? epochDaysToIsoDate(((e, t, o) => {
|
|
1550
|
-
if (t) return calendarIntegersToEpochDays$4(5730, 6, o);
|
|
1551
|
-
if ((2 === e || 3 === e) && 30 === o) return calendarIntegersToEpochDays$4(5732, e, o);
|
|
1552
|
-
const n = calendarIntegersToEpochDays$4(5733, e, o);
|
|
1553
|
-
return n <= 1095 ? n : calendarIntegersToEpochDays$4(5732, e, o);
|
|
1554
|
-
})(a[0], a[1], i)) : isChineseDangi(e) ? epochDaysToIsoDate(((e, t, o, n) => {
|
|
1555
|
-
const r = o || 30 === n && (6 === t || 8 === t) || 12 === t ? t + 1 : t;
|
|
1556
|
-
if (11 === t && !o) {
|
|
1557
|
-
const t = calendarIntegersToEpochDays$6(e, 30 === n ? 1969 : 1972, 11, n);
|
|
1558
|
-
return t <= 1095 ? t : calendarIntegersToEpochDays$6(e, 1971, 12, n);
|
|
1559
|
-
}
|
|
1560
|
-
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 ? [
|
|
1537
|
+
})(e, a, i, o), isChineseDangi(e) ? epochDaysToIsoDate(((e, t, o, n, r) => {
|
|
1538
|
+
o && (1 === t || 12 === t || 30 === n && (2 === t || isWithin(t, 8, 11))) && ("reject" === r && throwRangeError(b), o = !1);
|
|
1539
|
+
const a = ((e, t, o, n) => !o && n < 30 ? 30 * t + n > 356 ? 1971 : 1972 : o ? [
|
|
1561
1540
|
1947,
|
|
1562
1541
|
30 === n ? 1955 : 1966,
|
|
1563
1542
|
30 === n ? 1944 : 1963,
|
|
@@ -1568,8 +1547,27 @@ function calendarMonthDayFromFields(e, t, o) {
|
|
|
1568
1547
|
2014,
|
|
1569
1548
|
1984,
|
|
1570
1549
|
2033
|
|
1571
|
-
][t - 2] :
|
|
1572
|
-
|
|
1550
|
+
][t - 2] : [
|
|
1551
|
+
1970,
|
|
1552
|
+
1972,
|
|
1553
|
+
"chinese" === e ? 1966 : 1968,
|
|
1554
|
+
1970,
|
|
1555
|
+
1972,
|
|
1556
|
+
1971,
|
|
1557
|
+
1972,
|
|
1558
|
+
1971,
|
|
1559
|
+
1972,
|
|
1560
|
+
1972,
|
|
1561
|
+
1969,
|
|
1562
|
+
1971
|
|
1563
|
+
][t - 1])(e, t, o, n);
|
|
1564
|
+
return calendarIntegersToEpochDays$6(e, a, o || 1971 === a ? t + 1 : t, n);
|
|
1565
|
+
})(e, a[0], a[1], i, o)) : isCopticOrEthiopic(e) ? epochDaysToIsoDate(((e, t) => 13 === e && 6 === t ? 618 : (30 * (e - 1) + t + 252) % 365 + 731)(a[0], i)) : epochDaysToIsoDate("indian" === e ? ((e, t) => calendarIntegersToEpochDays$3(30 * e + t <= 310 ? 1894 : 1893, e, t))(a[0], i) : "persian" === e ? ((e, t) => calendarIntegersToEpochDays(31 * e + t < 321 ? 1351 : 1350, e, t))(a[0], i) : "islamic-umalqura" === e ? ((e, t) => {
|
|
1566
|
+
for (let o = 1392;; o--) if (constrainDay$2(o, e, t) === t) {
|
|
1567
|
+
const n = calendarIntegersToEpochDays$1(o, e, t);
|
|
1568
|
+
if (n <= 1095) return n;
|
|
1569
|
+
}
|
|
1570
|
+
})(a[0], i) : "hebrew" === e ? ((e, t, o) => t ? calendarIntegersToEpochDays$4(5730, 6, o) : calendarIntegersToEpochDays$4((2 !== e && 3 !== e || 30 !== o) && 30 * e + o < 147 ? 5733 : 5732, e, o))(a[0], a[1], i) : ((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));
|
|
1573
1571
|
})(e, t, o);
|
|
1574
1572
|
}
|
|
1575
1573
|
function formatCalendarAnnotation(e, t) {
|
|
@@ -1633,9 +1631,7 @@ function isoResolveFields(e, t) {
|
|
|
1633
1631
|
}
|
|
1634
1632
|
function calendarResolveFields(e, t, o = z) {
|
|
1635
1633
|
"iso8601" === e ? isoResolveFields(t, o) : (function(e, t, o = z) {
|
|
1636
|
-
const n = t[wt.ne], r = t[wt.re];
|
|
1637
|
-
let a = t[wt.t];
|
|
1638
|
-
const i = t[wt.v], c = t[wt.u], s = t[wt.T];
|
|
1634
|
+
const n = t[wt.ne], r = t[wt.re], a = t[wt.t], i = t[wt.v], c = t[wt.u], s = t[wt.T];
|
|
1639
1635
|
if (o === q && void 0 !== i && void 0 === c || void 0 !== a || calendarSupportsEraForNonIsoCalendars(e) && void 0 !== n && void 0 !== r || throwTypeError(missingField("year, era, eraYear")), calendarSupportsEraForNonIsoCalendars(e) && void 0 === n != (void 0 === r) && throwTypeError(), o !== H && void 0 === s && throwTypeError(missingField("day")), c === i && throwTypeError(missingField("month, monthCode")), calendarSupportsEraForNonIsoCalendars(e) && void 0 !== r) {
|
|
1640
1636
|
const o = ((e, t, o) => {
|
|
1641
1637
|
const n = yt[e].get(canonicalizeEraInCalendar(e, t));
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { r as Intl, t as Temporal, i as toTemporalInstant } from "./src-
|
|
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;
|
|
@@ -1086,9 +1086,7 @@ function isoResolveFields(e, t) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
function calendarResolveFields(e, t, o = V) {
|
|
1088
1088
|
"iso8601" === e ? isoResolveFields(t, o) : (function(e, t, o = V) {
|
|
1089
|
-
const n = t[ht.ne], r = t[ht.re];
|
|
1090
|
-
let a = t[ht.t];
|
|
1091
|
-
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];
|
|
1092
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) {
|
|
1093
1091
|
const e = ((e, t, o) => "ce" === canonicalizeEraInCalendar(0, t) ? o : 1 - o)(0, canonicalizeEraInCalendar(0, n), r);
|
|
1094
1092
|
void 0 !== a && a !== e && throwRangeError("mismatch of `year`, `era` and `eraYear`"), t[ht.t] = e;
|