|
| 1 | +=== tests/cases/conformance/es2022/es2022IntlAPIs.ts === |
| 2 | +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename |
| 3 | +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const; |
| 4 | +>timezoneNames : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] |
| 5 | +>['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] |
| 6 | +>['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] |
| 7 | +>'short' : "short" |
| 8 | +>'long' : "long" |
| 9 | +>'shortOffset' : "shortOffset" |
| 10 | +>'longOffset' : "longOffset" |
| 11 | +>'shortGeneric' : "shortGeneric" |
| 12 | +>'longGeneric' : "longGeneric" |
| 13 | + |
| 14 | +for (const zoneName of timezoneNames) { |
| 15 | +>zoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" |
| 16 | +>timezoneNames : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] |
| 17 | + |
| 18 | + var formatter = new Intl.DateTimeFormat('en-US', { |
| 19 | +>formatter : Intl.DateTimeFormat |
| 20 | +>new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles', timeZoneName: zoneName, }) : Intl.DateTimeFormat |
| 21 | +>Intl.DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; readonly prototype: Intl.DateTimeFormat; } |
| 22 | +>Intl : typeof Intl |
| 23 | +>DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; readonly prototype: Intl.DateTimeFormat; } |
| 24 | +>'en-US' : "en-US" |
| 25 | +>{ timeZone: 'America/Los_Angeles', timeZoneName: zoneName, } : { timeZone: string; timeZoneName: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric"; } |
| 26 | + |
| 27 | + timeZone: 'America/Los_Angeles', |
| 28 | +>timeZone : string |
| 29 | +>'America/Los_Angeles' : "America/Los_Angeles" |
| 30 | + |
| 31 | + timeZoneName: zoneName, |
| 32 | +>timeZoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" |
| 33 | +>zoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" |
| 34 | + |
| 35 | + }); |
| 36 | +} |
| 37 | + |
0 commit comments