@@ -606,6 +606,7 @@ export namespace Temporal {
606
606
fields ?( fields : Iterable < string > ) : Iterable < string > ;
607
607
mergeFields ?( fields : Record < string , unknown > , additionalFields : Record < string , unknown > ) : Record < string , unknown > ;
608
608
toString ( ) : string ;
609
+ toJSON ?( ) : string ;
609
610
}
610
611
611
612
/**
@@ -683,6 +684,7 @@ export namespace Temporal {
683
684
fields ( fields : Iterable < string > ) : Iterable < string > ;
684
685
mergeFields ( fields : Record < string , unknown > , additionalFields : Record < string , unknown > ) : Record < string , unknown > ;
685
686
toString ( ) : string ;
687
+ toJSON ( ) : string ;
686
688
readonly [ Symbol . toStringTag ] : 'Temporal.Calendar' ;
687
689
}
688
690
@@ -990,14 +992,8 @@ export namespace Temporal {
990
992
readonly calendar : Temporal . Calendar ;
991
993
equals ( other : Temporal . PlainTime | PlainTimeLike | string ) : boolean ;
992
994
with ( timeLike : Temporal . PlainTime | PlainTimeLike , options ?: AssignmentOptions ) : Temporal . PlainTime ;
993
- add (
994
- durationLike : Temporal . PlainTime | Temporal . Duration | DurationLike | string ,
995
- options ?: ArithmeticOptions
996
- ) : Temporal . PlainTime ;
997
- subtract (
998
- durationLike : Temporal . PlainTime | Temporal . Duration | DurationLike | string ,
999
- options ?: ArithmeticOptions
1000
- ) : Temporal . PlainTime ;
995
+ add ( durationLike : Temporal . Duration | DurationLike | string , options ?: ArithmeticOptions ) : Temporal . PlainTime ;
996
+ subtract ( durationLike : Temporal . Duration | DurationLike | string , options ?: ArithmeticOptions ) : Temporal . PlainTime ;
1001
997
until (
1002
998
other : Temporal . PlainTime | PlainTimeLike | string ,
1003
999
options ?: DifferenceOptions < 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond' | 'nanosecond' >
@@ -1195,7 +1191,7 @@ export namespace Temporal {
1195
1191
readonly millisecond : number ;
1196
1192
readonly microsecond : number ;
1197
1193
readonly nanosecond : number ;
1198
- readonly timeZone : Temporal . TimeZone ;
1194
+ readonly timeZone : Temporal . TimeZoneProtocol ;
1199
1195
readonly calendar : CalendarProtocol ;
1200
1196
readonly dayOfWeek : number ;
1201
1197
readonly dayOfYear : number ;
@@ -1404,7 +1400,7 @@ export namespace Temporal {
1404
1400
} ;
1405
1401
}
1406
1402
1407
- declare namespace IntlPolyfill {
1403
+ declare namespace Intl {
1408
1404
type Formattable =
1409
1405
| Date
1410
1406
| Temporal . Instant
@@ -1415,11 +1411,11 @@ declare namespace IntlPolyfill {
1415
1411
| Temporal . PlainYearMonth
1416
1412
| Temporal . PlainMonthDay ;
1417
1413
1418
- interface DateTimeFormatRangePart extends Intl . DateTimeFormatPart {
1414
+ interface DateTimeFormatRangePart extends globalThis . Intl . DateTimeFormatPart {
1419
1415
source : 'shared' | 'startRange' | 'endRange' ;
1420
1416
}
1421
1417
1422
- export interface DateTimeFormat extends Intl . DateTimeFormat {
1418
+ export interface DateTimeFormat extends globalThis . Intl . DateTimeFormat {
1423
1419
/**
1424
1420
* Format a date into a string according to the locale and formatting
1425
1421
* options of this `Intl.DateTimeFormat` object.
@@ -1434,7 +1430,7 @@ declare namespace IntlPolyfill {
1434
1430
*
1435
1431
* @param date The date to format.
1436
1432
*/
1437
- formatToParts ( date ?: Formattable | number ) : Intl . DateTimeFormatPart [ ] ;
1433
+ formatToParts ( date ?: Formattable | number ) : globalThis . Intl . DateTimeFormatPart [ ] ;
1438
1434
1439
1435
/**
1440
1436
* Format a date range in the most concise way based on the locale and
@@ -1459,23 +1455,31 @@ declare namespace IntlPolyfill {
1459
1455
formatRangeToParts ( startDate : Date | number , endDate : Date | number ) : DateTimeFormatRangePart [ ] ;
1460
1456
}
1461
1457
1458
+ export interface DateTimeFormatOptions extends Omit < globalThis . Intl . DateTimeFormatOptions , 'timeZone' > {
1459
+ timeZone ?: string | Temporal . TimeZoneProtocol ;
1460
+ // TODO: remove the props below after TS lib declarations are updated
1461
+ dayPeriod ?: 'narrow' | 'short' | 'long' ;
1462
+ dateStyle ?: 'full' | 'long' | 'medium' | 'short' ;
1463
+ timeStyle ?: 'full' | 'long' | 'medium' | 'short' ;
1464
+ }
1465
+
1462
1466
export const DateTimeFormat : {
1463
1467
/**
1464
1468
* Creates `Intl.DateTimeFormat` objects that enable language-sensitive
1465
1469
* date and time formatting.
1466
1470
*/
1467
- new ( locales ?: string | string [ ] , options ?: Intl . DateTimeFormatOptions ) : DateTimeFormat ;
1468
- ( locales ?: string | string [ ] , options ?: Intl . DateTimeFormatOptions ) : DateTimeFormat ;
1471
+ new ( locales ?: string | string [ ] , options ?: DateTimeFormatOptions ) : DateTimeFormat ;
1472
+ ( locales ?: string | string [ ] , options ?: DateTimeFormatOptions ) : DateTimeFormat ;
1469
1473
1470
1474
/**
1471
1475
* Get an array containing those of the provided locales that are supported
1472
1476
* in date and time formatting without having to fall back to the runtime's
1473
1477
* default locale.
1474
1478
*/
1475
- supportedLocalesOf ( locales : string | string [ ] , options ?: Intl . DateTimeFormatOptions ) : string [ ] ;
1479
+ supportedLocalesOf ( locales : string | string [ ] , options ?: DateTimeFormatOptions ) : string [ ] ;
1476
1480
} ;
1477
1481
}
1478
1482
1479
- export { IntlPolyfill as Intl } ;
1483
+ export { Intl as Intl } ;
1480
1484
1481
1485
export function toTemporalInstant ( this : Date ) : Temporal . Instant ;
0 commit comments