temporal-polyfill-lite 0.2.2 → 0.3.0

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 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.0 (2026-03-07)
9
+
10
+ ### Added
11
+
12
+ - Add support for non-ISO calendars ([#6](https://github.com/fabon-f/temporal-polyfill-lite/issues/6))
13
+
14
+ ### Changed
15
+
16
+ - **BREAKING**: Make a type definition compatible with TypeScript 6.0, stop importing types to the global namespace when importing `temporal-polyfill-lite/global` ([#17](https://github.com/fabon-f/temporal-polyfill-lite/pull/17))
17
+
18
+ ## 0.2.3 (2026-03-04)
19
+
20
+ ### Fixed
21
+
22
+ - Fix incorrect rounding of durations in edge cases ([#14](https://github.com/fabon-f/temporal-polyfill-lite/pull/14))
23
+
8
24
  ## 0.2.2 (2026-02-09)
9
25
 
10
26
  ### Fixed
package/README.md CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  [![pkg.pr.new](https://pkg.pr.new/badge/fabon-f/temporal-polyfill-lite)](https://pkg.pr.new/~/fabon-f/temporal-polyfill-lite)
4
4
 
5
- Lightweight Temporal polyfill supporting all time zones and basic (`iso8601` and `gregory`) calendars.
5
+ Lightweight Temporal polyfill.
6
+
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, while other polyfills are based on the outdated spec (at least as of February 2026).
6
9
 
7
10
  # Usage
8
11
 
@@ -10,12 +13,16 @@ Lightweight Temporal polyfill supporting all time zones and basic (`iso8601` and
10
13
  npm install temporal-polyfill-lite
11
14
  ```
12
15
 
16
+ For users who need only Gregorian calendar (`iso8601` and `gregory`), you can use a smaller "basic" bundle:
17
+
13
18
  ```typescript
14
19
  // as a ponyfill (without patching global variables)
15
20
  import { Intl, Temporal } from "temporal-polyfill-lite";
16
21
 
17
- // loading the polyfill to global
22
+ // load the polyfill to global
18
23
  import "temporal-polyfill-lite/global";
24
+ // load types to global if you need (optional)
25
+ import "temporal-polyfill-lite/types/global";
19
26
 
20
27
  // or you can manually install the polyfill
21
28
  import { install } from "temporal-polyfill-lite/shim";
@@ -25,6 +32,14 @@ install(true);
25
32
  install(false);
26
33
  ```
27
34
 
35
+ If you need other calendars (such as `hebrew`, `chinese`, or `indian`), you have to load a "full" bundle from `temporal-polyfill-lite/calendars-full` module instead of `temporal-polyfill-lite`.
36
+
37
+ ```typescript
38
+ import { Intl, Temporal } from "temporal-polyfill-lite/calendars-full";
39
+ import "temporal-polyfill-lite/calendars-full/global";
40
+ import { install } from "temporal-polyfill-lite/calendars-full/shim";
41
+ ```
42
+
28
43
  ## Browser support
29
44
 
30
45
  The polyfill works in browsers after September 2020 by default (e.g. Safari 14).
@@ -33,4 +48,4 @@ This polyfill doesn't internally rely on `bigint`, thus you can support older br
33
48
 
34
49
  ## Spec compliance
35
50
 
36
- It supports the latest spec (January 2026) with few intentional deviations (see `/expectedFailures` directory for details).
51
+ It supports the latest spec with few intentional deviations (see `/expectedFailures` directory for details).
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { install as s } from "./shim.js";
2
+ s(!0);
@@ -0,0 +1,612 @@
1
+ // original:
2
+ // - https://github.com/microsoft/TypeScript/blob/c9e7428bb76f0543a3555d0af87777e7db3a41e6/src/lib/esnext.temporal.d.ts
3
+ // - https://github.com/microsoft/TypeScript/blob/c9e7428bb76f0543a3555d0af87777e7db3a41e6/src/lib/esnext.intl.d.ts
4
+ /*! Copyright (c) Microsoft Corporation */
5
+ /*! SPDX-License-Identifier: Apache-2.0 */
6
+
7
+ export namespace Temporal {
8
+ type CalendarLike =
9
+ | PlainDate
10
+ | PlainDateTime
11
+ | PlainMonthDay
12
+ | PlainYearMonth
13
+ | ZonedDateTime
14
+ | string;
15
+ type DurationLike = Duration | DurationLikeObject | string;
16
+ type InstantLike = Instant | ZonedDateTime | string;
17
+ type PlainDateLike = PlainDate | ZonedDateTime | PlainDateTime | DateLikeObject | string;
18
+ type PlainDateTimeLike = PlainDateTime | ZonedDateTime | PlainDate | DateTimeLikeObject | string;
19
+ type PlainMonthDayLike = PlainMonthDay | DateLikeObject | string;
20
+ type PlainTimeLike = PlainTime | PlainDateTime | ZonedDateTime | TimeLikeObject | string;
21
+ type PlainYearMonthLike = PlainYearMonth | YearMonthLikeObject | string;
22
+ type TimeZoneLike = ZonedDateTime | string;
23
+ type ZonedDateTimeLike = ZonedDateTime | ZonedDateTimeLikeObject | string;
24
+
25
+ type PartialTemporalLike<T extends object> = {
26
+ [P in Exclude<keyof T, "calendar" | "timeZone">]?: T[P] | undefined;
27
+ };
28
+
29
+ interface DateLikeObject {
30
+ year?: number | undefined;
31
+ era?: string | undefined;
32
+ eraYear?: number | undefined;
33
+ month?: number | undefined;
34
+ monthCode?: string | undefined;
35
+ day: number;
36
+ calendar?: string | undefined;
37
+ }
38
+
39
+ interface DateTimeLikeObject extends DateLikeObject, TimeLikeObject {}
40
+
41
+ interface DurationLikeObject {
42
+ years?: number | undefined;
43
+ months?: number | undefined;
44
+ weeks?: number | undefined;
45
+ days?: number | undefined;
46
+ hours?: number | undefined;
47
+ minutes?: number | undefined;
48
+ seconds?: number | undefined;
49
+ milliseconds?: number | undefined;
50
+ microseconds?: number | undefined;
51
+ nanoseconds?: number | undefined;
52
+ }
53
+
54
+ interface TimeLikeObject {
55
+ hour?: number | undefined;
56
+ minute?: number | undefined;
57
+ second?: number | undefined;
58
+ millisecond?: number | undefined;
59
+ microsecond?: number | undefined;
60
+ nanosecond?: number | undefined;
61
+ }
62
+
63
+ interface YearMonthLikeObject extends Omit<DateLikeObject, "day"> {}
64
+
65
+ interface ZonedDateTimeLikeObject extends DateTimeLikeObject {
66
+ timeZone: TimeZoneLike;
67
+ offset?: string | undefined;
68
+ }
69
+
70
+ type DateUnit = "year" | "month" | "week" | "day";
71
+ type TimeUnit = "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond";
72
+ type PluralizeUnit<T extends DateUnit | TimeUnit> =
73
+ | T
74
+ | {
75
+ year: "years";
76
+ month: "months";
77
+ week: "weeks";
78
+ day: "days";
79
+ hour: "hours";
80
+ minute: "minutes";
81
+ second: "seconds";
82
+ millisecond: "milliseconds";
83
+ microsecond: "microseconds";
84
+ nanosecond: "nanoseconds";
85
+ }[T];
86
+
87
+ interface DisambiguationOptions {
88
+ disambiguation?: "compatible" | "earlier" | "later" | "reject" | undefined;
89
+ }
90
+
91
+ interface OverflowOptions {
92
+ overflow?: "constrain" | "reject" | undefined;
93
+ }
94
+
95
+ interface TransitionOptions {
96
+ direction: "next" | "previous";
97
+ }
98
+
99
+ interface RoundingOptions<Units extends DateUnit | TimeUnit> {
100
+ smallestUnit?: PluralizeUnit<Units> | undefined;
101
+ roundingIncrement?: number | undefined;
102
+ roundingMode?:
103
+ | "ceil"
104
+ | "floor"
105
+ | "expand"
106
+ | "trunc"
107
+ | "halfCeil"
108
+ | "halfFloor"
109
+ | "halfExpand"
110
+ | "halfTrunc"
111
+ | "halfEven"
112
+ | undefined;
113
+ }
114
+
115
+ interface RoundingOptionsWithLargestUnit<
116
+ Units extends DateUnit | TimeUnit,
117
+ > extends RoundingOptions<Units> {
118
+ largestUnit?: "auto" | PluralizeUnit<Units> | undefined;
119
+ }
120
+
121
+ interface ToStringRoundingOptions<Units extends DateUnit | TimeUnit> extends Pick<
122
+ RoundingOptions<Units>,
123
+ "smallestUnit" | "roundingMode"
124
+ > {}
125
+
126
+ interface ToStringRoundingOptionsWithFractionalSeconds<
127
+ Units extends DateUnit | TimeUnit,
128
+ > extends ToStringRoundingOptions<Units> {
129
+ fractionalSecondDigits?: "auto" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
130
+ }
131
+
132
+ namespace Now {
133
+ function timeZoneId(): string;
134
+ function instant(): Instant;
135
+ function plainDateTimeISO(timeZone?: TimeZoneLike): PlainDateTime;
136
+ function zonedDateTimeISO(timeZone?: TimeZoneLike): ZonedDateTime;
137
+ function plainDateISO(timeZone?: TimeZoneLike): PlainDate;
138
+ function plainTimeISO(timeZone?: TimeZoneLike): PlainTime;
139
+ }
140
+
141
+ interface PlainDateToStringOptions {
142
+ calendarName?: "auto" | "always" | "never" | "critical" | undefined;
143
+ }
144
+
145
+ interface PlainDateToZonedDateTimeOptions {
146
+ plainTime?: PlainTimeLike | undefined;
147
+ timeZone: TimeZoneLike;
148
+ }
149
+
150
+ interface PlainDate {
151
+ readonly calendarId: string;
152
+ readonly era: string | undefined;
153
+ readonly eraYear: number | undefined;
154
+ readonly year: number;
155
+ readonly month: number;
156
+ readonly monthCode: string;
157
+ readonly day: number;
158
+ readonly dayOfWeek: number;
159
+ readonly dayOfYear: number;
160
+ readonly weekOfYear: number | undefined;
161
+ readonly yearOfWeek: number | undefined;
162
+ readonly daysInWeek: number;
163
+ readonly daysInMonth: number;
164
+ readonly daysInYear: number;
165
+ readonly monthsInYear: number;
166
+ readonly inLeapYear: boolean;
167
+ toPlainYearMonth(): PlainYearMonth;
168
+ toPlainMonthDay(): PlainMonthDay;
169
+ add(duration: DurationLike, options?: OverflowOptions): PlainDate;
170
+ subtract(duration: DurationLike, options?: OverflowOptions): PlainDate;
171
+ with(dateLike: PartialTemporalLike<DateLikeObject>, options?: OverflowOptions): PlainDate;
172
+ withCalendar(calendarLike: CalendarLike): PlainDate;
173
+ until(other: PlainDateLike, options?: RoundingOptionsWithLargestUnit<DateUnit>): Duration;
174
+ since(other: PlainDateLike, options?: RoundingOptionsWithLargestUnit<DateUnit>): Duration;
175
+ equals(other: PlainDateLike): boolean;
176
+ toPlainDateTime(time?: PlainTimeLike): PlainDateTime;
177
+ toZonedDateTime(timeZone: TimeZoneLike): ZonedDateTime;
178
+ toZonedDateTime(item: PlainDateToZonedDateTimeOptions): ZonedDateTime;
179
+ toString(options?: PlainDateToStringOptions): string;
180
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
181
+ toJSON(): string;
182
+ valueOf(): never;
183
+ readonly [Symbol.toStringTag]: "Temporal.PlainDate";
184
+ }
185
+
186
+ interface PlainDateConstructor {
187
+ new (isoYear: number, isoMonth: number, isoDay: number, calendar?: string): PlainDate;
188
+ readonly prototype: PlainDate;
189
+ from(item: PlainDateLike, options?: OverflowOptions): PlainDate;
190
+ compare(one: PlainDateLike, two: PlainDateLike): number;
191
+ }
192
+ var PlainDate: PlainDateConstructor;
193
+
194
+ interface PlainTimeToStringOptions extends ToStringRoundingOptionsWithFractionalSeconds<
195
+ Exclude<TimeUnit, "hour">
196
+ > {}
197
+
198
+ interface PlainTime {
199
+ readonly hour: number;
200
+ readonly minute: number;
201
+ readonly second: number;
202
+ readonly millisecond: number;
203
+ readonly microsecond: number;
204
+ readonly nanosecond: number;
205
+ add(duration: DurationLike): PlainTime;
206
+ subtract(duration: DurationLike): PlainTime;
207
+ with(timeLike: PartialTemporalLike<TimeLikeObject>, options?: OverflowOptions): PlainTime;
208
+ until(other: PlainTimeLike, options?: RoundingOptionsWithLargestUnit<TimeUnit>): Duration;
209
+ since(other: PlainTimeLike, options?: RoundingOptionsWithLargestUnit<TimeUnit>): Duration;
210
+ equals(other: PlainTimeLike): boolean;
211
+ round(roundTo: PluralizeUnit<TimeUnit>): PlainTime;
212
+ round(roundTo: RoundingOptions<TimeUnit>): PlainTime;
213
+ toString(options?: PlainTimeToStringOptions): string;
214
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
215
+ toJSON(): string;
216
+ valueOf(): never;
217
+ readonly [Symbol.toStringTag]: "Temporal.PlainTime";
218
+ }
219
+
220
+ interface PlainTimeConstructor {
221
+ new (
222
+ hour?: number,
223
+ minute?: number,
224
+ second?: number,
225
+ millisecond?: number,
226
+ microsecond?: number,
227
+ nanosecond?: number,
228
+ ): PlainTime;
229
+ readonly prototype: PlainTime;
230
+ from(item: PlainTimeLike, options?: OverflowOptions): PlainTime;
231
+ compare(one: PlainTimeLike, two: PlainTimeLike): number;
232
+ }
233
+ var PlainTime: PlainTimeConstructor;
234
+
235
+ interface PlainDateTimeToStringOptions
236
+ extends PlainDateToStringOptions, PlainTimeToStringOptions {}
237
+
238
+ interface PlainDateTime {
239
+ readonly calendarId: string;
240
+ readonly era: string | undefined;
241
+ readonly eraYear: number | undefined;
242
+ readonly year: number;
243
+ readonly month: number;
244
+ readonly monthCode: string;
245
+ readonly day: number;
246
+ readonly hour: number;
247
+ readonly minute: number;
248
+ readonly second: number;
249
+ readonly millisecond: number;
250
+ readonly microsecond: number;
251
+ readonly nanosecond: number;
252
+ readonly dayOfWeek: number;
253
+ readonly dayOfYear: number;
254
+ readonly weekOfYear: number | undefined;
255
+ readonly yearOfWeek: number | undefined;
256
+ readonly daysInWeek: number;
257
+ readonly daysInMonth: number;
258
+ readonly daysInYear: number;
259
+ readonly monthsInYear: number;
260
+ readonly inLeapYear: boolean;
261
+ with(
262
+ dateTimeLike: PartialTemporalLike<DateTimeLikeObject>,
263
+ options?: OverflowOptions,
264
+ ): PlainDateTime;
265
+ withPlainTime(plainTime?: PlainTimeLike): PlainDateTime;
266
+ withCalendar(calendar: CalendarLike): PlainDateTime;
267
+ add(duration: DurationLike, options?: OverflowOptions): PlainDateTime;
268
+ subtract(duration: DurationLike, options?: OverflowOptions): PlainDateTime;
269
+ until(
270
+ other: PlainDateTimeLike,
271
+ options?: RoundingOptionsWithLargestUnit<DateUnit | TimeUnit>,
272
+ ): Duration;
273
+ since(
274
+ other: PlainDateTimeLike,
275
+ options?: RoundingOptionsWithLargestUnit<DateUnit | TimeUnit>,
276
+ ): Duration;
277
+ round(roundTo: PluralizeUnit<"day" | TimeUnit>): PlainDateTime;
278
+ round(roundTo: RoundingOptions<"day" | TimeUnit>): PlainDateTime;
279
+ equals(other: PlainDateTimeLike): boolean;
280
+ toString(options?: PlainDateTimeToStringOptions): string;
281
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
282
+ toJSON(): string;
283
+ valueOf(): never;
284
+ toZonedDateTime(timeZone: TimeZoneLike, options?: DisambiguationOptions): ZonedDateTime;
285
+ toPlainDate(): PlainDate;
286
+ toPlainTime(): PlainTime;
287
+ readonly [Symbol.toStringTag]: "Temporal.PlainDateTime";
288
+ }
289
+
290
+ interface PlainDateTimeConstructor {
291
+ new (
292
+ isoYear: number,
293
+ isoMonth: number,
294
+ isoDay: number,
295
+ hour?: number,
296
+ minute?: number,
297
+ second?: number,
298
+ millisecond?: number,
299
+ microsecond?: number,
300
+ nanosecond?: number,
301
+ calendar?: string,
302
+ ): PlainDateTime;
303
+ readonly prototype: PlainDateTime;
304
+ from(item: PlainDateTimeLike, options?: OverflowOptions): PlainDateTime;
305
+ compare(one: PlainDateTimeLike, two: PlainDateTimeLike): number;
306
+ }
307
+ var PlainDateTime: PlainDateTimeConstructor;
308
+
309
+ interface ZonedDateTimeToStringOptions extends PlainDateTimeToStringOptions {
310
+ offset?: "auto" | "never" | undefined;
311
+ timeZoneName?: "auto" | "never" | "critical" | undefined;
312
+ }
313
+
314
+ interface ZonedDateTimeFromOptions extends OverflowOptions, DisambiguationOptions {
315
+ offset?: "use" | "ignore" | "prefer" | "reject" | undefined;
316
+ }
317
+
318
+ interface ZonedDateTime {
319
+ readonly calendarId: string;
320
+ readonly timeZoneId: string;
321
+ readonly era: string | undefined;
322
+ readonly eraYear: number | undefined;
323
+ readonly year: number;
324
+ readonly month: number;
325
+ readonly monthCode: string;
326
+ readonly day: number;
327
+ readonly hour: number;
328
+ readonly minute: number;
329
+ readonly second: number;
330
+ readonly millisecond: number;
331
+ readonly microsecond: number;
332
+ readonly nanosecond: number;
333
+ readonly epochMilliseconds: number;
334
+ readonly epochNanoseconds: bigint;
335
+ readonly dayOfWeek: number;
336
+ readonly dayOfYear: number;
337
+ readonly weekOfYear: number | undefined;
338
+ readonly yearOfWeek: number | undefined;
339
+ readonly hoursInDay: number;
340
+ readonly daysInWeek: number;
341
+ readonly daysInMonth: number;
342
+ readonly daysInYear: number;
343
+ readonly monthsInYear: number;
344
+ readonly inLeapYear: boolean;
345
+ readonly offsetNanoseconds: number;
346
+ readonly offset: string;
347
+ with(
348
+ zonedDateTimeLike: PartialTemporalLike<ZonedDateTimeLikeObject>,
349
+ options?: ZonedDateTimeFromOptions,
350
+ ): ZonedDateTime;
351
+ withPlainTime(plainTime?: PlainTimeLike): ZonedDateTime;
352
+ withTimeZone(timeZone: TimeZoneLike): ZonedDateTime;
353
+ withCalendar(calendar: CalendarLike): ZonedDateTime;
354
+ add(duration: DurationLike, options?: OverflowOptions): ZonedDateTime;
355
+ subtract(duration: DurationLike, options?: OverflowOptions): ZonedDateTime;
356
+ until(
357
+ other: ZonedDateTimeLike,
358
+ options?: RoundingOptionsWithLargestUnit<DateUnit | TimeUnit>,
359
+ ): Duration;
360
+ since(
361
+ other: ZonedDateTimeLike,
362
+ options?: RoundingOptionsWithLargestUnit<DateUnit | TimeUnit>,
363
+ ): Duration;
364
+ round(roundTo: PluralizeUnit<"day" | TimeUnit>): ZonedDateTime;
365
+ round(roundTo: RoundingOptions<"day" | TimeUnit>): ZonedDateTime;
366
+ equals(other: ZonedDateTimeLike): boolean;
367
+ toString(options?: ZonedDateTimeToStringOptions): string;
368
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
369
+ toJSON(): string;
370
+ valueOf(): never;
371
+ startOfDay(): ZonedDateTime;
372
+ getTimeZoneTransition(direction: "next" | "previous"): ZonedDateTime | null;
373
+ getTimeZoneTransition(direction: TransitionOptions): ZonedDateTime | null;
374
+ toInstant(): Instant;
375
+ toPlainDate(): PlainDate;
376
+ toPlainTime(): PlainTime;
377
+ toPlainDateTime(): PlainDateTime;
378
+ readonly [Symbol.toStringTag]: "Temporal.ZonedDateTime";
379
+ }
380
+
381
+ interface ZonedDateTimeConstructor {
382
+ new (epochNanoseconds: bigint, timeZone: string, calendar?: string): ZonedDateTime;
383
+ readonly prototype: ZonedDateTime;
384
+ from(item: ZonedDateTimeLike, options?: ZonedDateTimeFromOptions): ZonedDateTime;
385
+ compare(one: ZonedDateTimeLike, two: ZonedDateTimeLike): number;
386
+ }
387
+ var ZonedDateTime: ZonedDateTimeConstructor;
388
+
389
+ interface DurationRelativeToOptions {
390
+ relativeTo?: ZonedDateTimeLike | PlainDateLike | undefined;
391
+ }
392
+
393
+ interface DurationRoundingOptions
394
+ extends DurationRelativeToOptions, RoundingOptionsWithLargestUnit<DateUnit | TimeUnit> {}
395
+
396
+ interface DurationToStringOptions extends ToStringRoundingOptionsWithFractionalSeconds<
397
+ Exclude<TimeUnit, "hour" | "minute">
398
+ > {}
399
+
400
+ interface DurationTotalOptions extends DurationRelativeToOptions {
401
+ unit: PluralizeUnit<DateUnit | TimeUnit>;
402
+ }
403
+
404
+ interface Duration {
405
+ readonly years: number;
406
+ readonly months: number;
407
+ readonly weeks: number;
408
+ readonly days: number;
409
+ readonly hours: number;
410
+ readonly minutes: number;
411
+ readonly seconds: number;
412
+ readonly milliseconds: number;
413
+ readonly microseconds: number;
414
+ readonly nanoseconds: number;
415
+ readonly sign: number;
416
+ readonly blank: boolean;
417
+ with(durationLike: PartialTemporalLike<DurationLikeObject>): Duration;
418
+ negated(): Duration;
419
+ abs(): Duration;
420
+ add(other: DurationLike): Duration;
421
+ subtract(other: DurationLike): Duration;
422
+ round(roundTo: PluralizeUnit<"day" | TimeUnit>): Duration;
423
+ round(roundTo: DurationRoundingOptions): Duration;
424
+ total(totalOf: PluralizeUnit<"day" | TimeUnit>): number;
425
+ total(totalOf: DurationTotalOptions): number;
426
+ toString(options?: DurationToStringOptions): string;
427
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DurationFormatOptions): string;
428
+ toJSON(): string;
429
+ valueOf(): never;
430
+ readonly [Symbol.toStringTag]: "Temporal.Duration";
431
+ }
432
+
433
+ interface DurationConstructor {
434
+ new (
435
+ years?: number,
436
+ months?: number,
437
+ weeks?: number,
438
+ days?: number,
439
+ hours?: number,
440
+ minutes?: number,
441
+ seconds?: number,
442
+ milliseconds?: number,
443
+ microseconds?: number,
444
+ nanoseconds?: number,
445
+ ): Duration;
446
+ readonly prototype: Duration;
447
+ from(item: DurationLike): Duration;
448
+ compare(one: DurationLike, two: DurationLike, options?: DurationRelativeToOptions): number;
449
+ }
450
+ var Duration: DurationConstructor;
451
+
452
+ interface InstantToStringOptions extends PlainTimeToStringOptions {
453
+ timeZone?: TimeZoneLike | undefined;
454
+ }
455
+
456
+ interface Instant {
457
+ readonly epochMilliseconds: number;
458
+ readonly epochNanoseconds: bigint;
459
+ add(duration: DurationLike): Instant;
460
+ subtract(duration: DurationLike): Instant;
461
+ until(other: InstantLike, options?: RoundingOptionsWithLargestUnit<TimeUnit>): Duration;
462
+ since(other: InstantLike, options?: RoundingOptionsWithLargestUnit<TimeUnit>): Duration;
463
+ round(roundTo: PluralizeUnit<TimeUnit>): Instant;
464
+ round(roundTo: RoundingOptions<TimeUnit>): Instant;
465
+ equals(other: InstantLike): boolean;
466
+ toString(options?: InstantToStringOptions): string;
467
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
468
+ toJSON(): string;
469
+ valueOf(): never;
470
+ toZonedDateTimeISO(timeZone: TimeZoneLike): ZonedDateTime;
471
+ readonly [Symbol.toStringTag]: "Temporal.Instant";
472
+ }
473
+
474
+ interface InstantConstructor {
475
+ new (epochNanoseconds: bigint): Instant;
476
+ readonly prototype: Instant;
477
+ from(item: InstantLike): Instant;
478
+ fromEpochMilliseconds(epochMilliseconds: number): Instant;
479
+ fromEpochNanoseconds(epochNanoseconds: bigint): Instant;
480
+ compare(one: InstantLike, two: InstantLike): number;
481
+ }
482
+ var Instant: InstantConstructor;
483
+
484
+ interface PlainYearMonthToPlainDateOptions {
485
+ day: number;
486
+ }
487
+
488
+ interface PlainYearMonth {
489
+ readonly calendarId: string;
490
+ readonly era: string | undefined;
491
+ readonly eraYear: number | undefined;
492
+ readonly year: number;
493
+ readonly month: number;
494
+ readonly monthCode: string;
495
+ readonly daysInYear: number;
496
+ readonly daysInMonth: number;
497
+ readonly monthsInYear: number;
498
+ readonly inLeapYear: boolean;
499
+ with(
500
+ yearMonthLike: PartialTemporalLike<YearMonthLikeObject>,
501
+ options?: OverflowOptions,
502
+ ): PlainYearMonth;
503
+ add(duration: DurationLike, options?: OverflowOptions): PlainYearMonth;
504
+ subtract(duration: DurationLike, options?: OverflowOptions): PlainYearMonth;
505
+ until(
506
+ other: PlainYearMonthLike,
507
+ options?: RoundingOptionsWithLargestUnit<"year" | "month">,
508
+ ): Duration;
509
+ since(
510
+ other: PlainYearMonthLike,
511
+ options?: RoundingOptionsWithLargestUnit<"year" | "month">,
512
+ ): Duration;
513
+ equals(other: PlainYearMonthLike): boolean;
514
+ toString(options?: PlainDateToStringOptions): string;
515
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
516
+ toJSON(): string;
517
+ valueOf(): never;
518
+ toPlainDate(item: PlainYearMonthToPlainDateOptions): PlainDate;
519
+ readonly [Symbol.toStringTag]: "Temporal.PlainYearMonth";
520
+ }
521
+
522
+ interface PlainYearMonthConstructor {
523
+ new (
524
+ isoYear: number,
525
+ isoMonth: number,
526
+ calendar?: string,
527
+ referenceISODay?: number,
528
+ ): PlainYearMonth;
529
+ readonly prototype: PlainYearMonth;
530
+ from(item: PlainYearMonthLike, options?: OverflowOptions): PlainYearMonth;
531
+ compare(one: PlainYearMonthLike, two: PlainYearMonthLike): number;
532
+ }
533
+ var PlainYearMonth: PlainYearMonthConstructor;
534
+
535
+ interface PlainMonthDayToPlainDateOptions {
536
+ era?: string | undefined;
537
+ eraYear?: number | undefined;
538
+ year?: number | undefined;
539
+ }
540
+
541
+ interface PlainMonthDay {
542
+ readonly calendarId: string;
543
+ readonly monthCode: string;
544
+ readonly day: number;
545
+ with(
546
+ monthDayLike: PartialTemporalLike<DateLikeObject>,
547
+ options?: OverflowOptions,
548
+ ): PlainMonthDay;
549
+ equals(other: PlainMonthDayLike): boolean;
550
+ toString(options?: PlainDateToStringOptions): string;
551
+ toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string;
552
+ toJSON(): string;
553
+ valueOf(): never;
554
+ toPlainDate(item: PlainMonthDayToPlainDateOptions): PlainDate;
555
+ readonly [Symbol.toStringTag]: "Temporal.PlainMonthDay";
556
+ }
557
+
558
+ interface PlainMonthDayConstructor {
559
+ new (
560
+ isoMonth: number,
561
+ isoDay: number,
562
+ calendar?: string,
563
+ referenceISOYear?: number,
564
+ ): PlainMonthDay;
565
+ readonly prototype: PlainMonthDay;
566
+ from(item: PlainMonthDayLike, options?: OverflowOptions): PlainMonthDay;
567
+ }
568
+ var PlainMonthDay: PlainMonthDayConstructor;
569
+ }
570
+
571
+ export namespace Intl {
572
+ type FormattableTemporalObject =
573
+ | Temporal.PlainDate
574
+ | Temporal.PlainYearMonth
575
+ | Temporal.PlainMonthDay
576
+ | Temporal.PlainTime
577
+ | Temporal.PlainDateTime
578
+ | Temporal.Instant;
579
+
580
+ export interface DateTimeFormat extends globalThis.Intl.DateTimeFormat {
581
+ format(date?: FormattableTemporalObject | Date | number): string;
582
+ formatToParts(date?: FormattableTemporalObject | Date | number): DateTimeFormatPart[];
583
+ formatRange(
584
+ startDate: FormattableTemporalObject | Date | number,
585
+ endDate: FormattableTemporalObject | Date | number,
586
+ ): string;
587
+ formatRangeToParts(
588
+ startDate: FormattableTemporalObject | Date | number,
589
+ endDate: FormattableTemporalObject | Date | number,
590
+ ): DateTimeRangeFormatPart[];
591
+ }
592
+ }
593
+
594
+ export const Intl: {
595
+ DateTimeFormat: {
596
+ new (
597
+ locales?: string | string[],
598
+ options?: globalThis.Intl.DateTimeFormatOptions,
599
+ ): Intl.DateTimeFormat;
600
+ (
601
+ locales?: string | string[],
602
+ options?: globalThis.Intl.DateTimeFormatOptions,
603
+ ): Intl.DateTimeFormat;
604
+
605
+ supportedLocalesOf(
606
+ locales: string | string[],
607
+ options?: globalThis.Intl.DateTimeFormatOptions,
608
+ ): string[];
609
+ };
610
+ };
611
+
612
+ export function toTemporalInstant(this: Date): Temporal.Instant;
@@ -0,0 +1,2 @@
1
+ import { n as a, r as s, t as r } from "./src-CmT13QxP.js";
2
+ export { a as Intl, r as Temporal, s as toTemporalInstant };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Install Temporal polyfill.
3
+ * @param overwrite Whether to overwrite an existing Temporal implementation
4
+ */
5
+ export declare function install(overwrite: boolean): void;