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.
package/dist/global.d.ts CHANGED
@@ -1,1402 +1 @@
1
- // original: https://github.com/tc39/proposal-temporal/blob/9291822b284e9b705ecf3d302a95d4f6d8517e0e/polyfill/index.d.ts
2
- /*! Copyright (c) 2017, 2018, 2019, 2020
3
- Ecma International. All rights reserved. */
4
- /*! SPDX-License-Identifier: BSD-3-Clause */
5
-
6
1
  export {};
7
-
8
- declare global {
9
- namespace Temporal {
10
- export type ComparisonResult = -1 | 0 | 1;
11
- export type RoundingMode =
12
- | "ceil"
13
- | "floor"
14
- | "expand"
15
- | "trunc"
16
- | "halfCeil"
17
- | "halfFloor"
18
- | "halfExpand"
19
- | "halfTrunc"
20
- | "halfEven";
21
-
22
- /**
23
- * Options for assigning fields using `with()` or entire objects with
24
- * `from()`.
25
- * */
26
- export type AssignmentOptions = {
27
- /**
28
- * How to deal with out-of-range values
29
- *
30
- * - In `'constrain'` mode, out-of-range values are clamped to the nearest
31
- * in-range value.
32
- * - In `'reject'` mode, out-of-range values will cause the function to
33
- * throw a RangeError.
34
- *
35
- * The default is `'constrain'`.
36
- */
37
- overflow?: "constrain" | "reject" | undefined;
38
- };
39
-
40
- /**
41
- * Options for assigning fields using `Duration.prototype.with()` or entire
42
- * objects with `Duration.from()`, and for arithmetic with
43
- * `Duration.prototype.add()` and `Duration.prototype.subtract()`.
44
- * */
45
- export type DurationOptions = {
46
- /**
47
- * How to deal with out-of-range values
48
- *
49
- * - In `'constrain'` mode, out-of-range values are clamped to the nearest
50
- * in-range value.
51
- * - In `'balance'` mode, out-of-range values are resolved by balancing them
52
- * with the next highest unit.
53
- *
54
- * The default is `'constrain'`.
55
- */
56
- overflow?: "constrain" | "balance" | undefined;
57
- };
58
-
59
- /**
60
- * Options for conversions of `Temporal.PlainDateTime` to `Temporal.Instant`
61
- * */
62
- export type ToInstantOptions = {
63
- /**
64
- * Controls handling of invalid or ambiguous times caused by time zone
65
- * offset changes like Daylight Saving time (DST) transitions.
66
- *
67
- * This option is only relevant if a `DateTime` value does not exist in the
68
- * destination time zone (e.g. near "Spring Forward" DST transitions), or
69
- * exists more than once (e.g. near "Fall Back" DST transitions).
70
- *
71
- * In case of ambiguous or nonexistent times, this option controls what
72
- * exact time to return:
73
- * - `'compatible'`: Equivalent to `'earlier'` for backward transitions like
74
- * the start of DST in the Spring, and `'later'` for forward transitions
75
- * like the end of DST in the Fall. This matches the behavior of legacy
76
- * `Date`, of libraries like moment.js, Luxon, or date-fns, and of
77
- * cross-platform standards like [RFC 5545
78
- * (iCalendar)](https://tools.ietf.org/html/rfc5545).
79
- * - `'earlier'`: The earlier time of two possible times
80
- * - `'later'`: The later of two possible times
81
- * - `'reject'`: Throw a RangeError instead
82
- *
83
- * The default is `'compatible'`.
84
- *
85
- * */
86
- disambiguation?: "compatible" | "earlier" | "later" | "reject" | undefined;
87
- };
88
-
89
- type OffsetDisambiguationOptions = {
90
- /**
91
- * Time zone definitions can change. If an application stores data about
92
- * events in the future, then stored data about future events may become
93
- * ambiguous, for example if a country permanently abolishes DST. The
94
- * `offset` option controls this unusual case.
95
- *
96
- * - `'use'` always uses the offset (if it's provided) to calculate the
97
- * instant. This ensures that the result will match the instant that was
98
- * originally stored, even if local clock time is different.
99
- * - `'prefer'` uses the offset if it's valid for the date/time in this time
100
- * zone, but if it's not valid then the time zone will be used as a
101
- * fallback to calculate the instant.
102
- * - `'ignore'` will disregard any provided offset. Instead, the time zone
103
- * and date/time value are used to calculate the instant. This will keep
104
- * local clock time unchanged but may result in a different real-world
105
- * instant.
106
- * - `'reject'` acts like `'prefer'`, except it will throw a RangeError if
107
- * the offset is not valid for the given time zone identifier and
108
- * date/time value.
109
- *
110
- * If the ISO string ends in 'Z' then this option is ignored because there
111
- * is no possibility of ambiguity.
112
- *
113
- * If a time zone offset is not present in the input, then this option is
114
- * ignored because the time zone will always be used to calculate the
115
- * offset.
116
- *
117
- * If the offset is not used, and if the date/time and time zone don't
118
- * uniquely identify a single instant, then the `disambiguation` option will
119
- * be used to choose the correct instant. However, if the offset is used
120
- * then the `disambiguation` option will be ignored.
121
- */
122
- offset?: "use" | "prefer" | "ignore" | "reject" | undefined;
123
- };
124
-
125
- export type ZonedDateTimeAssignmentOptions = AssignmentOptions &
126
- ToInstantOptions &
127
- OffsetDisambiguationOptions;
128
-
129
- /**
130
- * Options for arithmetic operations like `add()` and `subtract()`
131
- * */
132
- export type ArithmeticOptions = {
133
- /**
134
- * Controls handling of out-of-range arithmetic results.
135
- *
136
- * If a result is out of range, then `'constrain'` will clamp the result to
137
- * the allowed range, while `'reject'` will throw a RangeError.
138
- *
139
- * The default is `'constrain'`.
140
- */
141
- overflow?: "constrain" | "reject" | undefined;
142
- };
143
-
144
- export type DateUnit = "year" | "month" | "week" | "day";
145
- export type TimeUnit =
146
- | "hour"
147
- | "minute"
148
- | "second"
149
- | "millisecond"
150
- | "microsecond"
151
- | "nanosecond";
152
- export type DateTimeUnit = DateUnit | TimeUnit;
153
-
154
- /**
155
- * When the name of a unit is provided to a Temporal API as a string, it is
156
- * usually singular, e.g. 'day' or 'hour'. But plural unit names like 'days'
157
- * or 'hours' are also accepted.
158
- * */
159
- export type PluralUnit<T extends DateTimeUnit> = {
160
- year: "years";
161
- month: "months";
162
- week: "weeks";
163
- day: "days";
164
- hour: "hours";
165
- minute: "minutes";
166
- second: "seconds";
167
- millisecond: "milliseconds";
168
- microsecond: "microseconds";
169
- nanosecond: "nanoseconds";
170
- }[T];
171
-
172
- export type LargestUnit<T extends DateTimeUnit> = "auto" | T | PluralUnit<T>;
173
- export type SmallestUnit<T extends DateTimeUnit> = T | PluralUnit<T>;
174
- export type TotalUnit<T extends DateTimeUnit> = T | PluralUnit<T>;
175
-
176
- /**
177
- * Options for outputting precision in toString() on types with seconds
178
- */
179
- export type ToStringPrecisionOptions = {
180
- fractionalSecondDigits?: "auto" | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
181
- smallestUnit?:
182
- | SmallestUnit<"minute" | "second" | "millisecond" | "microsecond" | "nanosecond">
183
- | undefined;
184
-
185
- /**
186
- * Controls how rounding is performed:
187
- * - `halfExpand`: Round to the nearest of the values allowed by
188
- * `roundingIncrement` and `smallestUnit`. When there is a tie, round up.
189
- * This mode is the default.
190
- * - `ceil`: Always round up, towards the end of time.
191
- * - `trunc`: Always round down, towards the beginning of time.
192
- * - `floor`: Also round down, towards the beginning of time. This mode acts
193
- * the same as `trunc`, but it's included for consistency with
194
- * `Temporal.Duration.round()` where negative values are allowed and
195
- * `trunc` rounds towards zero, unlike `floor` which rounds towards
196
- * negative infinity which is usually unexpected. For this reason, `trunc`
197
- * is recommended for most use cases.
198
- */
199
- roundingMode?: RoundingMode | undefined;
200
- };
201
-
202
- export type ShowCalendarOption = {
203
- calendarName?: "auto" | "always" | "never" | "critical" | undefined;
204
- };
205
-
206
- export type CalendarTypeToStringOptions = ToStringPrecisionOptions & ShowCalendarOption;
207
-
208
- export type ZonedDateTimeToStringOptions = CalendarTypeToStringOptions & {
209
- timeZoneName?: "auto" | "never" | "critical" | undefined;
210
- offset?: "auto" | "never" | undefined;
211
- };
212
-
213
- export type InstantToStringOptions = ToStringPrecisionOptions & {
214
- timeZone?: TimeZoneLike | undefined;
215
- };
216
-
217
- /**
218
- * Options to control the result of `until()` and `since()` methods in
219
- * `Temporal` types.
220
- */
221
- export interface DifferenceOptions<T extends DateTimeUnit> {
222
- /**
223
- * The unit to round to. For example, to round to the nearest minute, use
224
- * `smallestUnit: 'minute'`. This property is optional for `until()` and
225
- * `since()`, because those methods default behavior is not to round.
226
- * However, the same property is required for `round()`.
227
- */
228
- smallestUnit?: SmallestUnit<T> | undefined;
229
-
230
- /**
231
- * The largest unit to allow in the resulting `Temporal.Duration` object.
232
- *
233
- * Larger units will be "balanced" into smaller units. For example, if
234
- * `largestUnit` is `'minute'` then a two-hour duration will be output as a
235
- * 120-minute duration.
236
- *
237
- * Valid values may include `'year'`, `'month'`, `'week'`, `'day'`,
238
- * `'hour'`, `'minute'`, `'second'`, `'millisecond'`, `'microsecond'`,
239
- * `'nanosecond'` and `'auto'`, although some types may throw an exception
240
- * if a value is used that would produce an invalid result. For example,
241
- * `hours` is not accepted by `Temporal.PlainDate.prototype.since()`.
242
- *
243
- * The default is always `'auto'`, though the meaning of this depends on the
244
- * type being used.
245
- */
246
- largestUnit?: LargestUnit<T> | undefined;
247
-
248
- /**
249
- * Allows rounding to an integer number of units. For example, to round to
250
- * increments of a half hour, use `{ smallestUnit: 'minute',
251
- * roundingIncrement: 30 }`.
252
- */
253
- roundingIncrement?: number | undefined;
254
-
255
- /**
256
- * Controls how rounding is performed:
257
- * - `halfExpand`: Round to the nearest of the values allowed by
258
- * `roundingIncrement` and `smallestUnit`. When there is a tie, round away
259
- * from zero like `ceil` for positive durations and like `floor` for
260
- * negative durations.
261
- * - `ceil`: Always round up, towards the end of time.
262
- * - `trunc`: Always round down, towards the beginning of time. This mode is
263
- * the default.
264
- * - `floor`: Also round down, towards the beginning of time. This mode acts
265
- * the same as `trunc`, but it's included for consistency with
266
- * `Temporal.Duration.round()` where negative values are allowed and
267
- * `trunc` rounds towards zero, unlike `floor` which rounds towards
268
- * negative infinity which is usually unexpected. For this reason, `trunc`
269
- * is recommended for most use cases.
270
- */
271
- roundingMode?: RoundingMode | undefined;
272
- }
273
-
274
- /**
275
- * `round` methods take one required parameter. If a string is provided, the
276
- * resulting `Temporal.Duration` object will be rounded to that unit. If an
277
- * object is provided, its `smallestUnit` property is required while other
278
- * properties are optional. A string is treated the same as an object whose
279
- * `smallestUnit` property value is that string.
280
- */
281
- export type RoundTo<T extends DateTimeUnit> =
282
- | SmallestUnit<T>
283
- | {
284
- /**
285
- * The unit to round to. For example, to round to the nearest minute,
286
- * use `smallestUnit: 'minute'`. This option is required. Note that the
287
- * same-named property is optional when passed to `until` or `since`
288
- * methods, because those methods do no rounding by default.
289
- */
290
- smallestUnit: SmallestUnit<T>;
291
-
292
- /**
293
- * Allows rounding to an integer number of units. For example, to round to
294
- * increments of a half hour, use `{ smallestUnit: 'minute',
295
- * roundingIncrement: 30 }`.
296
- */
297
- roundingIncrement?: number | undefined;
298
-
299
- /**
300
- * Controls how rounding is performed:
301
- * - `halfExpand`: Round to the nearest of the values allowed by
302
- * `roundingIncrement` and `smallestUnit`. When there is a tie, round up.
303
- * This mode is the default.
304
- * - `ceil`: Always round up, towards the end of time.
305
- * - `trunc`: Always round down, towards the beginning of time.
306
- * - `floor`: Also round down, towards the beginning of time. This mode acts
307
- * the same as `trunc`, but it's included for consistency with
308
- * `Temporal.Duration.round()` where negative values are allowed and
309
- * `trunc` rounds towards zero, unlike `floor` which rounds towards
310
- * negative infinity which is usually unexpected. For this reason, `trunc`
311
- * is recommended for most use cases.
312
- */
313
- roundingMode?: RoundingMode | undefined;
314
- };
315
-
316
- /**
317
- * The `round` method of the `Temporal.Duration` accepts one required
318
- * parameter. If a string is provided, the resulting `Temporal.Duration`
319
- * object will be rounded to that unit. If an object is provided, the
320
- * `smallestUnit` and/or `largestUnit` property is required, while other
321
- * properties are optional. A string parameter is treated the same as an
322
- * object whose `smallestUnit` property value is that string.
323
- */
324
- export type DurationRoundTo =
325
- | SmallestUnit<DateTimeUnit>
326
- | ((
327
- | {
328
- /**
329
- * The unit to round to. For example, to round to the nearest
330
- * minute, use `smallestUnit: 'minute'`. This property is normally
331
- * required, but is optional if `largestUnit` is provided and not
332
- * undefined.
333
- */
334
- smallestUnit: SmallestUnit<DateTimeUnit>;
335
-
336
- /**
337
- * The largest unit to allow in the resulting `Temporal.Duration`
338
- * object.
339
- *
340
- * Larger units will be "balanced" into smaller units. For example,
341
- * if `largestUnit` is `'minute'` then a two-hour duration will be
342
- * output as a 120-minute duration.
343
- *
344
- * Valid values include `'year'`, `'month'`, `'week'`, `'day'`,
345
- * `'hour'`, `'minute'`, `'second'`, `'millisecond'`,
346
- * `'microsecond'`, `'nanosecond'` and `'auto'`.
347
- *
348
- * The default is `'auto'`, which means "the largest nonzero unit in
349
- * the input duration". This default prevents expanding durations to
350
- * larger units unless the caller opts into this behavior.
351
- *
352
- * If `smallestUnit` is larger, then `smallestUnit` will be used as
353
- * `largestUnit`, superseding a caller-supplied or default value.
354
- */
355
- largestUnit?: LargestUnit<DateTimeUnit> | undefined;
356
- }
357
- | {
358
- /**
359
- * The unit to round to. For example, to round to the nearest
360
- * minute, use `smallestUnit: 'minute'`. This property is normally
361
- * required, but is optional if `largestUnit` is provided and not
362
- * undefined.
363
- */
364
- smallestUnit?: SmallestUnit<DateTimeUnit> | undefined;
365
-
366
- /**
367
- * The largest unit to allow in the resulting `Temporal.Duration`
368
- * object.
369
- *
370
- * Larger units will be "balanced" into smaller units. For example,
371
- * if `largestUnit` is `'minute'` then a two-hour duration will be
372
- * output as a 120-minute duration.
373
- *
374
- * Valid values include `'year'`, `'month'`, `'week'`, `'day'`,
375
- * `'hour'`, `'minute'`, `'second'`, `'millisecond'`,
376
- * `'microsecond'`, `'nanosecond'` and `'auto'`.
377
- *
378
- * The default is `'auto'`, which means "the largest nonzero unit in
379
- * the input duration". This default prevents expanding durations to
380
- * larger units unless the caller opts into this behavior.
381
- *
382
- * If `smallestUnit` is larger, then `smallestUnit` will be used as
383
- * `largestUnit`, superseding a caller-supplied or default value.
384
- */
385
- largestUnit: LargestUnit<DateTimeUnit>;
386
- }
387
- ) & {
388
- /**
389
- * Allows rounding to an integer number of units. For example, to round
390
- * to increments of a half hour, use `{ smallestUnit: 'minute',
391
- * roundingIncrement: 30 }`.
392
- */
393
- roundingIncrement?: number | undefined;
394
-
395
- /**
396
- * Controls how rounding is performed:
397
- * - `halfExpand`: Round to the nearest of the values allowed by
398
- * `roundingIncrement` and `smallestUnit`. When there is a tie, round
399
- * away from zero like `ceil` for positive durations and like `floor`
400
- * for negative durations. This mode is the default.
401
- * - `ceil`: Always round towards positive infinity. For negative
402
- * durations this option will decrease the absolute value of the
403
- * duration which may be unexpected. To round away from zero, use
404
- * `ceil` for positive durations and `floor` for negative durations.
405
- * - `trunc`: Always round down towards zero.
406
- * - `floor`: Always round towards negative infinity. This mode acts the
407
- * same as `trunc` for positive durations but for negative durations
408
- * it will increase the absolute value of the result which may be
409
- * unexpected. For this reason, `trunc` is recommended for most "round
410
- * down" use cases.
411
- */
412
- roundingMode?: RoundingMode | undefined;
413
-
414
- /**
415
- * The starting point to use for rounding and conversions when
416
- * variable-length units (years, months, weeks depending on the
417
- * calendar) are involved. This option is required if any of the
418
- * following are true:
419
- * - `unit` is `'week'` or larger units
420
- * - `this` has a nonzero value for `weeks` or larger units
421
- *
422
- * This value must be either a `Temporal.PlainDateTime`, a
423
- * `Temporal.ZonedDateTime`, or a string or object value that can be
424
- * passed to `from()` of those types. Examples:
425
- * - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
426
- * - `'2020-01-01'`
427
- * - `Temporal.PlainDate.from('2020-01-01')`
428
- *
429
- * `Temporal.ZonedDateTime` will be tried first because it's more
430
- * specific, with `Temporal.PlainDateTime` as a fallback.
431
- *
432
- * If the value resolves to a `Temporal.ZonedDateTime`, then operation
433
- * will adjust for DST and other time zone transitions. Otherwise
434
- * (including if this option is omitted), then the operation will ignore
435
- * time zone transitions and all days will be assumed to be 24 hours
436
- * long.
437
- */
438
- relativeTo?:
439
- | Temporal.PlainDateTime
440
- | Temporal.ZonedDateTime
441
- | PlainDateTimeLike
442
- | ZonedDateTimeLike
443
- | string
444
- | undefined;
445
- });
446
-
447
- /**
448
- * Options to control behavior of `Duration.prototype.total()`
449
- */
450
- export type DurationTotalOf =
451
- | TotalUnit<DateTimeUnit>
452
- | {
453
- /**
454
- * The unit to convert the duration to. This option is required.
455
- */
456
- unit: TotalUnit<DateTimeUnit>;
457
-
458
- /**
459
- * The starting point to use when variable-length units (years, months,
460
- * weeks depending on the calendar) are involved. This option is required if
461
- * any of the following are true:
462
- * - `unit` is `'week'` or larger units
463
- * - `this` has a nonzero value for `weeks` or larger units
464
- *
465
- * This value must be either a `Temporal.PlainDateTime`, a
466
- * `Temporal.ZonedDateTime`, or a string or object value that can be passed
467
- * to `from()` of those types. Examples:
468
- * - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
469
- * - `'2020-01-01'`
470
- * - `Temporal.PlainDate.from('2020-01-01')`
471
- *
472
- * `Temporal.ZonedDateTime` will be tried first because it's more
473
- * specific, with `Temporal.PlainDateTime` as a fallback.
474
- *
475
- * If the value resolves to a `Temporal.ZonedDateTime`, then operation will
476
- * adjust for DST and other time zone transitions. Otherwise (including if
477
- * this option is omitted), then the operation will ignore time zone
478
- * transitions and all days will be assumed to be 24 hours long.
479
- */
480
- relativeTo?:
481
- | Temporal.ZonedDateTime
482
- | Temporal.PlainDateTime
483
- | ZonedDateTimeLike
484
- | PlainDateTimeLike
485
- | string
486
- | undefined;
487
- };
488
-
489
- /**
490
- * Options to control behavior of `Duration.compare()`
491
- */
492
- export interface DurationArithmeticOptions {
493
- /**
494
- * The starting point to use when variable-length units (years, months,
495
- * weeks depending on the calendar) are involved. This option is required if
496
- * either of the durations has a nonzero value for `weeks` or larger units.
497
- *
498
- * This value must be either a `Temporal.PlainDateTime`, a
499
- * `Temporal.ZonedDateTime`, or a string or object value that can be passed
500
- * to `from()` of those types. Examples:
501
- * - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
502
- * - `'2020-01-01'`
503
- * - `Temporal.PlainDate.from('2020-01-01')`
504
- *
505
- * `Temporal.ZonedDateTime` will be tried first because it's more
506
- * specific, with `Temporal.PlainDateTime` as a fallback.
507
- *
508
- * If the value resolves to a `Temporal.ZonedDateTime`, then operation will
509
- * adjust for DST and other time zone transitions. Otherwise (including if
510
- * this option is omitted), then the operation will ignore time zone
511
- * transitions and all days will be assumed to be 24 hours long.
512
- */
513
- relativeTo?:
514
- | Temporal.ZonedDateTime
515
- | Temporal.PlainDateTime
516
- | ZonedDateTimeLike
517
- | PlainDateTimeLike
518
- | string
519
- | undefined;
520
- }
521
-
522
- /**
523
- * Options to control behaviour of `ZonedDateTime.prototype.getTimeZoneTransition()`
524
- */
525
- export type TransitionDirection = "next" | "previous" | { direction: "next" | "previous" };
526
-
527
- export type DurationLike = {
528
- years?: number | undefined;
529
- months?: number | undefined;
530
- weeks?: number | undefined;
531
- days?: number | undefined;
532
- hours?: number | undefined;
533
- minutes?: number | undefined;
534
- seconds?: number | undefined;
535
- milliseconds?: number | undefined;
536
- microseconds?: number | undefined;
537
- nanoseconds?: number | undefined;
538
- };
539
-
540
- /**
541
- * Options for Intl.DurationFormat
542
- */
543
- export type DurationFormatOptions = {
544
- localeMatcher?: "lookup" | "best fit" | undefined;
545
- numberingSystem?: string | undefined;
546
- style?: "long" | "short" | "narrow" | "digital" | undefined;
547
- years?: "long" | "short" | "narrow" | undefined;
548
- yearsDisplay?: "always" | "auto" | undefined;
549
- months?: "long" | "short" | "narrow" | undefined;
550
- monthsDisplay?: "always" | "auto" | undefined;
551
- weeks?: "long" | "short" | "narrow" | undefined;
552
- weeksDisplay?: "always" | "auto" | undefined;
553
- days?: "long" | "short" | "narrow" | undefined;
554
- daysDisplay?: "always" | "auto" | undefined;
555
- hours?: "long" | "short" | "narrow" | "numeric" | "2-digit" | undefined;
556
- hoursDisplay?: "always" | "auto" | undefined;
557
- minutes?: "long" | "short" | "narrow" | "numeric" | "2-digit" | undefined;
558
- minutesDisplay?: "always" | "auto" | undefined;
559
- seconds?: "long" | "short" | "narrow" | "numeric" | "2-digit" | undefined;
560
- secondsDisplay?: "always" | "auto" | undefined;
561
- milliseconds?: "long" | "short" | "narrow" | "numeric" | undefined;
562
- millisecondsDisplay?: "always" | "auto" | undefined;
563
- microseconds?: "long" | "short" | "narrow" | "numeric" | undefined;
564
- microsecondsDisplay?: "always" | "auto" | undefined;
565
- nanoseconds?: "long" | "short" | "narrow" | "numeric" | undefined;
566
- nanosecondsDisplay?: "always" | "auto" | undefined;
567
- fractionalDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
568
- };
569
-
570
- /**
571
- *
572
- * A `Temporal.Duration` represents an immutable duration of time which can be
573
- * used in date/time arithmetic.
574
- *
575
- * See https://tc39.es/proposal-temporal/docs/duration.html for more details.
576
- */
577
- export class Duration {
578
- static from(item: Temporal.Duration | DurationLike | string): Temporal.Duration;
579
- static compare(
580
- one: Temporal.Duration | DurationLike | string,
581
- two: Temporal.Duration | DurationLike | string,
582
- options?: DurationArithmeticOptions,
583
- ): ComparisonResult;
584
- constructor(
585
- years?: number,
586
- months?: number,
587
- weeks?: number,
588
- days?: number,
589
- hours?: number,
590
- minutes?: number,
591
- seconds?: number,
592
- milliseconds?: number,
593
- microseconds?: number,
594
- nanoseconds?: number,
595
- );
596
- readonly sign: -1 | 0 | 1;
597
- readonly blank: boolean;
598
- readonly years: number;
599
- readonly months: number;
600
- readonly weeks: number;
601
- readonly days: number;
602
- readonly hours: number;
603
- readonly minutes: number;
604
- readonly seconds: number;
605
- readonly milliseconds: number;
606
- readonly microseconds: number;
607
- readonly nanoseconds: number;
608
- negated(): Temporal.Duration;
609
- abs(): Temporal.Duration;
610
- with(durationLike: DurationLike): Temporal.Duration;
611
- add(other: Temporal.Duration | DurationLike | string): Temporal.Duration;
612
- subtract(other: Temporal.Duration | DurationLike | string): Temporal.Duration;
613
- round(roundTo: DurationRoundTo): Temporal.Duration;
614
- total(totalOf: DurationTotalOf): number;
615
- toLocaleString(
616
- locales?: globalThis.Intl.LocalesArgument,
617
- options?: DurationFormatOptions,
618
- ): string;
619
- toJSON(): string;
620
- toString(options?: ToStringPrecisionOptions): string;
621
- valueOf(): never;
622
- readonly [Symbol.toStringTag]: "Temporal.Duration";
623
- }
624
-
625
- /**
626
- * A `Temporal.Instant` is an exact point in time, with a precision in
627
- * nanoseconds. No time zone or calendar information is present. Therefore,
628
- * `Temporal.Instant` has no concept of days, months, or even hours.
629
- *
630
- * For convenience of interoperability, it internally uses nanoseconds since
631
- * the {@link https://en.wikipedia.org/wiki/Unix_time|Unix epoch} (midnight
632
- * UTC on January 1, 1970). However, a `Temporal.Instant` can be created from
633
- * any of several expressions that refer to a single point in time, including
634
- * an {@link https://datatracker.ietf.org/doc/html/rfc9557|RFC 9557 string}
635
- * with a time zone offset such as '2020-01-23T17:04:36.491865121-08:00'.
636
- *
637
- * See https://tc39.es/proposal-temporal/docs/instant.html for more details.
638
- */
639
- export class Instant {
640
- static fromEpochMilliseconds(epochMilliseconds: number): Temporal.Instant;
641
- static fromEpochNanoseconds(epochNanoseconds: bigint): Temporal.Instant;
642
- static from(item: Temporal.Instant | string): Temporal.Instant;
643
- static compare(
644
- one: Temporal.Instant | string,
645
- two: Temporal.Instant | string,
646
- ): ComparisonResult;
647
- constructor(epochNanoseconds: bigint);
648
- readonly epochMilliseconds: number;
649
- readonly epochNanoseconds: bigint;
650
- equals(other: Temporal.Instant | string): boolean;
651
- add(
652
- durationLike:
653
- | Omit<Temporal.Duration | DurationLike, "years" | "months" | "weeks" | "days">
654
- | string,
655
- ): Temporal.Instant;
656
- subtract(
657
- durationLike:
658
- | Omit<Temporal.Duration | DurationLike, "years" | "months" | "weeks" | "days">
659
- | string,
660
- ): Temporal.Instant;
661
- until(
662
- other: Temporal.Instant | string,
663
- options?: DifferenceOptions<
664
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
665
- >,
666
- ): Temporal.Duration;
667
- since(
668
- other: Temporal.Instant | string,
669
- options?: DifferenceOptions<
670
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
671
- >,
672
- ): Temporal.Duration;
673
- round(
674
- roundTo: RoundTo<
675
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
676
- >,
677
- ): Temporal.Instant;
678
- toZonedDateTimeISO(tzLike: TimeZoneLike): Temporal.ZonedDateTime;
679
- toLocaleString(
680
- locales?: globalThis.Intl.LocalesArgument,
681
- options?: globalThis.Intl.DateTimeFormatOptions,
682
- ): string;
683
- toJSON(): string;
684
- toString(options?: InstantToStringOptions): string;
685
- valueOf(): never;
686
- readonly [Symbol.toStringTag]: "Temporal.Instant";
687
- }
688
-
689
- /**
690
- * Any of these types can be passed to Temporal methods instead of a calendar ID.
691
- * */
692
- export type CalendarLike =
693
- | string
694
- | ZonedDateTime
695
- | PlainDateTime
696
- | PlainDate
697
- | PlainYearMonth
698
- | PlainMonthDay;
699
-
700
- export type PlainDateLike = {
701
- era?: string | undefined;
702
- eraYear?: number | undefined;
703
- year?: number | undefined;
704
- month?: number | undefined;
705
- monthCode?: string | undefined;
706
- day?: number | undefined;
707
- calendar?: CalendarLike | undefined;
708
- };
709
-
710
- /**
711
- * A `Temporal.PlainDate` represents a calendar date. "Calendar date" refers to the
712
- * concept of a date as expressed in everyday usage, independent of any time
713
- * zone. For example, it could be used to represent an event on a calendar
714
- * which happens during the whole day no matter which time zone it's happening
715
- * in.
716
- *
717
- * See https://tc39.es/proposal-temporal/docs/date.html for more details.
718
- */
719
- export class PlainDate {
720
- static from(
721
- item: Temporal.PlainDate | PlainDateLike | string,
722
- options?: AssignmentOptions,
723
- ): Temporal.PlainDate;
724
- static compare(
725
- one: Temporal.PlainDate | PlainDateLike | string,
726
- two: Temporal.PlainDate | PlainDateLike | string,
727
- ): ComparisonResult;
728
- constructor(isoYear: number, isoMonth: number, isoDay: number, calendar?: string);
729
- readonly era: string | undefined;
730
- readonly eraYear: number | undefined;
731
- readonly year: number;
732
- readonly month: number;
733
- readonly monthCode: string;
734
- readonly day: number;
735
- readonly calendarId: string;
736
- readonly dayOfWeek: number;
737
- readonly dayOfYear: number;
738
- readonly weekOfYear: number | undefined;
739
- readonly yearOfWeek: number | undefined;
740
- readonly daysInWeek: number;
741
- readonly daysInYear: number;
742
- readonly daysInMonth: number;
743
- readonly monthsInYear: number;
744
- readonly inLeapYear: boolean;
745
- equals(other: Temporal.PlainDate | PlainDateLike | string): boolean;
746
- with(dateLike: PlainDateLike, options?: AssignmentOptions): Temporal.PlainDate;
747
- withCalendar(calendar: CalendarLike): Temporal.PlainDate;
748
- add(
749
- durationLike: Temporal.Duration | DurationLike | string,
750
- options?: ArithmeticOptions,
751
- ): Temporal.PlainDate;
752
- subtract(
753
- durationLike: Temporal.Duration | DurationLike | string,
754
- options?: ArithmeticOptions,
755
- ): Temporal.PlainDate;
756
- until(
757
- other: Temporal.PlainDate | PlainDateLike | string,
758
- options?: DifferenceOptions<"year" | "month" | "week" | "day">,
759
- ): Temporal.Duration;
760
- since(
761
- other: Temporal.PlainDate | PlainDateLike | string,
762
- options?: DifferenceOptions<"year" | "month" | "week" | "day">,
763
- ): Temporal.Duration;
764
- toPlainDateTime(
765
- temporalTime?: Temporal.PlainTime | PlainTimeLike | string,
766
- ): Temporal.PlainDateTime;
767
- toZonedDateTime(
768
- timeZoneAndTime:
769
- | string
770
- | {
771
- timeZone: TimeZoneLike;
772
- plainTime?: Temporal.PlainTime | PlainTimeLike | string | undefined;
773
- },
774
- ): Temporal.ZonedDateTime;
775
- toPlainYearMonth(): Temporal.PlainYearMonth;
776
- toPlainMonthDay(): Temporal.PlainMonthDay;
777
- toLocaleString(
778
- locales?: globalThis.Intl.LocalesArgument,
779
- options?: globalThis.Intl.DateTimeFormatOptions,
780
- ): string;
781
- toJSON(): string;
782
- toString(options?: ShowCalendarOption): string;
783
- valueOf(): never;
784
- readonly [Symbol.toStringTag]: "Temporal.PlainDate";
785
- }
786
-
787
- export type PlainDateTimeLike = {
788
- era?: string | undefined;
789
- eraYear?: number | undefined;
790
- year?: number | undefined;
791
- month?: number | undefined;
792
- monthCode?: string | undefined;
793
- day?: number | undefined;
794
- hour?: number | undefined;
795
- minute?: number | undefined;
796
- second?: number | undefined;
797
- millisecond?: number | undefined;
798
- microsecond?: number | undefined;
799
- nanosecond?: number | undefined;
800
- calendar?: CalendarLike | undefined;
801
- };
802
-
803
- /**
804
- * A `Temporal.PlainDateTime` represents a calendar date and wall-clock time, with
805
- * a precision in nanoseconds, and without any time zone. Of the Temporal
806
- * classes carrying human-readable time information, it is the most general
807
- * and complete one. `Temporal.PlainDate`, `Temporal.PlainTime`, `Temporal.PlainYearMonth`,
808
- * and `Temporal.PlainMonthDay` all carry less information and should be used when
809
- * complete information is not required.
810
- *
811
- * See https://tc39.es/proposal-temporal/docs/datetime.html for more details.
812
- */
813
- export class PlainDateTime {
814
- static from(
815
- item: Temporal.PlainDateTime | PlainDateTimeLike | string,
816
- options?: AssignmentOptions,
817
- ): Temporal.PlainDateTime;
818
- static compare(
819
- one: Temporal.PlainDateTime | PlainDateTimeLike | string,
820
- two: Temporal.PlainDateTime | PlainDateTimeLike | string,
821
- ): ComparisonResult;
822
- constructor(
823
- isoYear: number,
824
- isoMonth: number,
825
- isoDay: number,
826
- hour?: number,
827
- minute?: number,
828
- second?: number,
829
- millisecond?: number,
830
- microsecond?: number,
831
- nanosecond?: number,
832
- calendar?: string,
833
- );
834
- readonly era: string | undefined;
835
- readonly eraYear: number | undefined;
836
- readonly year: number;
837
- readonly month: number;
838
- readonly monthCode: string;
839
- readonly day: number;
840
- readonly hour: number;
841
- readonly minute: number;
842
- readonly second: number;
843
- readonly millisecond: number;
844
- readonly microsecond: number;
845
- readonly nanosecond: number;
846
- readonly calendarId: string;
847
- readonly dayOfWeek: number;
848
- readonly dayOfYear: number;
849
- readonly weekOfYear: number | undefined;
850
- readonly yearOfWeek: number | undefined;
851
- readonly daysInWeek: number;
852
- readonly daysInYear: number;
853
- readonly daysInMonth: number;
854
- readonly monthsInYear: number;
855
- readonly inLeapYear: boolean;
856
- equals(other: Temporal.PlainDateTime | PlainDateTimeLike | string): boolean;
857
- with(dateTimeLike: PlainDateTimeLike, options?: AssignmentOptions): Temporal.PlainDateTime;
858
- withPlainTime(timeLike?: Temporal.PlainTime | PlainTimeLike | string): Temporal.PlainDateTime;
859
- withCalendar(calendar: CalendarLike): Temporal.PlainDateTime;
860
- add(
861
- durationLike: Temporal.Duration | DurationLike | string,
862
- options?: ArithmeticOptions,
863
- ): Temporal.PlainDateTime;
864
- subtract(
865
- durationLike: Temporal.Duration | DurationLike | string,
866
- options?: ArithmeticOptions,
867
- ): Temporal.PlainDateTime;
868
- until(
869
- other: Temporal.PlainDateTime | PlainDateTimeLike | string,
870
- options?: DifferenceOptions<
871
- | "year"
872
- | "month"
873
- | "week"
874
- | "day"
875
- | "hour"
876
- | "minute"
877
- | "second"
878
- | "millisecond"
879
- | "microsecond"
880
- | "nanosecond"
881
- >,
882
- ): Temporal.Duration;
883
- since(
884
- other: Temporal.PlainDateTime | PlainDateTimeLike | string,
885
- options?: DifferenceOptions<
886
- | "year"
887
- | "month"
888
- | "week"
889
- | "day"
890
- | "hour"
891
- | "minute"
892
- | "second"
893
- | "millisecond"
894
- | "microsecond"
895
- | "nanosecond"
896
- >,
897
- ): Temporal.Duration;
898
- round(
899
- roundTo: RoundTo<
900
- "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
901
- >,
902
- ): Temporal.PlainDateTime;
903
- toZonedDateTime(tzLike: TimeZoneLike, options?: ToInstantOptions): Temporal.ZonedDateTime;
904
- toPlainDate(): Temporal.PlainDate;
905
- toPlainTime(): Temporal.PlainTime;
906
- toLocaleString(
907
- locales?: globalThis.Intl.LocalesArgument,
908
- options?: globalThis.Intl.DateTimeFormatOptions,
909
- ): string;
910
- toJSON(): string;
911
- toString(options?: CalendarTypeToStringOptions): string;
912
- valueOf(): never;
913
- readonly [Symbol.toStringTag]: "Temporal.PlainDateTime";
914
- }
915
-
916
- export type PlainMonthDayLike = {
917
- era?: string | undefined;
918
- eraYear?: number | undefined;
919
- year?: number | undefined;
920
- month?: number | undefined;
921
- monthCode?: string | undefined;
922
- day?: number | undefined;
923
- calendar?: CalendarLike | undefined;
924
- };
925
-
926
- /**
927
- * A `Temporal.PlainMonthDay` represents a particular day on the calendar, but
928
- * without a year. For example, it could be used to represent a yearly
929
- * recurring event, like "Bastille Day is on the 14th of July."
930
- *
931
- * See https://tc39.es/proposal-temporal/docs/monthday.html for more details.
932
- */
933
- export class PlainMonthDay {
934
- static from(
935
- item: Temporal.PlainMonthDay | PlainMonthDayLike | string,
936
- options?: AssignmentOptions,
937
- ): Temporal.PlainMonthDay;
938
- constructor(isoMonth: number, isoDay: number, calendar?: string, referenceISOYear?: number);
939
- readonly monthCode: string;
940
- readonly day: number;
941
- readonly calendarId: string;
942
- equals(other: Temporal.PlainMonthDay | PlainMonthDayLike | string): boolean;
943
- with(monthDayLike: PlainMonthDayLike, options?: AssignmentOptions): Temporal.PlainMonthDay;
944
- toPlainDate(year: { year: number }): Temporal.PlainDate;
945
- toLocaleString(
946
- locales?: globalThis.Intl.LocalesArgument,
947
- options?: globalThis.Intl.DateTimeFormatOptions,
948
- ): string;
949
- toJSON(): string;
950
- toString(options?: ShowCalendarOption): string;
951
- valueOf(): never;
952
- readonly [Symbol.toStringTag]: "Temporal.PlainMonthDay";
953
- }
954
-
955
- export type PlainTimeLike = {
956
- hour?: number | undefined;
957
- minute?: number | undefined;
958
- second?: number | undefined;
959
- millisecond?: number | undefined;
960
- microsecond?: number | undefined;
961
- nanosecond?: number | undefined;
962
- };
963
-
964
- /**
965
- * A `Temporal.PlainTime` represents a wall-clock time, with a precision in
966
- * nanoseconds, and without any time zone. "Wall-clock time" refers to the
967
- * concept of a time as expressed in everyday usage — the time that you read
968
- * off the clock on the wall. For example, it could be used to represent an
969
- * event that happens daily at a certain time, no matter what time zone.
970
- *
971
- * `Temporal.PlainTime` refers to a time with no associated calendar date; if you
972
- * need to refer to a specific time on a specific day, use
973
- * `Temporal.PlainDateTime`. A `Temporal.PlainTime` can be converted into a
974
- * `Temporal.PlainDateTime` by combining it with a `Temporal.PlainDate` using the
975
- * `toPlainDateTime()` method.
976
- *
977
- * See https://tc39.es/proposal-temporal/docs/time.html for more details.
978
- */
979
- export class PlainTime {
980
- static from(
981
- item: Temporal.PlainTime | PlainTimeLike | string,
982
- options?: AssignmentOptions,
983
- ): Temporal.PlainTime;
984
- static compare(
985
- one: Temporal.PlainTime | PlainTimeLike | string,
986
- two: Temporal.PlainTime | PlainTimeLike | string,
987
- ): ComparisonResult;
988
- constructor(
989
- hour?: number,
990
- minute?: number,
991
- second?: number,
992
- millisecond?: number,
993
- microsecond?: number,
994
- nanosecond?: number,
995
- );
996
- readonly hour: number;
997
- readonly minute: number;
998
- readonly second: number;
999
- readonly millisecond: number;
1000
- readonly microsecond: number;
1001
- readonly nanosecond: number;
1002
- equals(other: Temporal.PlainTime | PlainTimeLike | string): boolean;
1003
- with(
1004
- timeLike: Temporal.PlainTime | PlainTimeLike,
1005
- options?: AssignmentOptions,
1006
- ): Temporal.PlainTime;
1007
- add(
1008
- durationLike: Temporal.Duration | DurationLike | string,
1009
- options?: ArithmeticOptions,
1010
- ): Temporal.PlainTime;
1011
- subtract(
1012
- durationLike: Temporal.Duration | DurationLike | string,
1013
- options?: ArithmeticOptions,
1014
- ): Temporal.PlainTime;
1015
- until(
1016
- other: Temporal.PlainTime | PlainTimeLike | string,
1017
- options?: DifferenceOptions<
1018
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
1019
- >,
1020
- ): Temporal.Duration;
1021
- since(
1022
- other: Temporal.PlainTime | PlainTimeLike | string,
1023
- options?: DifferenceOptions<
1024
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
1025
- >,
1026
- ): Temporal.Duration;
1027
- round(
1028
- roundTo: RoundTo<
1029
- "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
1030
- >,
1031
- ): Temporal.PlainTime;
1032
- toLocaleString(
1033
- locales?: globalThis.Intl.LocalesArgument,
1034
- options?: globalThis.Intl.DateTimeFormatOptions,
1035
- ): string;
1036
- toJSON(): string;
1037
- toString(options?: ToStringPrecisionOptions): string;
1038
- valueOf(): never;
1039
- readonly [Symbol.toStringTag]: "Temporal.PlainTime";
1040
- }
1041
-
1042
- /**
1043
- * Any of these types can be passed to Temporal methods instead of a time zone ID.
1044
- * */
1045
- export type TimeZoneLike = string | ZonedDateTime;
1046
-
1047
- export type PlainYearMonthLike = {
1048
- era?: string | undefined;
1049
- eraYear?: number | undefined;
1050
- year?: number | undefined;
1051
- month?: number | undefined;
1052
- monthCode?: string | undefined;
1053
- calendar?: CalendarLike | undefined;
1054
- };
1055
-
1056
- /**
1057
- * A `Temporal.PlainYearMonth` represents a particular month on the calendar. For
1058
- * example, it could be used to represent a particular instance of a monthly
1059
- * recurring event, like "the June 2019 meeting".
1060
- *
1061
- * See https://tc39.es/proposal-temporal/docs/yearmonth.html for more details.
1062
- */
1063
- export class PlainYearMonth {
1064
- static from(
1065
- item: Temporal.PlainYearMonth | PlainYearMonthLike | string,
1066
- options?: AssignmentOptions,
1067
- ): Temporal.PlainYearMonth;
1068
- static compare(
1069
- one: Temporal.PlainYearMonth | PlainYearMonthLike | string,
1070
- two: Temporal.PlainYearMonth | PlainYearMonthLike | string,
1071
- ): ComparisonResult;
1072
- constructor(isoYear: number, isoMonth: number, calendar?: string, referenceISODay?: number);
1073
- readonly era: string | undefined;
1074
- readonly eraYear: number | undefined;
1075
- readonly year: number;
1076
- readonly month: number;
1077
- readonly monthCode: string;
1078
- readonly calendarId: string;
1079
- readonly daysInMonth: number;
1080
- readonly daysInYear: number;
1081
- readonly monthsInYear: number;
1082
- readonly inLeapYear: boolean;
1083
- equals(other: Temporal.PlainYearMonth | PlainYearMonthLike | string): boolean;
1084
- with(yearMonthLike: PlainYearMonthLike, options?: AssignmentOptions): Temporal.PlainYearMonth;
1085
- add(
1086
- durationLike: Temporal.Duration | DurationLike | string,
1087
- options?: ArithmeticOptions,
1088
- ): Temporal.PlainYearMonth;
1089
- subtract(
1090
- durationLike: Temporal.Duration | DurationLike | string,
1091
- options?: ArithmeticOptions,
1092
- ): Temporal.PlainYearMonth;
1093
- until(
1094
- other: Temporal.PlainYearMonth | PlainYearMonthLike | string,
1095
- options?: DifferenceOptions<"year" | "month">,
1096
- ): Temporal.Duration;
1097
- since(
1098
- other: Temporal.PlainYearMonth | PlainYearMonthLike | string,
1099
- options?: DifferenceOptions<"year" | "month">,
1100
- ): Temporal.Duration;
1101
- toPlainDate(day: { day: number }): Temporal.PlainDate;
1102
- toLocaleString(
1103
- locales?: globalThis.Intl.LocalesArgument,
1104
- options?: globalThis.Intl.DateTimeFormatOptions,
1105
- ): string;
1106
- toJSON(): string;
1107
- toString(options?: ShowCalendarOption): string;
1108
- valueOf(): never;
1109
- readonly [Symbol.toStringTag]: "Temporal.PlainYearMonth";
1110
- }
1111
-
1112
- export type ZonedDateTimeLike = {
1113
- era?: string | undefined;
1114
- eraYear?: number | undefined;
1115
- year?: number | undefined;
1116
- month?: number | undefined;
1117
- monthCode?: string | undefined;
1118
- day?: number | undefined;
1119
- hour?: number | undefined;
1120
- minute?: number | undefined;
1121
- second?: number | undefined;
1122
- millisecond?: number | undefined;
1123
- microsecond?: number | undefined;
1124
- nanosecond?: number | undefined;
1125
- offset?: string | undefined;
1126
- timeZone?: TimeZoneLike | undefined;
1127
- calendar?: CalendarLike | undefined;
1128
- };
1129
-
1130
- export class ZonedDateTime {
1131
- static from(
1132
- item: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
1133
- options?: ZonedDateTimeAssignmentOptions,
1134
- ): ZonedDateTime;
1135
- static compare(
1136
- one: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
1137
- two: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
1138
- ): ComparisonResult;
1139
- constructor(epochNanoseconds: bigint, timeZone: string, calendar?: string);
1140
- readonly era: string | undefined;
1141
- readonly eraYear: number | undefined;
1142
- readonly year: number;
1143
- readonly month: number;
1144
- readonly monthCode: string;
1145
- readonly day: number;
1146
- readonly hour: number;
1147
- readonly minute: number;
1148
- readonly second: number;
1149
- readonly millisecond: number;
1150
- readonly microsecond: number;
1151
- readonly nanosecond: number;
1152
- readonly timeZoneId: string;
1153
- readonly calendarId: string;
1154
- readonly dayOfWeek: number;
1155
- readonly dayOfYear: number;
1156
- readonly weekOfYear: number | undefined;
1157
- readonly yearOfWeek: number | undefined;
1158
- readonly hoursInDay: number;
1159
- readonly daysInWeek: number;
1160
- readonly daysInMonth: number;
1161
- readonly daysInYear: number;
1162
- readonly monthsInYear: number;
1163
- readonly inLeapYear: boolean;
1164
- readonly offsetNanoseconds: number;
1165
- readonly offset: string;
1166
- readonly epochMilliseconds: number;
1167
- readonly epochNanoseconds: bigint;
1168
- equals(other: Temporal.ZonedDateTime | ZonedDateTimeLike | string): boolean;
1169
- with(
1170
- zonedDateTimeLike: ZonedDateTimeLike,
1171
- options?: ZonedDateTimeAssignmentOptions,
1172
- ): Temporal.ZonedDateTime;
1173
- withPlainTime(timeLike?: Temporal.PlainTime | PlainTimeLike | string): Temporal.ZonedDateTime;
1174
- withCalendar(calendar: CalendarLike): Temporal.ZonedDateTime;
1175
- withTimeZone(timeZone: TimeZoneLike): Temporal.ZonedDateTime;
1176
- add(
1177
- durationLike: Temporal.Duration | DurationLike | string,
1178
- options?: ArithmeticOptions,
1179
- ): Temporal.ZonedDateTime;
1180
- subtract(
1181
- durationLike: Temporal.Duration | DurationLike | string,
1182
- options?: ArithmeticOptions,
1183
- ): Temporal.ZonedDateTime;
1184
- until(
1185
- other: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
1186
- options?: Temporal.DifferenceOptions<
1187
- | "year"
1188
- | "month"
1189
- | "week"
1190
- | "day"
1191
- | "hour"
1192
- | "minute"
1193
- | "second"
1194
- | "millisecond"
1195
- | "microsecond"
1196
- | "nanosecond"
1197
- >,
1198
- ): Temporal.Duration;
1199
- since(
1200
- other: Temporal.ZonedDateTime | ZonedDateTimeLike | string,
1201
- options?: Temporal.DifferenceOptions<
1202
- | "year"
1203
- | "month"
1204
- | "week"
1205
- | "day"
1206
- | "hour"
1207
- | "minute"
1208
- | "second"
1209
- | "millisecond"
1210
- | "microsecond"
1211
- | "nanosecond"
1212
- >,
1213
- ): Temporal.Duration;
1214
- round(
1215
- roundTo: RoundTo<
1216
- "day" | "hour" | "minute" | "second" | "millisecond" | "microsecond" | "nanosecond"
1217
- >,
1218
- ): Temporal.ZonedDateTime;
1219
- startOfDay(): Temporal.ZonedDateTime;
1220
- getTimeZoneTransition(direction: TransitionDirection): Temporal.ZonedDateTime | null;
1221
- toInstant(): Temporal.Instant;
1222
- toPlainDateTime(): Temporal.PlainDateTime;
1223
- toPlainDate(): Temporal.PlainDate;
1224
- toPlainTime(): Temporal.PlainTime;
1225
- toLocaleString(
1226
- locales?: globalThis.Intl.LocalesArgument,
1227
- options?: globalThis.Intl.DateTimeFormatOptions,
1228
- ): string;
1229
- toJSON(): string;
1230
- toString(options?: ZonedDateTimeToStringOptions): string;
1231
- valueOf(): never;
1232
- readonly [Symbol.toStringTag]: "Temporal.ZonedDateTime";
1233
- }
1234
-
1235
- /**
1236
- * The `Temporal.Now` object has several methods which give information about
1237
- * the current date, time, and time zone.
1238
- *
1239
- * See https://tc39.es/proposal-temporal/docs/now.html for more details.
1240
- */
1241
- export const Now: {
1242
- /**
1243
- * Get the exact system date and time as a `Temporal.Instant`.
1244
- *
1245
- * This method gets the current exact system time, without regard to
1246
- * calendar or time zone. This is a good way to get a timestamp for an
1247
- * event, for example. It works like the old-style JavaScript `Date.now()`,
1248
- * but with nanosecond precision instead of milliseconds.
1249
- *
1250
- * Note that a `Temporal.Instant` doesn't know about time zones. For the
1251
- * exact time in a specific time zone, use `Temporal.Now.zonedDateTimeISO`
1252
- * or `Temporal.Now.zonedDateTime`.
1253
- * */
1254
- instant: () => Temporal.Instant;
1255
-
1256
- /**
1257
- * Get the current calendar date and clock time in a specific time zone,
1258
- * using the ISO 8601 calendar.
1259
- *
1260
- * @param {TimeZoneLike} [tzLike] -
1261
- * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
1262
- * string (e.g. `'Europe/London'`). If omitted, the environment's
1263
- * current time zone will be used.
1264
- */
1265
- zonedDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.ZonedDateTime;
1266
-
1267
- /**
1268
- * Get the current date and clock time in a specific time zone, using the
1269
- * ISO 8601 calendar.
1270
- *
1271
- * Note that the `Temporal.PlainDateTime` type does not persist the time zone,
1272
- * but retaining the time zone is required for most time-zone-related use
1273
- * cases. Therefore, it's usually recommended to use
1274
- * `Temporal.Now.zonedDateTimeISO` instead of this function.
1275
- *
1276
- * @param {TimeZoneLike} [tzLike] -
1277
- * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
1278
- * string (e.g. `'Europe/London'`). If omitted, the environment's
1279
- * current time zone will be used.
1280
- */
1281
- plainDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.PlainDateTime;
1282
-
1283
- /**
1284
- * Get the current date in a specific time zone, using the ISO 8601
1285
- * calendar.
1286
- *
1287
- * @param {TimeZoneLike} [tzLike] -
1288
- * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
1289
- * string (e.g. `'Europe/London'`). If omitted, the environment's
1290
- * current time zone will be used.
1291
- */
1292
- plainDateISO: (tzLike?: TimeZoneLike) => Temporal.PlainDate;
1293
-
1294
- /**
1295
- * Get the current clock time in a specific time zone, using the ISO 8601 calendar.
1296
- *
1297
- * @param {TimeZoneLike} [tzLike] -
1298
- * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
1299
- * string (e.g. `'Europe/London'`). If omitted, the environment's
1300
- * current time zone will be used.
1301
- */
1302
- plainTimeISO: (tzLike?: TimeZoneLike) => Temporal.PlainTime;
1303
-
1304
- /**
1305
- * Get the identifier of the environment's current time zone.
1306
- *
1307
- * This method gets the identifier of the current system time zone. This
1308
- * will usually be a named
1309
- * {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone}.
1310
- */
1311
- timeZoneId: () => string;
1312
-
1313
- readonly [Symbol.toStringTag]: "Temporal.Now";
1314
- };
1315
- }
1316
-
1317
- namespace Intl {
1318
- type Formattable =
1319
- | Date
1320
- | Temporal.Instant
1321
- | Temporal.PlainDate
1322
- | Temporal.PlainTime
1323
- | Temporal.PlainDateTime
1324
- | Temporal.PlainYearMonth
1325
- | Temporal.PlainMonthDay;
1326
-
1327
- export interface DateTimeFormat extends globalThis.Intl.DateTimeFormat {
1328
- /**
1329
- * Format a date into a string according to the locale and formatting
1330
- * options of this `Intl.DateTimeFormat` object.
1331
- *
1332
- * @param date The date to format.
1333
- */
1334
- format(date?: Formattable | number): string;
1335
-
1336
- /**
1337
- * Allow locale-aware formatting of strings produced by
1338
- * `Intl.DateTimeFormat` formatters.
1339
- *
1340
- * @param date The date to format.
1341
- */
1342
- formatToParts(date?: Formattable | number): globalThis.Intl.DateTimeFormatPart[];
1343
-
1344
- /**
1345
- * Format a date range in the most concise way based on the locale and
1346
- * options provided when instantiating this `Intl.DateTimeFormat` object.
1347
- *
1348
- * @param startDate The start date of the range to format.
1349
- * @param endDate The start date of the range to format. Must be the same
1350
- * type as `startRange`.
1351
- */
1352
- formatRange<T extends Formattable>(startDate: T, endDate: T): string;
1353
- formatRange(startDate: Date | number, endDate: Date | number): string;
1354
-
1355
- /**
1356
- * Allow locale-aware formatting of tokens representing each part of the
1357
- * formatted date range produced by `Intl.DateTimeFormat` formatters.
1358
- *
1359
- * @param startDate The start date of the range to format.
1360
- * @param endDate The start date of the range to format. Must be the same
1361
- * type as `startRange`.
1362
- */
1363
- formatRangeToParts<T extends Formattable>(
1364
- startDate: T,
1365
- endDate: T,
1366
- ): globalThis.Intl.DateTimeRangeFormatPart[];
1367
- formatRangeToParts(
1368
- startDate: Date | number,
1369
- endDate: Date | number,
1370
- ): globalThis.Intl.DateTimeRangeFormatPart[];
1371
- }
1372
-
1373
- export const DateTimeFormat: {
1374
- /**
1375
- * Creates `Intl.DateTimeFormat` objects that enable language-sensitive
1376
- * date and time formatting.
1377
- */
1378
- new (
1379
- locales?: string | string[],
1380
- options?: globalThis.Intl.DateTimeFormatOptions,
1381
- ): DateTimeFormat;
1382
- (
1383
- locales?: string | string[],
1384
- options?: globalThis.Intl.DateTimeFormatOptions,
1385
- ): DateTimeFormat;
1386
-
1387
- /**
1388
- * Get an array containing those of the provided locales that are supported
1389
- * in date and time formatting without having to fall back to the runtime's
1390
- * default locale.
1391
- */
1392
- supportedLocalesOf(
1393
- locales: string | string[],
1394
- options?: globalThis.Intl.DateTimeFormatOptions,
1395
- ): string[];
1396
- };
1397
- }
1398
-
1399
- interface Date {
1400
- toTemporalInstant(): Temporal.Instant;
1401
- }
1402
- }