Skip to content

Commit 61d2939

Browse files
author
Orta Therox
authoredSep 23, 2021
Adds more Intl.ResolvedDateTimeFormatOptions, and hooks up Intl for ES2021 (#45905)
* Adds more ResolvedDateTimeFormatOptions to the Intl APIs * Fix tests
1 parent a4f9bf0 commit 61d2939

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed
 

‎src/lib/es2021.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/// <reference lib="es2021.promise" />
33
/// <reference lib="es2021.string" />
44
/// <reference lib="es2021.weakref" />
5+
/// <reference lib="es2021.intl" />

‎src/lib/es2021.intl.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ declare namespace Intl {
88
fractionalSecondDigits?: 0 | 1 | 2 | 3 | undefined;
99
}
1010

11+
interface ResolvedDateTimeFormatOptions {
12+
formatMatcher?: "basic" | "best fit" | "best fit";
13+
dateStyle?: "full" | "long" | "medium" | "short";
14+
timeStyle?: "full" | "long" | "medium" | "short";
15+
hourCycle?: "h11" | "h12" | "h23" | "h24";
16+
dayPeriod?: "narrow" | "short" | "long";
17+
fractionalSecondDigits?: 0 | 1 | 2 | 3;
18+
}
19+
1120
interface NumberFormat {
1221
formatRange(startDate: number | bigint, endDate: number | bigint): string;
1322
formatRangeToParts(startDate: number | bigint, endDate: number | bigint): NumberFormatPart[];

‎tests/baselines/reference/formatToPartsBigInt.symbols

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
// Test Intl methods with new parameter type
55
new Intl.NumberFormat("fr").formatToParts(3000n);
66
>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --))
7-
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
8-
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more)
9-
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
7+
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --))
8+
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 2 more)
9+
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --))
1010
>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --))
1111

1212
new Intl.NumberFormat("fr").formatToParts(BigInt(123));
1313
>new Intl.NumberFormat("fr").formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --))
14-
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
15-
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more)
16-
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
14+
>Intl.NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --))
15+
>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 2 more)
16+
>NumberFormat : Symbol(Intl.NumberFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --))
1717
>formatToParts : Symbol(Intl.NumberFormat.formatToParts, Decl(lib.es2018.intl.d.ts, --, --))
1818
>BigInt : Symbol(BigInt, Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --))
1919

0 commit comments

Comments
 (0)
Please sign in to comment.