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