@formatjs/ecma402-abstract 1.9.0 → 1.9.4
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/IsValidTimeZoneName.d.ts +1 -1
- package/IsValidTimeZoneName.d.ts.map +1 -1
- package/IsValidTimeZoneName.js +6 -1
- package/NumberFormat/InitializeNumberFormat.d.ts +2 -2
- package/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
- package/NumberFormat/digit-mapping.generated.d.ts +2 -0
- package/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
- package/NumberFormat/digit-mapping.generated.js +4 -0
- package/NumberFormat/format_to_parts.js +2 -3
- package/index.d.ts +1 -23
- package/index.d.ts.map +1 -1
- package/index.js +13 -38
- package/lib/IsValidTimeZoneName.d.ts +1 -1
- package/lib/IsValidTimeZoneName.d.ts.map +1 -1
- package/lib/IsValidTimeZoneName.js +6 -1
- package/lib/NumberFormat/InitializeNumberFormat.d.ts +2 -2
- package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
- package/lib/NumberFormat/digit-mapping.generated.d.ts +2 -0
- package/lib/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
- package/lib/NumberFormat/digit-mapping.generated.js +1 -0
- package/lib/NumberFormat/format_to_parts.js +1 -1
- package/lib/index.d.ts +1 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -23
- package/lib/types/date-time.d.ts +2 -1
- package/lib/types/date-time.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/date-time.d.ts +2 -1
- package/types/date-time.d.ts.map +1 -1
- package/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
- package/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
- package/DateTimeFormat/BasicFormatMatcher.js +0 -61
- package/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
- package/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
- package/DateTimeFormat/BestFitFormatMatcher.js +0 -121
- package/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
- package/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
- package/DateTimeFormat/DateTimeStyleFormat.js +0 -54
- package/DateTimeFormat/FormatDateTime.d.ts +0 -8
- package/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTime.js +0 -19
- package/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
- package/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimePattern.js +0 -182
- package/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
- package/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeRange.js +0 -14
- package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
- package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -18
- package/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
- package/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeToParts.js +0 -25
- package/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
- package/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
- package/DateTimeFormat/InitializeDateTimeFormat.js +0 -188
- package/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
- package/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
- package/DateTimeFormat/PartitionDateTimePattern.js +0 -24
- package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
- package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
- package/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -128
- package/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
- package/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
- package/DateTimeFormat/ToDateTimeOptions.js +0 -67
- package/DateTimeFormat/ToLocalTime.d.ts +0 -26
- package/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
- package/DateTimeFormat/ToLocalTime.js +0 -55
- package/DateTimeFormat/skeleton.d.ts +0 -14
- package/DateTimeFormat/skeleton.d.ts.map +0 -1
- package/DateTimeFormat/skeleton.js +0 -301
- package/DateTimeFormat/utils.d.ts +0 -10
- package/DateTimeFormat/utils.d.ts.map +0 -1
- package/DateTimeFormat/utils.js +0 -21
- package/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
- package/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
- package/DisplayNames/CanonicalCodeForDisplayNames.js +0 -37
- package/NumberFormat/digit-mapping.json +0 -1
- package/PluralRules/GetOperands.d.ts +0 -32
- package/PluralRules/GetOperands.d.ts.map +0 -1
- package/PluralRules/GetOperands.js +0 -51
- package/PluralRules/InitializePluralRules.d.ts +0 -9
- package/PluralRules/InitializePluralRules.d.ts.map +0 -1
- package/PluralRules/InitializePluralRules.js +0 -24
- package/PluralRules/ResolvePlural.d.ts +0 -13
- package/PluralRules/ResolvePlural.d.ts.map +0 -1
- package/PluralRules/ResolvePlural.js +0 -29
- package/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
- package/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
- package/RelativeTimeFormat/FormatRelativeTime.js +0 -14
- package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
- package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
- package/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -22
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -41
- package/RelativeTimeFormat/MakePartsList.d.ts +0 -2
- package/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
- package/RelativeTimeFormat/MakePartsList.js +0 -31
- package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
- package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
- package/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -58
- package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
- package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
- package/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -40
- package/lib/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
- package/lib/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
- package/lib/DateTimeFormat/BasicFormatMatcher.js +0 -57
- package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
- package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
- package/lib/DateTimeFormat/BestFitFormatMatcher.js +0 -116
- package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
- package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
- package/lib/DateTimeFormat/DateTimeStyleFormat.js +0 -50
- package/lib/DateTimeFormat/FormatDateTime.d.ts +0 -8
- package/lib/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTime.js +0 -15
- package/lib/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
- package/lib/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimePattern.js +0 -178
- package/lib/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
- package/lib/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeRange.js +0 -10
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -14
- package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
- package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeToParts.js +0 -21
- package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
- package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
- package/lib/DateTimeFormat/InitializeDateTimeFormat.js +0 -184
- package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
- package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/PartitionDateTimePattern.js +0 -20
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -124
- package/lib/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
- package/lib/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
- package/lib/DateTimeFormat/ToDateTimeOptions.js +0 -63
- package/lib/DateTimeFormat/ToLocalTime.d.ts +0 -26
- package/lib/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
- package/lib/DateTimeFormat/ToLocalTime.js +0 -51
- package/lib/DateTimeFormat/skeleton.d.ts +0 -14
- package/lib/DateTimeFormat/skeleton.d.ts.map +0 -1
- package/lib/DateTimeFormat/skeleton.js +0 -294
- package/lib/DateTimeFormat/utils.d.ts +0 -10
- package/lib/DateTimeFormat/utils.d.ts.map +0 -1
- package/lib/DateTimeFormat/utils.js +0 -18
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.js +0 -33
- package/lib/NumberFormat/digit-mapping.json +0 -1
- package/lib/PluralRules/GetOperands.d.ts +0 -32
- package/lib/PluralRules/GetOperands.d.ts.map +0 -1
- package/lib/PluralRules/GetOperands.js +0 -47
- package/lib/PluralRules/InitializePluralRules.d.ts +0 -9
- package/lib/PluralRules/InitializePluralRules.d.ts.map +0 -1
- package/lib/PluralRules/InitializePluralRules.js +0 -20
- package/lib/PluralRules/ResolvePlural.d.ts +0 -13
- package/lib/PluralRules/ResolvePlural.d.ts.map +0 -1
- package/lib/PluralRules/ResolvePlural.js +0 -25
- package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
- package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/FormatRelativeTime.js +0 -10
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -18
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -37
- package/lib/RelativeTimeFormat/MakePartsList.d.ts +0 -2
- package/lib/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/MakePartsList.js +0 -27
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -54
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -36
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { DATE_TIME_PROPS } from './utils';
|
|
2
|
-
import { ToLocalTime } from './ToLocalTime';
|
|
3
|
-
import { TimeClip } from '../262';
|
|
4
|
-
function pad(n) {
|
|
5
|
-
if (n < 10) {
|
|
6
|
-
return "0" + n;
|
|
7
|
-
}
|
|
8
|
-
return String(n);
|
|
9
|
-
}
|
|
10
|
-
function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
|
|
11
|
-
var offsetInMinutes = Math.floor(offsetInMs / 60000);
|
|
12
|
-
var mins = Math.abs(offsetInMinutes) % 60;
|
|
13
|
-
var hours = Math.floor(Math.abs(offsetInMinutes) / 60);
|
|
14
|
-
var _a = hourFormat.split(';'), positivePattern = _a[0], negativePattern = _a[1];
|
|
15
|
-
var offsetStr = '';
|
|
16
|
-
var pattern = offsetInMs < 0 ? negativePattern : positivePattern;
|
|
17
|
-
if (style === 'long') {
|
|
18
|
-
offsetStr = pattern
|
|
19
|
-
.replace('HH', pad(hours))
|
|
20
|
-
.replace('H', String(hours))
|
|
21
|
-
.replace('mm', pad(mins))
|
|
22
|
-
.replace('m', String(mins));
|
|
23
|
-
}
|
|
24
|
-
else if (mins || hours) {
|
|
25
|
-
if (!mins) {
|
|
26
|
-
pattern = pattern.replace(/:?m+/, '');
|
|
27
|
-
}
|
|
28
|
-
offsetStr = pattern.replace(/H+/, String(hours)).replace(/m+/, String(mins));
|
|
29
|
-
}
|
|
30
|
-
return gmtFormat.replace('{0}', offsetStr);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
|
|
34
|
-
* @param dtf
|
|
35
|
-
* @param x
|
|
36
|
-
*/
|
|
37
|
-
export function FormatDateTimePattern(dtf, patternParts, x, _a) {
|
|
38
|
-
var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;
|
|
39
|
-
x = TimeClip(x);
|
|
40
|
-
/** IMPL START */
|
|
41
|
-
var internalSlots = getInternalSlots(dtf);
|
|
42
|
-
var dataLocale = internalSlots.dataLocale;
|
|
43
|
-
var dataLocaleData = localeData[dataLocale];
|
|
44
|
-
/** IMPL END */
|
|
45
|
-
var locale = internalSlots.locale;
|
|
46
|
-
var nfOptions = Object.create(null);
|
|
47
|
-
nfOptions.useGrouping = false;
|
|
48
|
-
var nf = new Intl.NumberFormat(locale, nfOptions);
|
|
49
|
-
var nf2Options = Object.create(null);
|
|
50
|
-
nf2Options.minimumIntegerDigits = 2;
|
|
51
|
-
nf2Options.useGrouping = false;
|
|
52
|
-
var nf2 = new Intl.NumberFormat(locale, nf2Options);
|
|
53
|
-
var fractionalSecondDigits = internalSlots.fractionalSecondDigits;
|
|
54
|
-
var nf3;
|
|
55
|
-
if (fractionalSecondDigits !== undefined) {
|
|
56
|
-
var nf3Options = Object.create(null);
|
|
57
|
-
nf3Options.minimumIntegerDigits = fractionalSecondDigits;
|
|
58
|
-
nf3Options.useGrouping = false;
|
|
59
|
-
nf3 = new Intl.NumberFormat(locale, nf3Options);
|
|
60
|
-
}
|
|
61
|
-
var tm = ToLocalTime(x,
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
64
|
-
var result = [];
|
|
65
|
-
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
|
|
66
|
-
var patternPart = patternParts_1[_i];
|
|
67
|
-
var p = patternPart.type;
|
|
68
|
-
if (p === 'literal') {
|
|
69
|
-
result.push({
|
|
70
|
-
type: 'literal',
|
|
71
|
-
value: patternPart.value,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else if (p === 'fractionalSecondDigits') {
|
|
75
|
-
var v = Math.floor(tm.millisecond * Math.pow(10, ((fractionalSecondDigits || 0) - 3)));
|
|
76
|
-
result.push({
|
|
77
|
-
// @ts-expect-error Spec is not there yet
|
|
78
|
-
type: 'fractionalSecond',
|
|
79
|
-
value: nf3.format(v),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else if (DATE_TIME_PROPS.indexOf(p) > -1) {
|
|
83
|
-
var fv = '';
|
|
84
|
-
var f = internalSlots[p];
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
var v = tm[p];
|
|
87
|
-
if (p === 'year' && v <= 0) {
|
|
88
|
-
v = 1 - v;
|
|
89
|
-
}
|
|
90
|
-
if (p === 'month') {
|
|
91
|
-
v++;
|
|
92
|
-
}
|
|
93
|
-
var hourCycle = internalSlots.hourCycle;
|
|
94
|
-
if (p === 'hour' && (hourCycle === 'h11' || hourCycle === 'h12')) {
|
|
95
|
-
v = v % 12;
|
|
96
|
-
if (v === 0 && hourCycle === 'h12') {
|
|
97
|
-
v = 12;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (p === 'hour' && hourCycle === 'h24') {
|
|
101
|
-
if (v === 0) {
|
|
102
|
-
v = 24;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (f === 'numeric') {
|
|
106
|
-
fv = nf.format(v);
|
|
107
|
-
}
|
|
108
|
-
else if (f === '2-digit') {
|
|
109
|
-
fv = nf2.format(v);
|
|
110
|
-
if (fv.length > 2) {
|
|
111
|
-
fv = fv.slice(fv.length - 2, fv.length);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (f === 'narrow' || f === 'short' || f === 'long') {
|
|
115
|
-
if (p === 'era') {
|
|
116
|
-
fv = dataLocaleData[p][f][v];
|
|
117
|
-
}
|
|
118
|
-
else if (p === 'timeZoneName') {
|
|
119
|
-
var timeZoneName = dataLocaleData.timeZoneName, gmtFormat = dataLocaleData.gmtFormat, hourFormat = dataLocaleData.hourFormat;
|
|
120
|
-
var timeZone = internalSlots.timeZone || getDefaultTimeZone();
|
|
121
|
-
var timeZoneData = timeZoneName[timeZone];
|
|
122
|
-
if (timeZoneData && timeZoneData[f]) {
|
|
123
|
-
fv = timeZoneData[f][+tm.inDST];
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
// Fallback to gmtFormat
|
|
127
|
-
fv = offsetToGmtString(gmtFormat, hourFormat, tm.timeZoneOffset, f);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else if (p === 'month') {
|
|
131
|
-
fv = dataLocaleData.month[f][v - 1];
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
fv = dataLocaleData[p][f][v];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
result.push({
|
|
138
|
-
type: p,
|
|
139
|
-
value: fv,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
else if (p === 'ampm') {
|
|
143
|
-
var v = tm.hour;
|
|
144
|
-
var fv = void 0;
|
|
145
|
-
if (v > 11) {
|
|
146
|
-
fv = dataLocaleData.pm;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
fv = dataLocaleData.am;
|
|
150
|
-
}
|
|
151
|
-
result.push({
|
|
152
|
-
type: 'dayPeriod',
|
|
153
|
-
value: fv,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
else if (p === 'relatedYear') {
|
|
157
|
-
var v = tm.relatedYear;
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
var fv = nf.format(v);
|
|
160
|
-
result.push({
|
|
161
|
-
// @ts-ignore TODO: Fix TS type
|
|
162
|
-
type: 'relatedYear',
|
|
163
|
-
value: fv,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
else if (p === 'yearName') {
|
|
167
|
-
var v = tm.yearName;
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
var fv = nf.format(v);
|
|
170
|
-
result.push({
|
|
171
|
-
// @ts-ignore TODO: Fix TS type
|
|
172
|
-
type: 'yearName',
|
|
173
|
-
value: fv,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { FormatDateTimePatternImplDetails } from './FormatDateTimePattern';
|
|
2
|
-
import { ToLocalTimeImplDetails } from './ToLocalTime';
|
|
3
|
-
export declare function FormatDateTimeRange(dtf: Intl.DateTimeFormat, x: number, y: number, implDetails: FormatDateTimePatternImplDetails & ToLocalTimeImplDetails): string;
|
|
4
|
-
//# sourceMappingURL=FormatDateTimeRange.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatDateTimeRange.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/FormatDateTimeRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gCAAgC,EAAC,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAEpD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,gCAAgC,GAAG,sBAAsB,UAQvE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PartitionDateTimeRangePattern } from './PartitionDateTimeRangePattern';
|
|
2
|
-
export function FormatDateTimeRange(dtf, x, y, implDetails) {
|
|
3
|
-
var parts = PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
4
|
-
var result = '';
|
|
5
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
6
|
-
var part = parts_1[_i];
|
|
7
|
-
result += part.value;
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { FormatDateTimePatternImplDetails } from './FormatDateTimePattern';
|
|
2
|
-
import { ToLocalTimeImplDetails } from './ToLocalTime';
|
|
3
|
-
export declare function FormatDateTimeRangeToParts(dtf: Intl.DateTimeFormat, x: number, y: number, implDetails: FormatDateTimePatternImplDetails & ToLocalTimeImplDetails): any[];
|
|
4
|
-
//# sourceMappingURL=FormatDateTimeRangeToParts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatDateTimeRangeToParts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/FormatDateTimeRangeToParts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gCAAgC,EAAC,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAEpD,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,gCAAgC,GAAG,sBAAsB,SAYvE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PartitionDateTimeRangePattern } from './PartitionDateTimeRangePattern';
|
|
2
|
-
export function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
|
|
3
|
-
var parts = PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
4
|
-
var result = new Array(0);
|
|
5
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
6
|
-
var part = parts_1[_i];
|
|
7
|
-
result.push({
|
|
8
|
-
type: part.type,
|
|
9
|
-
value: part.value,
|
|
10
|
-
source: part.source,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PartitionDateTimePattern } from './PartitionDateTimePattern';
|
|
2
|
-
import { IntlDateTimeFormatPart } from '../types/date-time';
|
|
3
|
-
/**
|
|
4
|
-
* https://tc39.es/ecma402/#sec-formatdatetimetoparts
|
|
5
|
-
*
|
|
6
|
-
* @param dtf
|
|
7
|
-
* @param x
|
|
8
|
-
* @param implDetails
|
|
9
|
-
*/
|
|
10
|
-
export declare function FormatDateTimeToParts(dtf: Intl.DateTimeFormat, x: number, implDetails: Parameters<typeof PartitionDateTimePattern>[2]): IntlDateTimeFormatPart[];
|
|
11
|
-
//# sourceMappingURL=FormatDateTimeToParts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatDateTimeToParts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/FormatDateTimeToParts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AAEnE,OAAO,EAAC,sBAAsB,EAAC,MAAM,oBAAoB,CAAA;AAEzD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,GAC1D,sBAAsB,EAAE,CAU1B"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PartitionDateTimePattern } from './PartitionDateTimePattern';
|
|
2
|
-
import { ArrayCreate } from '../262';
|
|
3
|
-
/**
|
|
4
|
-
* https://tc39.es/ecma402/#sec-formatdatetimetoparts
|
|
5
|
-
*
|
|
6
|
-
* @param dtf
|
|
7
|
-
* @param x
|
|
8
|
-
* @param implDetails
|
|
9
|
-
*/
|
|
10
|
-
export function FormatDateTimeToParts(dtf, x, implDetails) {
|
|
11
|
-
var parts = PartitionDateTimePattern(dtf, x, implDetails);
|
|
12
|
-
var result = ArrayCreate(0);
|
|
13
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
14
|
-
var part = parts_1[_i];
|
|
15
|
-
result.push({
|
|
16
|
-
type: part.type,
|
|
17
|
-
value: part.value,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DateTimeFormatOptions, IntlDateTimeFormatInternal, DateTimeFormatLocaleInternalData } from '../types/date-time';
|
|
2
|
-
/**
|
|
3
|
-
* https://tc39.es/ecma402/#sec-initializedatetimeformat
|
|
4
|
-
* @param dtf DateTimeFormat
|
|
5
|
-
* @param locales locales
|
|
6
|
-
* @param opts options
|
|
7
|
-
*/
|
|
8
|
-
export declare function InitializeDateTimeFormat(dtf: Intl.DateTimeFormat, locales: string | string[] | undefined, opts: DateTimeFormatOptions | undefined, { getInternalSlots, availableLocales, localeData, getDefaultLocale, getDefaultTimeZone, relevantExtensionKeys, tzData, uppercaseLinks, }: {
|
|
9
|
-
getInternalSlots(dtf: Intl.DateTimeFormat): IntlDateTimeFormatInternal;
|
|
10
|
-
availableLocales: Set<string>;
|
|
11
|
-
getDefaultLocale(): string;
|
|
12
|
-
getDefaultTimeZone(): string;
|
|
13
|
-
relevantExtensionKeys: string[];
|
|
14
|
-
localeData: Record<string, DateTimeFormatLocaleInternalData | undefined>;
|
|
15
|
-
tzData: Record<string, unknown>;
|
|
16
|
-
uppercaseLinks: Record<string, string>;
|
|
17
|
-
}): Intl.DateTimeFormat;
|
|
18
|
-
//# sourceMappingURL=InitializeDateTimeFormat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitializeDateTimeFormat.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/InitializeDateTimeFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAErB,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,oBAAoB,CAAA;AAwD3B;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,IAAI,EAAE,qBAAqB,GAAG,SAAS,EACvC,EACE,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,MAAM,EACN,cAAc,GACf,EAAE;IACD,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,0BAA0B,CAAA;IACtE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,gBAAgB,IAAI,MAAM,CAAA;IAC1B,kBAAkB,IAAI,MAAM,CAAA;IAC5B,qBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gCAAgC,GAAG,SAAS,CAAC,CAAA;IACxE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,GACA,IAAI,CAAC,cAAc,CAoPrB"}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList';
|
|
2
|
-
import { ToDateTimeOptions } from './ToDateTimeOptions';
|
|
3
|
-
import { GetOption } from '../GetOption';
|
|
4
|
-
import { ResolveLocale } from '../ResolveLocale';
|
|
5
|
-
import { IsValidTimeZoneName } from '../IsValidTimeZoneName';
|
|
6
|
-
import { CanonicalizeTimeZoneName } from '../CanonicalizeTimeZoneName';
|
|
7
|
-
import { BasicFormatMatcher } from './BasicFormatMatcher';
|
|
8
|
-
import { BestFitFormatMatcher } from './BestFitFormatMatcher';
|
|
9
|
-
import { invariant } from '../utils';
|
|
10
|
-
import { DATE_TIME_PROPS } from './utils';
|
|
11
|
-
import { DateTimeStyleFormat } from './DateTimeStyleFormat';
|
|
12
|
-
import { GetNumberOption } from '../GetNumberOption';
|
|
13
|
-
function isTimeRelated(opt) {
|
|
14
|
-
for (var _i = 0, _a = ['hour', 'minute', 'second']; _i < _a.length; _i++) {
|
|
15
|
-
var prop = _a[_i];
|
|
16
|
-
var value = opt[prop];
|
|
17
|
-
if (value !== undefined) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
function resolveHourCycle(hc, hcDefault, hour12) {
|
|
24
|
-
if (hc == null) {
|
|
25
|
-
hc = hcDefault;
|
|
26
|
-
}
|
|
27
|
-
if (hour12 !== undefined) {
|
|
28
|
-
if (hour12) {
|
|
29
|
-
if (hcDefault === 'h11' || hcDefault === 'h23') {
|
|
30
|
-
hc = 'h11';
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
hc = 'h12';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
invariant(!hour12, 'hour12 must not be set');
|
|
38
|
-
if (hcDefault === 'h11' || hcDefault === 'h23') {
|
|
39
|
-
hc = 'h23';
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
hc = 'h24';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return hc;
|
|
47
|
-
}
|
|
48
|
-
var TYPE_REGEX = /^[a-z0-9]{3,8}$/i;
|
|
49
|
-
/**
|
|
50
|
-
* https://tc39.es/ecma402/#sec-initializedatetimeformat
|
|
51
|
-
* @param dtf DateTimeFormat
|
|
52
|
-
* @param locales locales
|
|
53
|
-
* @param opts options
|
|
54
|
-
*/
|
|
55
|
-
export function InitializeDateTimeFormat(dtf, locales, opts, _a) {
|
|
56
|
-
var getInternalSlots = _a.getInternalSlots, availableLocales = _a.availableLocales, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getDefaultTimeZone = _a.getDefaultTimeZone, relevantExtensionKeys = _a.relevantExtensionKeys, tzData = _a.tzData, uppercaseLinks = _a.uppercaseLinks;
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
59
|
-
var options = ToDateTimeOptions(opts, 'any', 'date');
|
|
60
|
-
var opt = Object.create(null);
|
|
61
|
-
var matcher = GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
|
62
|
-
opt.localeMatcher = matcher;
|
|
63
|
-
var calendar = GetOption(options, 'calendar', 'string', undefined, undefined);
|
|
64
|
-
if (calendar !== undefined && !TYPE_REGEX.test(calendar)) {
|
|
65
|
-
throw new RangeError('Malformed calendar');
|
|
66
|
-
}
|
|
67
|
-
var internalSlots = getInternalSlots(dtf);
|
|
68
|
-
opt.ca = calendar;
|
|
69
|
-
var numberingSystem = GetOption(options, 'numberingSystem', 'string', undefined, undefined);
|
|
70
|
-
if (numberingSystem !== undefined && !TYPE_REGEX.test(numberingSystem)) {
|
|
71
|
-
throw new RangeError('Malformed numbering system');
|
|
72
|
-
}
|
|
73
|
-
opt.nu = numberingSystem;
|
|
74
|
-
var hour12 = GetOption(options, 'hour12', 'boolean', undefined, undefined);
|
|
75
|
-
var hourCycle = GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
|
|
76
|
-
if (hour12 !== undefined) {
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
hourCycle = null;
|
|
79
|
-
}
|
|
80
|
-
opt.hc = hourCycle;
|
|
81
|
-
var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
82
|
-
internalSlots.locale = r.locale;
|
|
83
|
-
calendar = r.ca;
|
|
84
|
-
internalSlots.calendar = calendar;
|
|
85
|
-
internalSlots.hourCycle = r.hc;
|
|
86
|
-
internalSlots.numberingSystem = r.nu;
|
|
87
|
-
var dataLocale = r.dataLocale;
|
|
88
|
-
internalSlots.dataLocale = dataLocale;
|
|
89
|
-
var timeZone = options.timeZone;
|
|
90
|
-
if (timeZone !== undefined) {
|
|
91
|
-
timeZone = String(timeZone);
|
|
92
|
-
if (!IsValidTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks })) {
|
|
93
|
-
throw new RangeError('Invalid timeZoneName');
|
|
94
|
-
}
|
|
95
|
-
timeZone = CanonicalizeTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks });
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
timeZone = getDefaultTimeZone();
|
|
99
|
-
}
|
|
100
|
-
internalSlots.timeZone = timeZone;
|
|
101
|
-
opt = Object.create(null);
|
|
102
|
-
opt.weekday = GetOption(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);
|
|
103
|
-
opt.era = GetOption(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);
|
|
104
|
-
opt.year = GetOption(options, 'year', 'string', ['2-digit', 'numeric'], undefined);
|
|
105
|
-
opt.month = GetOption(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);
|
|
106
|
-
opt.day = GetOption(options, 'day', 'string', ['2-digit', 'numeric'], undefined);
|
|
107
|
-
opt.hour = GetOption(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);
|
|
108
|
-
opt.minute = GetOption(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);
|
|
109
|
-
opt.second = GetOption(options, 'second', 'string', ['2-digit', 'numeric'], undefined);
|
|
110
|
-
opt.timeZoneName = GetOption(options, 'timeZoneName', 'string', ['short', 'long'], undefined);
|
|
111
|
-
opt.fractionalSecondDigits = GetNumberOption(options, 'fractionalSecondDigits', 1, 3,
|
|
112
|
-
// @ts-expect-error
|
|
113
|
-
undefined);
|
|
114
|
-
var dataLocaleData = localeData[dataLocale];
|
|
115
|
-
invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
|
|
116
|
-
var formats = dataLocaleData.formats[calendar];
|
|
117
|
-
// UNSPECCED: IMPLEMENTATION DETAILS
|
|
118
|
-
if (!formats) {
|
|
119
|
-
throw new RangeError("Calendar \"" + calendar + "\" is not supported. Try setting \"calendar\" to 1 of the following: " + Object.keys(dataLocaleData.formats).join(', '));
|
|
120
|
-
}
|
|
121
|
-
var formatMatcher = GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
|
|
122
|
-
var dateStyle = GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
123
|
-
internalSlots.dateStyle = dateStyle;
|
|
124
|
-
var timeStyle = GetOption(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
125
|
-
internalSlots.timeStyle = timeStyle;
|
|
126
|
-
var bestFormat;
|
|
127
|
-
if (dateStyle === undefined && timeStyle === undefined) {
|
|
128
|
-
if (formatMatcher === 'basic') {
|
|
129
|
-
bestFormat = BasicFormatMatcher(opt, formats);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// IMPL DETAILS START
|
|
133
|
-
if (isTimeRelated(opt)) {
|
|
134
|
-
var hc = resolveHourCycle(internalSlots.hourCycle, dataLocaleData.hourCycle, hour12);
|
|
135
|
-
opt.hour12 = hc === 'h11' || hc === 'h12';
|
|
136
|
-
}
|
|
137
|
-
// IMPL DETAILS END
|
|
138
|
-
bestFormat = BestFitFormatMatcher(opt, formats);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
for (var _i = 0, DATE_TIME_PROPS_1 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
|
|
143
|
-
var prop = DATE_TIME_PROPS_1[_i];
|
|
144
|
-
var p = opt[prop];
|
|
145
|
-
if (p !== undefined) {
|
|
146
|
-
throw new TypeError("Intl.DateTimeFormat can't set option " + prop + " when " + (dateStyle ? 'dateStyle' : 'timeStyle') + " is used");
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
bestFormat = DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
|
|
150
|
-
}
|
|
151
|
-
// IMPL DETAIL START
|
|
152
|
-
// For debugging
|
|
153
|
-
internalSlots.format = bestFormat;
|
|
154
|
-
// IMPL DETAIL END
|
|
155
|
-
for (var prop in opt) {
|
|
156
|
-
var p = bestFormat[prop];
|
|
157
|
-
if (p !== undefined) {
|
|
158
|
-
internalSlots[prop] = p;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
var pattern;
|
|
162
|
-
var rangePatterns;
|
|
163
|
-
if (internalSlots.hour !== undefined) {
|
|
164
|
-
var hc = resolveHourCycle(internalSlots.hourCycle, dataLocaleData.hourCycle, hour12);
|
|
165
|
-
internalSlots.hourCycle = hc;
|
|
166
|
-
if (hc === 'h11' || hc === 'h12') {
|
|
167
|
-
pattern = bestFormat.pattern12;
|
|
168
|
-
rangePatterns = bestFormat.rangePatterns12;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
pattern = bestFormat.pattern;
|
|
172
|
-
rangePatterns = bestFormat.rangePatterns;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
internalSlots.hourCycle = undefined;
|
|
178
|
-
pattern = bestFormat.pattern;
|
|
179
|
-
rangePatterns = bestFormat.rangePatterns;
|
|
180
|
-
}
|
|
181
|
-
internalSlots.pattern = pattern;
|
|
182
|
-
internalSlots.rangePatterns = rangePatterns;
|
|
183
|
-
return dtf;
|
|
184
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ToLocalTimeImplDetails } from './ToLocalTime';
|
|
2
|
-
import { FormatDateTimePatternImplDetails } from './FormatDateTimePattern';
|
|
3
|
-
import { IntlDateTimeFormatPart } from '../types/date-time';
|
|
4
|
-
/**
|
|
5
|
-
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
|
|
6
|
-
* @param dtf
|
|
7
|
-
* @param x
|
|
8
|
-
*/
|
|
9
|
-
export declare function PartitionDateTimePattern(dtf: Intl.DateTimeFormat, x: number, implDetails: ToLocalTimeImplDetails & FormatDateTimePatternImplDetails): IntlDateTimeFormatPart[];
|
|
10
|
-
//# sourceMappingURL=PartitionDateTimePattern.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionDateTimePattern.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/PartitionDateTimePattern.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAA;AACpD,OAAO,EAEL,gCAAgC,EACjC,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EACL,sBAAsB,EAEvB,MAAM,oBAAoB,CAAA;AAE3B;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,sBAAsB,GAAG,gCAAgC,GACrE,sBAAsB,EAAE,CAkB1B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TimeClip } from '../262';
|
|
2
|
-
import { FormatDateTimePattern, } from './FormatDateTimePattern';
|
|
3
|
-
import { PartitionPattern } from '../PartitionPattern';
|
|
4
|
-
/**
|
|
5
|
-
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
|
|
6
|
-
* @param dtf
|
|
7
|
-
* @param x
|
|
8
|
-
*/
|
|
9
|
-
export function PartitionDateTimePattern(dtf, x, implDetails) {
|
|
10
|
-
x = TimeClip(x);
|
|
11
|
-
if (isNaN(x)) {
|
|
12
|
-
throw new RangeError('invalid time');
|
|
13
|
-
}
|
|
14
|
-
/** IMPL START */
|
|
15
|
-
var getInternalSlots = implDetails.getInternalSlots;
|
|
16
|
-
var internalSlots = getInternalSlots(dtf);
|
|
17
|
-
/** IMPL END */
|
|
18
|
-
var pattern = internalSlots.pattern;
|
|
19
|
-
return FormatDateTimePattern(dtf, PartitionPattern(pattern), x, implDetails);
|
|
20
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IntlDateTimeFormatPart } from '../types/date-time';
|
|
2
|
-
import { ToLocalTimeImplDetails } from './ToLocalTime';
|
|
3
|
-
import { FormatDateTimePatternImplDetails } from './FormatDateTimePattern';
|
|
4
|
-
export declare function PartitionDateTimeRangePattern(dtf: Intl.DateTimeFormat, x: number, y: number, implDetails: FormatDateTimePatternImplDetails & ToLocalTimeImplDetails): IntlDateTimeFormatPart[];
|
|
5
|
-
//# sourceMappingURL=PartitionDateTimeRangePattern.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionDateTimeRangePattern.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/PartitionDateTimeRangePattern.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAIvB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAc,sBAAsB,EAAC,MAAM,eAAe,CAAA;AACjE,OAAO,EAEL,gCAAgC,EACjC,MAAM,yBAAyB,CAAA;AAehC,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,gCAAgC,GAAG,sBAAsB,4BAsHvE"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { RangePatternType, } from '../types/date-time';
|
|
2
|
-
import { SameValue, TimeClip } from '../262';
|
|
3
|
-
import { ToLocalTime } from './ToLocalTime';
|
|
4
|
-
import { FormatDateTimePattern, } from './FormatDateTimePattern';
|
|
5
|
-
import { PartitionPattern } from '../PartitionPattern';
|
|
6
|
-
var TABLE_2_FIELDS = [
|
|
7
|
-
'era',
|
|
8
|
-
'year',
|
|
9
|
-
'month',
|
|
10
|
-
'day',
|
|
11
|
-
'ampm',
|
|
12
|
-
'hour',
|
|
13
|
-
'minute',
|
|
14
|
-
'second',
|
|
15
|
-
'fractionalSecondDigits',
|
|
16
|
-
];
|
|
17
|
-
export function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
18
|
-
x = TimeClip(x);
|
|
19
|
-
if (isNaN(x)) {
|
|
20
|
-
throw new RangeError('Invalid start time');
|
|
21
|
-
}
|
|
22
|
-
y = TimeClip(y);
|
|
23
|
-
if (isNaN(y)) {
|
|
24
|
-
throw new RangeError('Invalid end time');
|
|
25
|
-
}
|
|
26
|
-
/** IMPL START */
|
|
27
|
-
var getInternalSlots = implDetails.getInternalSlots, tzData = implDetails.tzData;
|
|
28
|
-
var internalSlots = getInternalSlots(dtf);
|
|
29
|
-
/** IMPL END */
|
|
30
|
-
var tm1 = ToLocalTime(x,
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
33
|
-
var tm2 = ToLocalTime(y,
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
36
|
-
var pattern = internalSlots.pattern, rangePatterns = internalSlots.rangePatterns;
|
|
37
|
-
var rangePattern;
|
|
38
|
-
var dateFieldsPracticallyEqual = true;
|
|
39
|
-
var patternContainsLargerDateField = false;
|
|
40
|
-
for (var _i = 0, TABLE_2_FIELDS_1 = TABLE_2_FIELDS; _i < TABLE_2_FIELDS_1.length; _i++) {
|
|
41
|
-
var fieldName = TABLE_2_FIELDS_1[_i];
|
|
42
|
-
if (dateFieldsPracticallyEqual && !patternContainsLargerDateField) {
|
|
43
|
-
if (fieldName === 'ampm') {
|
|
44
|
-
var rp = rangePatterns.ampm;
|
|
45
|
-
if (rangePattern !== undefined && rp === undefined) {
|
|
46
|
-
patternContainsLargerDateField = true;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
var v1 = tm1.hour;
|
|
50
|
-
var v2 = tm2.hour;
|
|
51
|
-
if ((v1 > 11 && v2 < 11) || (v1 < 11 && v2 > 11)) {
|
|
52
|
-
dateFieldsPracticallyEqual = false;
|
|
53
|
-
}
|
|
54
|
-
rangePattern = rp;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (fieldName === 'fractionalSecondDigits') {
|
|
58
|
-
var fractionalSecondDigits = internalSlots.fractionalSecondDigits;
|
|
59
|
-
if (fractionalSecondDigits === undefined) {
|
|
60
|
-
fractionalSecondDigits = 3;
|
|
61
|
-
}
|
|
62
|
-
var v1 = Math.floor(tm1.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));
|
|
63
|
-
var v2 = Math.floor(tm2.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));
|
|
64
|
-
if (v1 !== v2) {
|
|
65
|
-
dateFieldsPracticallyEqual = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
var rp = rangePatterns[fieldName];
|
|
70
|
-
if (rangePattern !== undefined && rp === undefined) {
|
|
71
|
-
patternContainsLargerDateField = true;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
var v1 = tm1[fieldName];
|
|
75
|
-
var v2 = tm2[fieldName];
|
|
76
|
-
if (!SameValue(v1, v2)) {
|
|
77
|
-
dateFieldsPracticallyEqual = false;
|
|
78
|
-
}
|
|
79
|
-
rangePattern = rp;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (dateFieldsPracticallyEqual) {
|
|
85
|
-
var result_2 = FormatDateTimePattern(dtf, PartitionPattern(pattern), x, implDetails);
|
|
86
|
-
for (var _a = 0, result_1 = result_2; _a < result_1.length; _a++) {
|
|
87
|
-
var r = result_1[_a];
|
|
88
|
-
r.source = RangePatternType.shared;
|
|
89
|
-
}
|
|
90
|
-
return result_2;
|
|
91
|
-
}
|
|
92
|
-
var result = [];
|
|
93
|
-
if (rangePattern === undefined) {
|
|
94
|
-
rangePattern = rangePatterns.default;
|
|
95
|
-
/** IMPL DETAILS */
|
|
96
|
-
// Now we have to replace {0} & {1} with actual pattern
|
|
97
|
-
for (var _b = 0, _c = rangePattern.patternParts; _b < _c.length; _b++) {
|
|
98
|
-
var patternPart = _c[_b];
|
|
99
|
-
if (patternPart.pattern === '{0}' || patternPart.pattern === '{1}') {
|
|
100
|
-
patternPart.pattern = pattern;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
for (var _d = 0, _e = rangePattern.patternParts; _d < _e.length; _d++) {
|
|
105
|
-
var rangePatternPart = _e[_d];
|
|
106
|
-
var source = rangePatternPart.source, pattern_1 = rangePatternPart.pattern;
|
|
107
|
-
var z = void 0;
|
|
108
|
-
if (source === RangePatternType.startRange ||
|
|
109
|
-
source === RangePatternType.shared) {
|
|
110
|
-
z = x;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
z = y;
|
|
114
|
-
}
|
|
115
|
-
var patternParts = PartitionPattern(pattern_1);
|
|
116
|
-
var partResult = FormatDateTimePattern(dtf, patternParts, z, implDetails);
|
|
117
|
-
for (var _f = 0, partResult_1 = partResult; _f < partResult_1.length; _f++) {
|
|
118
|
-
var r = partResult_1[_f];
|
|
119
|
-
r.source = source;
|
|
120
|
-
}
|
|
121
|
-
result = result.concat(partResult);
|
|
122
|
-
}
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DateTimeFormatOptions } from '../types/date-time';
|
|
2
|
-
/**
|
|
3
|
-
* https://tc39.es/ecma402/#sec-todatetimeoptions
|
|
4
|
-
* @param options
|
|
5
|
-
* @param required
|
|
6
|
-
* @param defaults
|
|
7
|
-
*/
|
|
8
|
-
export declare function ToDateTimeOptions(options?: DateTimeFormatOptions | null, required?: string, defaults?: string): DateTimeFormatOptions;
|
|
9
|
-
//# sourceMappingURL=ToDateTimeOptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToDateTimeOptions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/ToDateTimeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAGxD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,qBAAqB,GAAG,IAAI,EACtC,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,qBAAqB,CAkEvB"}
|