|
12 | 12 |
|
13 | 13 | let formatterCache = new Map<string, Intl.DateTimeFormat>();
|
14 | 14 |
|
15 |
| -interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions { |
16 |
| - hourCycle?: Intl.DateTimeFormatOptions['hourCycle'] |
17 |
| -} |
18 |
| - |
19 | 15 | interface DateRangeFormatPart extends Intl.DateTimeFormatPart {
|
20 | 16 | source: 'startRange' | 'endRange' | 'shared'
|
21 | 17 | }
|
@@ -79,8 +75,8 @@ export class DateFormatter implements Intl.DateTimeFormat {
|
79 | 75 | }
|
80 | 76 |
|
81 | 77 | /** Returns the resolved formatting options based on the values passed to the constructor. */
|
82 |
| - resolvedOptions(): ResolvedDateTimeFormatOptions { |
83 |
| - let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions; |
| 78 | + resolvedOptions(): Intl.ResolvedDateTimeFormatOptions { |
| 79 | + let resolvedOptions = this.formatter.resolvedOptions(); |
84 | 80 | if (hasBuggyResolvedHourCycle()) {
|
85 | 81 | if (!this.resolvedHourCycle) {
|
86 | 82 | this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);
|
@@ -156,10 +152,10 @@ function hasBuggyHour12Behavior() {
|
156 | 152 | let _hasBuggyResolvedHourCycle: boolean | null = null;
|
157 | 153 | function hasBuggyResolvedHourCycle() {
|
158 | 154 | if (_hasBuggyResolvedHourCycle == null) {
|
159 |
| - _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', { |
| 155 | + _hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', { |
160 | 156 | hour: 'numeric',
|
161 | 157 | hour12: false
|
162 |
| - }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12'; |
| 158 | + }).resolvedOptions().hourCycle === 'h12'; |
163 | 159 | }
|
164 | 160 |
|
165 | 161 | return _hasBuggyResolvedHourCycle;
|
|
0 commit comments