@formatjs/intl-datetimeformat 4.2.3 → 4.3.0
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/index.js +1 -1
- package/lib/should-polyfill.d.ts +1 -1
- package/lib/should-polyfill.d.ts.map +1 -1
- package/lib/should-polyfill.js +7 -2
- package/lib/src/abstract/FormatDateTimePattern.js +1 -1
- package/lib/src/abstract/InitializeDateTimeFormat.js +3 -3
- package/lib/src/abstract/skeleton.js +1 -1
- package/lib/src/core.js +1 -1
- package/lib/src/packer.js +2 -2
- package/lib/supported-locales.d.ts +2 -0
- package/lib/supported-locales.d.ts.map +1 -0
- package/lib/supported-locales.js +2 -0
- package/package.json +3 -3
- package/polyfill-force.js +7 -7
- package/polyfill.iife.js +82 -71
- package/polyfill.js +8 -8
- package/should-polyfill.d.ts +1 -1
- package/should-polyfill.d.ts.map +1 -1
- package/should-polyfill.js +7 -2
- package/src/abstract/BasicFormatMatcher.js +2 -2
- package/src/abstract/BestFitFormatMatcher.js +3 -3
- package/src/abstract/DateTimeStyleFormat.js +3 -3
- package/src/abstract/FormatDateTime.js +1 -1
- package/src/abstract/FormatDateTimePattern.js +3 -3
- package/src/abstract/FormatDateTimeRange.js +1 -1
- package/src/abstract/FormatDateTimeRangeToParts.js +1 -1
- package/src/abstract/FormatDateTimeToParts.js +2 -2
- package/src/abstract/InitializeDateTimeFormat.js +30 -30
- package/src/abstract/PartitionDateTimePattern.js +2 -2
- package/src/abstract/PartitionDateTimeRangePattern.js +9 -9
- package/src/abstract/ToDateTimeOptions.js +1 -1
- package/src/abstract/ToLocalTime.js +10 -10
- package/src/abstract/skeleton.js +3 -3
- package/src/core.js +43 -43
- package/src/packer.js +3 -3
- package/src/to_locale_string.js +2 -2
- package/supported-locales.d.ts +2 -0
- package/supported-locales.d.ts.map +1 -0
- package/supported-locales.js +5 -0
- package/test262-main.js +1 -1
|
@@ -6,7 +6,7 @@ var utils_1 = require("./utils");
|
|
|
6
6
|
var ToLocalTime_1 = require("./ToLocalTime");
|
|
7
7
|
function pad(n) {
|
|
8
8
|
if (n < 10) {
|
|
9
|
-
return "0"
|
|
9
|
+
return "0".concat(n);
|
|
10
10
|
}
|
|
11
11
|
return String(n);
|
|
12
12
|
}
|
|
@@ -39,7 +39,7 @@ function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
|
|
|
39
39
|
*/
|
|
40
40
|
function FormatDateTimePattern(dtf, patternParts, x, _a) {
|
|
41
41
|
var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;
|
|
42
|
-
x = ecma402_abstract_1.TimeClip(x);
|
|
42
|
+
x = (0, ecma402_abstract_1.TimeClip)(x);
|
|
43
43
|
/** IMPL START */
|
|
44
44
|
var internalSlots = getInternalSlots(dtf);
|
|
45
45
|
var dataLocale = internalSlots.dataLocale;
|
|
@@ -61,7 +61,7 @@ function FormatDateTimePattern(dtf, patternParts, x, _a) {
|
|
|
61
61
|
nf3Options.useGrouping = false;
|
|
62
62
|
nf3 = new Intl.NumberFormat(locale, nf3Options);
|
|
63
63
|
}
|
|
64
|
-
var tm = ToLocalTime_1.ToLocalTime(x,
|
|
64
|
+
var tm = (0, ToLocalTime_1.ToLocalTime)(x,
|
|
65
65
|
// @ts-ignore
|
|
66
66
|
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
67
67
|
var result = [];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FormatDateTimeRange = void 0;
|
|
4
4
|
var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
|
|
5
5
|
function FormatDateTimeRange(dtf, x, y, implDetails) {
|
|
6
|
-
var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
6
|
+
var parts = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
|
|
7
7
|
var result = '';
|
|
8
8
|
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
9
9
|
var part = parts_1[_i];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FormatDateTimeRangeToParts = void 0;
|
|
4
4
|
var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
|
|
5
5
|
function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
|
|
6
|
-
var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
6
|
+
var parts = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
|
|
7
7
|
var result = new Array(0);
|
|
8
8
|
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
9
9
|
var part = parts_1[_i];
|
|
@@ -11,8 +11,8 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
|
11
11
|
* @param implDetails
|
|
12
12
|
*/
|
|
13
13
|
function FormatDateTimeToParts(dtf, x, implDetails) {
|
|
14
|
-
var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);
|
|
15
|
-
var result = ecma402_abstract_1.ArrayCreate(0);
|
|
14
|
+
var parts = (0, PartitionDateTimePattern_1.PartitionDateTimePattern)(dtf, x, implDetails);
|
|
15
|
+
var result = (0, ecma402_abstract_1.ArrayCreate)(0);
|
|
16
16
|
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
17
17
|
var part = parts_1[_i];
|
|
18
18
|
result.push({
|
|
@@ -32,7 +32,7 @@ function resolveHourCycle(hc, hcDefault, hour12) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
ecma402_abstract_1.invariant(!hour12, 'hour12 must not be set');
|
|
35
|
+
(0, ecma402_abstract_1.invariant)(!hour12, 'hour12 must not be set');
|
|
36
36
|
if (hcDefault === 'h11' || hcDefault === 'h23') {
|
|
37
37
|
hc = 'h23';
|
|
38
38
|
}
|
|
@@ -53,30 +53,30 @@ var TYPE_REGEX = /^[a-z0-9]{3,8}$/i;
|
|
|
53
53
|
function InitializeDateTimeFormat(dtf, locales, opts, _a) {
|
|
54
54
|
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;
|
|
55
55
|
// @ts-ignore
|
|
56
|
-
var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);
|
|
57
|
-
var options = ToDateTimeOptions_1.ToDateTimeOptions(opts, 'any', 'date');
|
|
56
|
+
var requestedLocales = (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales);
|
|
57
|
+
var options = (0, ToDateTimeOptions_1.ToDateTimeOptions)(opts, 'any', 'date');
|
|
58
58
|
var opt = Object.create(null);
|
|
59
|
-
var matcher = ecma402_abstract_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
|
59
|
+
var matcher = (0, ecma402_abstract_1.GetOption)(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
|
|
60
60
|
opt.localeMatcher = matcher;
|
|
61
|
-
var calendar = ecma402_abstract_1.GetOption(options, 'calendar', 'string', undefined, undefined);
|
|
61
|
+
var calendar = (0, ecma402_abstract_1.GetOption)(options, 'calendar', 'string', undefined, undefined);
|
|
62
62
|
if (calendar !== undefined && !TYPE_REGEX.test(calendar)) {
|
|
63
63
|
throw new RangeError('Malformed calendar');
|
|
64
64
|
}
|
|
65
65
|
var internalSlots = getInternalSlots(dtf);
|
|
66
66
|
opt.ca = calendar;
|
|
67
|
-
var numberingSystem = ecma402_abstract_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
|
|
67
|
+
var numberingSystem = (0, ecma402_abstract_1.GetOption)(options, 'numberingSystem', 'string', undefined, undefined);
|
|
68
68
|
if (numberingSystem !== undefined && !TYPE_REGEX.test(numberingSystem)) {
|
|
69
69
|
throw new RangeError('Malformed numbering system');
|
|
70
70
|
}
|
|
71
71
|
opt.nu = numberingSystem;
|
|
72
|
-
var hour12 = ecma402_abstract_1.GetOption(options, 'hour12', 'boolean', undefined, undefined);
|
|
73
|
-
var hourCycle = ecma402_abstract_1.GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
|
|
72
|
+
var hour12 = (0, ecma402_abstract_1.GetOption)(options, 'hour12', 'boolean', undefined, undefined);
|
|
73
|
+
var hourCycle = (0, ecma402_abstract_1.GetOption)(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
|
|
74
74
|
if (hour12 !== undefined) {
|
|
75
75
|
// @ts-ignore
|
|
76
76
|
hourCycle = null;
|
|
77
77
|
}
|
|
78
78
|
opt.hc = hourCycle;
|
|
79
|
-
var r = intl_localematcher_1.ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
79
|
+
var r = (0, intl_localematcher_1.ResolveLocale)(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
80
80
|
internalSlots.locale = r.locale;
|
|
81
81
|
calendar = r.ca;
|
|
82
82
|
internalSlots.calendar = calendar;
|
|
@@ -87,44 +87,44 @@ function InitializeDateTimeFormat(dtf, locales, opts, _a) {
|
|
|
87
87
|
var timeZone = options.timeZone;
|
|
88
88
|
if (timeZone !== undefined) {
|
|
89
89
|
timeZone = String(timeZone);
|
|
90
|
-
if (!ecma402_abstract_1.IsValidTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks })) {
|
|
90
|
+
if (!(0, ecma402_abstract_1.IsValidTimeZoneName)(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks })) {
|
|
91
91
|
throw new RangeError('Invalid timeZoneName');
|
|
92
92
|
}
|
|
93
|
-
timeZone = ecma402_abstract_1.CanonicalizeTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks });
|
|
93
|
+
timeZone = (0, ecma402_abstract_1.CanonicalizeTimeZoneName)(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks });
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
96
|
timeZone = getDefaultTimeZone();
|
|
97
97
|
}
|
|
98
98
|
internalSlots.timeZone = timeZone;
|
|
99
99
|
opt = Object.create(null);
|
|
100
|
-
opt.weekday = ecma402_abstract_1.GetOption(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);
|
|
101
|
-
opt.era = ecma402_abstract_1.GetOption(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);
|
|
102
|
-
opt.year = ecma402_abstract_1.GetOption(options, 'year', 'string', ['2-digit', 'numeric'], undefined);
|
|
103
|
-
opt.month = ecma402_abstract_1.GetOption(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);
|
|
104
|
-
opt.day = ecma402_abstract_1.GetOption(options, 'day', 'string', ['2-digit', 'numeric'], undefined);
|
|
105
|
-
opt.hour = ecma402_abstract_1.GetOption(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);
|
|
106
|
-
opt.minute = ecma402_abstract_1.GetOption(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);
|
|
107
|
-
opt.second = ecma402_abstract_1.GetOption(options, 'second', 'string', ['2-digit', 'numeric'], undefined);
|
|
108
|
-
opt.timeZoneName = ecma402_abstract_1.GetOption(options, 'timeZoneName', 'string', ['short', 'long'], undefined);
|
|
109
|
-
opt.fractionalSecondDigits = ecma402_abstract_1.GetNumberOption(options, 'fractionalSecondDigits', 1, 3,
|
|
100
|
+
opt.weekday = (0, ecma402_abstract_1.GetOption)(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);
|
|
101
|
+
opt.era = (0, ecma402_abstract_1.GetOption)(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);
|
|
102
|
+
opt.year = (0, ecma402_abstract_1.GetOption)(options, 'year', 'string', ['2-digit', 'numeric'], undefined);
|
|
103
|
+
opt.month = (0, ecma402_abstract_1.GetOption)(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);
|
|
104
|
+
opt.day = (0, ecma402_abstract_1.GetOption)(options, 'day', 'string', ['2-digit', 'numeric'], undefined);
|
|
105
|
+
opt.hour = (0, ecma402_abstract_1.GetOption)(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);
|
|
106
|
+
opt.minute = (0, ecma402_abstract_1.GetOption)(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);
|
|
107
|
+
opt.second = (0, ecma402_abstract_1.GetOption)(options, 'second', 'string', ['2-digit', 'numeric'], undefined);
|
|
108
|
+
opt.timeZoneName = (0, ecma402_abstract_1.GetOption)(options, 'timeZoneName', 'string', ['short', 'long'], undefined);
|
|
109
|
+
opt.fractionalSecondDigits = (0, ecma402_abstract_1.GetNumberOption)(options, 'fractionalSecondDigits', 1, 3,
|
|
110
110
|
// @ts-expect-error
|
|
111
111
|
undefined);
|
|
112
112
|
var dataLocaleData = localeData[dataLocale];
|
|
113
|
-
ecma402_abstract_1.invariant(!!dataLocaleData, "Missing locale data for "
|
|
113
|
+
(0, ecma402_abstract_1.invariant)(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
|
|
114
114
|
var formats = dataLocaleData.formats[calendar];
|
|
115
115
|
// UNSPECCED: IMPLEMENTATION DETAILS
|
|
116
116
|
if (!formats) {
|
|
117
|
-
throw new RangeError("Calendar \""
|
|
117
|
+
throw new RangeError("Calendar \"".concat(calendar, "\" is not supported. Try setting \"calendar\" to 1 of the following: ").concat(Object.keys(dataLocaleData.formats).join(', ')));
|
|
118
118
|
}
|
|
119
|
-
var formatMatcher = ecma402_abstract_1.GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
|
|
120
|
-
var dateStyle = ecma402_abstract_1.GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
119
|
+
var formatMatcher = (0, ecma402_abstract_1.GetOption)(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
|
|
120
|
+
var dateStyle = (0, ecma402_abstract_1.GetOption)(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
121
121
|
internalSlots.dateStyle = dateStyle;
|
|
122
|
-
var timeStyle = ecma402_abstract_1.GetOption(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
122
|
+
var timeStyle = (0, ecma402_abstract_1.GetOption)(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
|
|
123
123
|
internalSlots.timeStyle = timeStyle;
|
|
124
124
|
var bestFormat;
|
|
125
125
|
if (dateStyle === undefined && timeStyle === undefined) {
|
|
126
126
|
if (formatMatcher === 'basic') {
|
|
127
|
-
bestFormat = BasicFormatMatcher_1.BasicFormatMatcher(opt, formats);
|
|
127
|
+
bestFormat = (0, BasicFormatMatcher_1.BasicFormatMatcher)(opt, formats);
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
130
|
// IMPL DETAILS START
|
|
@@ -133,7 +133,7 @@ function InitializeDateTimeFormat(dtf, locales, opts, _a) {
|
|
|
133
133
|
opt.hour12 = hc === 'h11' || hc === 'h12';
|
|
134
134
|
}
|
|
135
135
|
// IMPL DETAILS END
|
|
136
|
-
bestFormat = BestFitFormatMatcher_1.BestFitFormatMatcher(opt, formats);
|
|
136
|
+
bestFormat = (0, BestFitFormatMatcher_1.BestFitFormatMatcher)(opt, formats);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
@@ -141,10 +141,10 @@ function InitializeDateTimeFormat(dtf, locales, opts, _a) {
|
|
|
141
141
|
var prop = DATE_TIME_PROPS_1[_i];
|
|
142
142
|
var p = opt[prop];
|
|
143
143
|
if (p !== undefined) {
|
|
144
|
-
throw new TypeError("Intl.DateTimeFormat can't set option "
|
|
144
|
+
throw new TypeError("Intl.DateTimeFormat can't set option ".concat(prop, " when ").concat(dateStyle ? 'dateStyle' : 'timeStyle', " is used"));
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
bestFormat = DateTimeStyleFormat_1.DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
|
|
147
|
+
bestFormat = (0, DateTimeStyleFormat_1.DateTimeStyleFormat)(dateStyle, timeStyle, dataLocaleData);
|
|
148
148
|
}
|
|
149
149
|
// IMPL DETAIL START
|
|
150
150
|
// For debugging
|
|
@@ -9,7 +9,7 @@ var FormatDateTimePattern_1 = require("./FormatDateTimePattern");
|
|
|
9
9
|
* @param x
|
|
10
10
|
*/
|
|
11
11
|
function PartitionDateTimePattern(dtf, x, implDetails) {
|
|
12
|
-
x = ecma402_abstract_1.TimeClip(x);
|
|
12
|
+
x = (0, ecma402_abstract_1.TimeClip)(x);
|
|
13
13
|
if (isNaN(x)) {
|
|
14
14
|
throw new RangeError('invalid time');
|
|
15
15
|
}
|
|
@@ -18,6 +18,6 @@ function PartitionDateTimePattern(dtf, x, implDetails) {
|
|
|
18
18
|
var internalSlots = getInternalSlots(dtf);
|
|
19
19
|
/** IMPL END */
|
|
20
20
|
var pattern = internalSlots.pattern;
|
|
21
|
-
return FormatDateTimePattern_1.FormatDateTimePattern(dtf, ecma402_abstract_1.PartitionPattern(pattern), x, implDetails);
|
|
21
|
+
return (0, FormatDateTimePattern_1.FormatDateTimePattern)(dtf, (0, ecma402_abstract_1.PartitionPattern)(pattern), x, implDetails);
|
|
22
22
|
}
|
|
23
23
|
exports.PartitionDateTimePattern = PartitionDateTimePattern;
|
|
@@ -17,11 +17,11 @@ var TABLE_2_FIELDS = [
|
|
|
17
17
|
'fractionalSecondDigits',
|
|
18
18
|
];
|
|
19
19
|
function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
20
|
-
x = ecma402_abstract_1.TimeClip(x);
|
|
20
|
+
x = (0, ecma402_abstract_1.TimeClip)(x);
|
|
21
21
|
if (isNaN(x)) {
|
|
22
22
|
throw new RangeError('Invalid start time');
|
|
23
23
|
}
|
|
24
|
-
y = ecma402_abstract_1.TimeClip(y);
|
|
24
|
+
y = (0, ecma402_abstract_1.TimeClip)(y);
|
|
25
25
|
if (isNaN(y)) {
|
|
26
26
|
throw new RangeError('Invalid end time');
|
|
27
27
|
}
|
|
@@ -29,10 +29,10 @@ function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
|
29
29
|
var getInternalSlots = implDetails.getInternalSlots, tzData = implDetails.tzData;
|
|
30
30
|
var internalSlots = getInternalSlots(dtf);
|
|
31
31
|
/** IMPL END */
|
|
32
|
-
var tm1 = ToLocalTime_1.ToLocalTime(x,
|
|
32
|
+
var tm1 = (0, ToLocalTime_1.ToLocalTime)(x,
|
|
33
33
|
// @ts-ignore
|
|
34
34
|
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
35
|
-
var tm2 = ToLocalTime_1.ToLocalTime(y,
|
|
35
|
+
var tm2 = (0, ToLocalTime_1.ToLocalTime)(y,
|
|
36
36
|
// @ts-ignore
|
|
37
37
|
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
38
38
|
var pattern = internalSlots.pattern, rangePatterns = internalSlots.rangePatterns;
|
|
@@ -65,14 +65,14 @@ function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
|
65
65
|
}
|
|
66
66
|
var v1 = Math.floor(tm1.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));
|
|
67
67
|
var v2 = Math.floor(tm2.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));
|
|
68
|
-
if (!ecma402_abstract_1.SameValue(v1, v2)) {
|
|
68
|
+
if (!(0, ecma402_abstract_1.SameValue)(v1, v2)) {
|
|
69
69
|
dateFieldsPracticallyEqual = false;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
var v1 = tm1[fieldName];
|
|
74
74
|
var v2 = tm2[fieldName];
|
|
75
|
-
if (!ecma402_abstract_1.SameValue(v1, v2)) {
|
|
75
|
+
if (!(0, ecma402_abstract_1.SameValue)(v1, v2)) {
|
|
76
76
|
dateFieldsPracticallyEqual = false;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -80,7 +80,7 @@ function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (dateFieldsPracticallyEqual) {
|
|
83
|
-
var result_2 = FormatDateTimePattern_1.FormatDateTimePattern(dtf, ecma402_abstract_1.PartitionPattern(pattern), x, implDetails);
|
|
83
|
+
var result_2 = (0, FormatDateTimePattern_1.FormatDateTimePattern)(dtf, (0, ecma402_abstract_1.PartitionPattern)(pattern), x, implDetails);
|
|
84
84
|
for (var _a = 0, result_1 = result_2; _a < result_1.length; _a++) {
|
|
85
85
|
var r = result_1[_a];
|
|
86
86
|
r.source = ecma402_abstract_1.RangePatternType.shared;
|
|
@@ -110,8 +110,8 @@ function PartitionDateTimeRangePattern(dtf, x, y, implDetails) {
|
|
|
110
110
|
else {
|
|
111
111
|
z = y;
|
|
112
112
|
}
|
|
113
|
-
var patternParts = ecma402_abstract_1.PartitionPattern(pattern_1);
|
|
114
|
-
var partResult = FormatDateTimePattern_1.FormatDateTimePattern(dtf, patternParts, z, implDetails);
|
|
113
|
+
var patternParts = (0, ecma402_abstract_1.PartitionPattern)(pattern_1);
|
|
114
|
+
var partResult = (0, FormatDateTimePattern_1.FormatDateTimePattern)(dtf, patternParts, z, implDetails);
|
|
115
115
|
for (var _f = 0, partResult_1 = partResult; _f < partResult_1.length; _f++) {
|
|
116
116
|
var r = partResult_1[_f];
|
|
117
117
|
r.source = source;
|
|
@@ -13,7 +13,7 @@ function ToDateTimeOptions(options, required, defaults) {
|
|
|
13
13
|
options = null;
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
options = ecma402_abstract_1.ToObject(options);
|
|
16
|
+
options = (0, ecma402_abstract_1.ToObject)(options);
|
|
17
17
|
}
|
|
18
18
|
options = Object.create(options);
|
|
19
19
|
var needDefaults = true;
|
|
@@ -29,23 +29,23 @@ function getApplicableZoneData(t, timeZone, tzData) {
|
|
|
29
29
|
*/
|
|
30
30
|
function ToLocalTime(t, calendar, timeZone, _a) {
|
|
31
31
|
var tzData = _a.tzData;
|
|
32
|
-
ecma402_abstract_1.invariant(ecma402_abstract_1.Type(t) === 'Number', 'invalid time');
|
|
33
|
-
ecma402_abstract_1.invariant(calendar === 'gregory', 'We only support Gregory calendar right now');
|
|
32
|
+
(0, ecma402_abstract_1.invariant)((0, ecma402_abstract_1.Type)(t) === 'Number', 'invalid time');
|
|
33
|
+
(0, ecma402_abstract_1.invariant)(calendar === 'gregory', 'We only support Gregory calendar right now');
|
|
34
34
|
var _b = getApplicableZoneData(t, timeZone, tzData), timeZoneOffset = _b[0], inDST = _b[1];
|
|
35
35
|
var tz = t + timeZoneOffset;
|
|
36
|
-
var year = ecma402_abstract_1.YearFromTime(tz);
|
|
36
|
+
var year = (0, ecma402_abstract_1.YearFromTime)(tz);
|
|
37
37
|
return {
|
|
38
|
-
weekday: ecma402_abstract_1.WeekDay(tz),
|
|
38
|
+
weekday: (0, ecma402_abstract_1.WeekDay)(tz),
|
|
39
39
|
era: year < 0 ? 'BC' : 'AD',
|
|
40
40
|
year: year,
|
|
41
41
|
relatedYear: undefined,
|
|
42
42
|
yearName: undefined,
|
|
43
|
-
month: ecma402_abstract_1.MonthFromTime(tz),
|
|
44
|
-
day: ecma402_abstract_1.DateFromTime(tz),
|
|
45
|
-
hour: ecma402_abstract_1.HourFromTime(tz),
|
|
46
|
-
minute: ecma402_abstract_1.MinFromTime(tz),
|
|
47
|
-
second: ecma402_abstract_1.SecFromTime(tz),
|
|
48
|
-
millisecond: ecma402_abstract_1.msFromTime(tz),
|
|
43
|
+
month: (0, ecma402_abstract_1.MonthFromTime)(tz),
|
|
44
|
+
day: (0, ecma402_abstract_1.DateFromTime)(tz),
|
|
45
|
+
hour: (0, ecma402_abstract_1.HourFromTime)(tz),
|
|
46
|
+
minute: (0, ecma402_abstract_1.MinFromTime)(tz),
|
|
47
|
+
second: (0, ecma402_abstract_1.SecFromTime)(tz),
|
|
48
|
+
millisecond: (0, ecma402_abstract_1.msFromTime)(tz),
|
|
49
49
|
inDST: inDST,
|
|
50
50
|
// IMPORTANT: Not in spec
|
|
51
51
|
timeZoneOffset: timeZoneOffset,
|
package/src/abstract/skeleton.js
CHANGED
|
@@ -175,7 +175,7 @@ function processDateTimePattern(pattern, result) {
|
|
|
175
175
|
// Apostrophe-escaped
|
|
176
176
|
.replace(/'(.*?)'/g, function (_, literal) {
|
|
177
177
|
literals.push(literal);
|
|
178
|
-
return "$$"
|
|
178
|
+
return "$$".concat(literals.length - 1, "$$");
|
|
179
179
|
})
|
|
180
180
|
.replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result || {}); });
|
|
181
181
|
//Restore literals
|
|
@@ -220,8 +220,8 @@ function parseDateTimeSkeleton(skeleton, rawPattern, rangePatterns, intervalForm
|
|
|
220
220
|
patternParts: [],
|
|
221
221
|
};
|
|
222
222
|
var _a = processDateTimePattern(rawPattern_1, intervalResult), pattern_1 = _a[0], pattern12_1 = _a[1];
|
|
223
|
-
result.rangePatterns[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern_1) });
|
|
224
|
-
result.rangePatterns12[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern12_1) });
|
|
223
|
+
result.rangePatterns[key] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, intervalResult), { patternParts: splitRangePattern(pattern_1) });
|
|
224
|
+
result.rangePatterns12[key] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, intervalResult), { patternParts: splitRangePattern(pattern12_1) });
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
if (intervalFormatFallback) {
|
package/src/core.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DateTimeFormat = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
|
-
var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
|
|
7
|
-
var links_1 = tslib_1.__importDefault(require("./data/links"));
|
|
6
|
+
var get_internal_slots_1 = (0, tslib_1.__importDefault)(require("./get_internal_slots"));
|
|
7
|
+
var links_1 = (0, tslib_1.__importDefault)(require("./data/links"));
|
|
8
8
|
var packer_1 = require("./packer");
|
|
9
9
|
var FormatDateTime_1 = require("./abstract/FormatDateTime");
|
|
10
10
|
var InitializeDateTimeFormat_1 = require("./abstract/InitializeDateTimeFormat");
|
|
@@ -40,10 +40,10 @@ var formatDescriptor = {
|
|
|
40
40
|
configurable: true,
|
|
41
41
|
get: function () {
|
|
42
42
|
if (typeof this !== 'object' ||
|
|
43
|
-
!ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {
|
|
43
|
+
!(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.DateTimeFormat, this)) {
|
|
44
44
|
throw TypeError('Intl.DateTimeFormat format property accessor called on incompatible receiver');
|
|
45
45
|
}
|
|
46
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
46
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
48
48
|
var dtf = this;
|
|
49
49
|
var boundFormat = internalSlots.boundFormat;
|
|
@@ -57,7 +57,7 @@ var formatDescriptor = {
|
|
|
57
57
|
else {
|
|
58
58
|
x = Number(date);
|
|
59
59
|
}
|
|
60
|
-
return FormatDateTime_1.FormatDateTime(dtf, x, {
|
|
60
|
+
return (0, FormatDateTime_1.FormatDateTime)(dtf, x, {
|
|
61
61
|
getInternalSlots: get_internal_slots_1.default,
|
|
62
62
|
localeData: exports.DateTimeFormat.localeData,
|
|
63
63
|
tzData: exports.DateTimeFormat.tzData,
|
|
@@ -97,10 +97,10 @@ catch (e) {
|
|
|
97
97
|
}
|
|
98
98
|
exports.DateTimeFormat = function (locales, options) {
|
|
99
99
|
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
100
|
-
if (!this || !ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {
|
|
100
|
+
if (!this || !(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.DateTimeFormat, this)) {
|
|
101
101
|
return new exports.DateTimeFormat(locales, options);
|
|
102
102
|
}
|
|
103
|
-
InitializeDateTimeFormat_1.InitializeDateTimeFormat(this, locales, options, {
|
|
103
|
+
(0, InitializeDateTimeFormat_1.InitializeDateTimeFormat)(this, locales, options, {
|
|
104
104
|
tzData: exports.DateTimeFormat.tzData,
|
|
105
105
|
uppercaseLinks: UPPERCASED_LINKS,
|
|
106
106
|
availableLocales: exports.DateTimeFormat.availableLocales,
|
|
@@ -111,25 +111,25 @@ exports.DateTimeFormat = function (locales, options) {
|
|
|
111
111
|
localeData: exports.DateTimeFormat.localeData,
|
|
112
112
|
});
|
|
113
113
|
/** IMPL START */
|
|
114
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
114
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
115
115
|
var dataLocale = internalSlots.dataLocale;
|
|
116
116
|
var dataLocaleData = exports.DateTimeFormat.localeData[dataLocale];
|
|
117
|
-
ecma402_abstract_1.invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for "
|
|
117
|
+
(0, ecma402_abstract_1.invariant)(dataLocaleData !== undefined, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
|
|
118
118
|
/** IMPL END */
|
|
119
119
|
};
|
|
120
120
|
// Static properties
|
|
121
|
-
ecma402_abstract_1.defineProperty(exports.DateTimeFormat, 'supportedLocalesOf', {
|
|
121
|
+
(0, ecma402_abstract_1.defineProperty)(exports.DateTimeFormat, 'supportedLocalesOf', {
|
|
122
122
|
value: function supportedLocalesOf(locales, options) {
|
|
123
|
-
return ecma402_abstract_1.SupportedLocales(exports.DateTimeFormat.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);
|
|
123
|
+
return (0, ecma402_abstract_1.SupportedLocales)(exports.DateTimeFormat.availableLocales, (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales), options);
|
|
124
124
|
},
|
|
125
125
|
});
|
|
126
|
-
ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'resolvedOptions', {
|
|
126
|
+
(0, ecma402_abstract_1.defineProperty)(exports.DateTimeFormat.prototype, 'resolvedOptions', {
|
|
127
127
|
value: function resolvedOptions() {
|
|
128
128
|
if (typeof this !== 'object' ||
|
|
129
|
-
!ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {
|
|
129
|
+
!(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.DateTimeFormat, this)) {
|
|
130
130
|
throw TypeError('Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver');
|
|
131
131
|
}
|
|
132
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
132
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
133
133
|
var ro = {};
|
|
134
134
|
for (var _i = 0, RESOLVED_OPTIONS_KEYS_1 = RESOLVED_OPTIONS_KEYS; _i < RESOLVED_OPTIONS_KEYS_1.length; _i++) {
|
|
135
135
|
var key = RESOLVED_OPTIONS_KEYS_1[_i];
|
|
@@ -157,15 +157,15 @@ ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'resolvedOpt
|
|
|
157
157
|
return ro;
|
|
158
158
|
},
|
|
159
159
|
});
|
|
160
|
-
ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatToParts', {
|
|
160
|
+
(0, ecma402_abstract_1.defineProperty)(exports.DateTimeFormat.prototype, 'formatToParts', {
|
|
161
161
|
value: function formatToParts(date) {
|
|
162
162
|
if (date === undefined) {
|
|
163
163
|
date = Date.now();
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
166
|
-
date = ecma402_abstract_1.ToNumber(date);
|
|
166
|
+
date = (0, ecma402_abstract_1.ToNumber)(date);
|
|
167
167
|
}
|
|
168
|
-
return FormatDateTimeToParts_1.FormatDateTimeToParts(this, date, {
|
|
168
|
+
return (0, FormatDateTimeToParts_1.FormatDateTimeToParts)(this, date, {
|
|
169
169
|
getInternalSlots: get_internal_slots_1.default,
|
|
170
170
|
localeData: exports.DateTimeFormat.localeData,
|
|
171
171
|
tzData: exports.DateTimeFormat.tzData,
|
|
@@ -173,7 +173,7 @@ ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatToPar
|
|
|
173
173
|
});
|
|
174
174
|
},
|
|
175
175
|
});
|
|
176
|
-
ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRangeToParts', {
|
|
176
|
+
(0, ecma402_abstract_1.defineProperty)(exports.DateTimeFormat.prototype, 'formatRangeToParts', {
|
|
177
177
|
value: function formatRangeToParts(startDate, endDate) {
|
|
178
178
|
var dtf = this;
|
|
179
179
|
if (typeof dtf !== 'object') {
|
|
@@ -182,9 +182,9 @@ ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRange
|
|
|
182
182
|
if (startDate === undefined || endDate === undefined) {
|
|
183
183
|
throw new TypeError('startDate/endDate cannot be undefined');
|
|
184
184
|
}
|
|
185
|
-
var x = ecma402_abstract_1.ToNumber(startDate);
|
|
186
|
-
var y = ecma402_abstract_1.ToNumber(endDate);
|
|
187
|
-
return FormatDateTimeRangeToParts_1.FormatDateTimeRangeToParts(dtf, x, y, {
|
|
185
|
+
var x = (0, ecma402_abstract_1.ToNumber)(startDate);
|
|
186
|
+
var y = (0, ecma402_abstract_1.ToNumber)(endDate);
|
|
187
|
+
return (0, FormatDateTimeRangeToParts_1.FormatDateTimeRangeToParts)(dtf, x, y, {
|
|
188
188
|
getInternalSlots: get_internal_slots_1.default,
|
|
189
189
|
localeData: exports.DateTimeFormat.localeData,
|
|
190
190
|
tzData: exports.DateTimeFormat.tzData,
|
|
@@ -192,7 +192,7 @@ ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRange
|
|
|
192
192
|
});
|
|
193
193
|
},
|
|
194
194
|
});
|
|
195
|
-
ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRange', {
|
|
195
|
+
(0, ecma402_abstract_1.defineProperty)(exports.DateTimeFormat.prototype, 'formatRange', {
|
|
196
196
|
value: function formatRange(startDate, endDate) {
|
|
197
197
|
var dtf = this;
|
|
198
198
|
if (typeof dtf !== 'object') {
|
|
@@ -201,9 +201,9 @@ ecma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRange
|
|
|
201
201
|
if (startDate === undefined || endDate === undefined) {
|
|
202
202
|
throw new TypeError('startDate/endDate cannot be undefined');
|
|
203
203
|
}
|
|
204
|
-
var x = ecma402_abstract_1.ToNumber(startDate);
|
|
205
|
-
var y = ecma402_abstract_1.ToNumber(endDate);
|
|
206
|
-
return FormatDateTimeRange_1.FormatDateTimeRange(dtf, x, y, {
|
|
204
|
+
var x = (0, ecma402_abstract_1.ToNumber)(startDate);
|
|
205
|
+
var y = (0, ecma402_abstract_1.ToNumber)(endDate);
|
|
206
|
+
return (0, FormatDateTimeRange_1.FormatDateTimeRange)(dtf, x, y, {
|
|
207
207
|
getInternalSlots: get_internal_slots_1.default,
|
|
208
208
|
localeData: exports.DateTimeFormat.localeData,
|
|
209
209
|
tzData: exports.DateTimeFormat.tzData,
|
|
@@ -215,13 +215,13 @@ var DEFAULT_TIMEZONE = 'UTC';
|
|
|
215
215
|
exports.DateTimeFormat.__setDefaultTimeZone = function (timeZone) {
|
|
216
216
|
if (timeZone !== undefined) {
|
|
217
217
|
timeZone = String(timeZone);
|
|
218
|
-
if (!ecma402_abstract_1.IsValidTimeZoneName(timeZone, {
|
|
218
|
+
if (!(0, ecma402_abstract_1.IsValidTimeZoneName)(timeZone, {
|
|
219
219
|
tzData: exports.DateTimeFormat.tzData,
|
|
220
220
|
uppercaseLinks: UPPERCASED_LINKS,
|
|
221
221
|
})) {
|
|
222
222
|
throw new RangeError('Invalid timeZoneName');
|
|
223
223
|
}
|
|
224
|
-
timeZone = ecma402_abstract_1.CanonicalizeTimeZoneName(timeZone, {
|
|
224
|
+
timeZone = (0, ecma402_abstract_1.CanonicalizeTimeZoneName)(timeZone, {
|
|
225
225
|
tzData: exports.DateTimeFormat.tzData,
|
|
226
226
|
uppercaseLinks: UPPERCASED_LINKS,
|
|
227
227
|
});
|
|
@@ -240,26 +240,26 @@ exports.DateTimeFormat.__addLocaleData = function __addLocaleData() {
|
|
|
240
240
|
data[_i] = arguments[_i];
|
|
241
241
|
}
|
|
242
242
|
var _loop_1 = function (d, locale) {
|
|
243
|
-
var dateFormat = d.dateFormat, timeFormat = d.timeFormat, dateTimeFormat = d.dateTimeFormat, formats = d.formats, intervalFormats = d.intervalFormats, rawData = tslib_1.__rest(d, ["dateFormat", "timeFormat", "dateTimeFormat", "formats", "intervalFormats"]);
|
|
244
|
-
var processedData = tslib_1.__assign(tslib_1.__assign({}, rawData), { dateFormat: {
|
|
245
|
-
full: skeleton_1.parseDateTimeSkeleton(dateFormat.full),
|
|
246
|
-
long: skeleton_1.parseDateTimeSkeleton(dateFormat.long),
|
|
247
|
-
medium: skeleton_1.parseDateTimeSkeleton(dateFormat.medium),
|
|
248
|
-
short: skeleton_1.parseDateTimeSkeleton(dateFormat.short),
|
|
243
|
+
var dateFormat = d.dateFormat, timeFormat = d.timeFormat, dateTimeFormat = d.dateTimeFormat, formats = d.formats, intervalFormats = d.intervalFormats, rawData = (0, tslib_1.__rest)(d, ["dateFormat", "timeFormat", "dateTimeFormat", "formats", "intervalFormats"]);
|
|
244
|
+
var processedData = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, rawData), { dateFormat: {
|
|
245
|
+
full: (0, skeleton_1.parseDateTimeSkeleton)(dateFormat.full),
|
|
246
|
+
long: (0, skeleton_1.parseDateTimeSkeleton)(dateFormat.long),
|
|
247
|
+
medium: (0, skeleton_1.parseDateTimeSkeleton)(dateFormat.medium),
|
|
248
|
+
short: (0, skeleton_1.parseDateTimeSkeleton)(dateFormat.short),
|
|
249
249
|
}, timeFormat: {
|
|
250
|
-
full: skeleton_1.parseDateTimeSkeleton(timeFormat.full),
|
|
251
|
-
long: skeleton_1.parseDateTimeSkeleton(timeFormat.long),
|
|
252
|
-
medium: skeleton_1.parseDateTimeSkeleton(timeFormat.medium),
|
|
253
|
-
short: skeleton_1.parseDateTimeSkeleton(timeFormat.short),
|
|
250
|
+
full: (0, skeleton_1.parseDateTimeSkeleton)(timeFormat.full),
|
|
251
|
+
long: (0, skeleton_1.parseDateTimeSkeleton)(timeFormat.long),
|
|
252
|
+
medium: (0, skeleton_1.parseDateTimeSkeleton)(timeFormat.medium),
|
|
253
|
+
short: (0, skeleton_1.parseDateTimeSkeleton)(timeFormat.short),
|
|
254
254
|
}, dateTimeFormat: {
|
|
255
|
-
full: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,
|
|
256
|
-
long: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,
|
|
257
|
-
medium: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,
|
|
258
|
-
short: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,
|
|
255
|
+
full: (0, skeleton_1.parseDateTimeSkeleton)(dateTimeFormat.full).pattern,
|
|
256
|
+
long: (0, skeleton_1.parseDateTimeSkeleton)(dateTimeFormat.long).pattern,
|
|
257
|
+
medium: (0, skeleton_1.parseDateTimeSkeleton)(dateTimeFormat.medium).pattern,
|
|
258
|
+
short: (0, skeleton_1.parseDateTimeSkeleton)(dateTimeFormat.short).pattern,
|
|
259
259
|
}, formats: {} });
|
|
260
260
|
var _loop_2 = function (calendar) {
|
|
261
261
|
processedData.formats[calendar] = Object.keys(formats[calendar]).map(function (skeleton) {
|
|
262
|
-
return skeleton_1.parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback);
|
|
262
|
+
return (0, skeleton_1.parseDateTimeSkeleton)(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback);
|
|
263
263
|
});
|
|
264
264
|
};
|
|
265
265
|
for (var calendar in formats) {
|
|
@@ -290,7 +290,7 @@ exports.DateTimeFormat.getDefaultLocale = function () {
|
|
|
290
290
|
exports.DateTimeFormat.polyfilled = true;
|
|
291
291
|
exports.DateTimeFormat.tzData = {};
|
|
292
292
|
exports.DateTimeFormat.__addTZData = function (d) {
|
|
293
|
-
exports.DateTimeFormat.tzData = packer_1.unpack(d);
|
|
293
|
+
exports.DateTimeFormat.tzData = (0, packer_1.unpack)(d);
|
|
294
294
|
};
|
|
295
295
|
try {
|
|
296
296
|
if (typeof Symbol !== 'undefined') {
|
package/src/packer.js
CHANGED
|
@@ -7,12 +7,12 @@ function pack(data) {
|
|
|
7
7
|
zoneNames.sort(); // so output is stable
|
|
8
8
|
return {
|
|
9
9
|
zones: zoneNames.map(function (zone) {
|
|
10
|
-
return tslib_1.__spreadArray([
|
|
10
|
+
return (0, tslib_1.__spreadArray)([
|
|
11
11
|
zone
|
|
12
12
|
], data.zones[zone].map(function (_a) {
|
|
13
13
|
var ts = _a[0], others = _a.slice(1);
|
|
14
|
-
return tslib_1.__spreadArray([ts === '' ? '' : ts.toString(36)], others).join(',');
|
|
15
|
-
})).join('|');
|
|
14
|
+
return (0, tslib_1.__spreadArray)([ts === '' ? '' : ts.toString(36)], others, true).join(',');
|
|
15
|
+
}), true).join('|');
|
|
16
16
|
}),
|
|
17
17
|
abbrvs: data.abbrvs.join('|'),
|
|
18
18
|
offsets: data.offsets.map(function (o) { return o.toString(36); }).join('|'),
|
package/src/to_locale_string.js
CHANGED
|
@@ -14,12 +14,12 @@ function toLocaleString(x, locales, options) {
|
|
|
14
14
|
}
|
|
15
15
|
exports.toLocaleString = toLocaleString;
|
|
16
16
|
function toLocaleDateString(x, locales, options) {
|
|
17
|
-
var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'date', 'date'));
|
|
17
|
+
var dtf = new core_1.DateTimeFormat(locales, (0, ToDateTimeOptions_1.ToDateTimeOptions)(options, 'date', 'date'));
|
|
18
18
|
return dtf.format(x);
|
|
19
19
|
}
|
|
20
20
|
exports.toLocaleDateString = toLocaleDateString;
|
|
21
21
|
function toLocaleTimeString(x, locales, options) {
|
|
22
|
-
var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'time', 'time'));
|
|
22
|
+
var dtf = new core_1.DateTimeFormat(locales, (0, ToDateTimeOptions_1.ToDateTimeOptions)(options, 'time', 'time'));
|
|
23
23
|
return dtf.format(x);
|
|
24
24
|
}
|
|
25
25
|
exports.toLocaleTimeString = toLocaleTimeString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-locales.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-datetimeformat/supported-locales.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA+nI,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedLocales = void 0;
|
|
4
|
+
// This file is generated from supported-locales-gen.ts
|
|
5
|
+
exports.supportedLocales = ["af-NA", "af", "agq", "ak", "am", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "ar", "as", "asa", "ast", "az-Cyrl", "az-Latn", "az", "bas", "be", "bem", "bez", "bg", "bm", "bn-IN", "bn", "bo-IN", "bo", "br", "brx", "bs-Cyrl", "bs-Latn", "bs", "ca-AD", "ca-ES-VALENCIA", "ca-FR", "ca-IT", "ca", "ccp-IN", "ccp", "ce", "ceb", "cgg", "chr", "ckb-IR", "ckb", "cs", "cy", "da-GL", "da", "dav", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "de", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee-TG", "ee", "el-CY", "el", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-US-POSIX", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "en", "eo", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "es", "et", "eu", "ewo", "fa-AF", "fa", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Adlm", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "ff-Latn", "ff", "fi", "fil", "fo-DK", "fo", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fr", "fur", "fy", "ga-GB", "ga", "gd", "gl", "gsw-FR", "gsw-LI", "gsw", "gu", "guz", "gv", "ha-GH", "ha-NE", "ha", "haw", "he", "hi", "hr-BA", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it-CH", "it-SM", "it-VA", "it", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko-KP", "ko", "kok", "ks-Arab", "ks", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln-AO", "ln-CF", "ln-CG", "ln", "lo", "lrc-IQ", "lrc", "lt", "lu", "luo", "luy", "lv", "mai", "mas-TZ", "mas", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni-Beng", "mni", "mr", "ms-BN", "ms-ID", "ms-SG", "ms", "mt", "mua", "my", "mzn", "naq", "nb-SJ", "nb", "nd", "nds-NL", "nds", "ne-IN", "ne", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nl", "nmg", "nn", "nnh", "no", "nus", "nyn", "om-KE", "om", "or", "os-RU", "os", "pa-Arab", "pa-Guru", "pa", "pcm", "pl", "ps-PK", "ps", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "pt", "qu-BO", "qu-EC", "qu", "rm", "rn", "ro-MD", "ro", "rof", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "ru", "rw", "rwk", "sa", "sah", "saq", "sat-Olck", "sat", "sbp", "sd-Arab", "sd-Deva", "sd", "se-FI", "se-SE", "se", "seh", "ses", "sg", "shi-Latn", "shi-Tfng", "shi", "si", "sk", "sl", "smn", "sn", "so-DJ", "so-ET", "so-KE", "so", "sq-MK", "sq-XK", "sq", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "sr-Latn", "sr", "su-Latn", "su", "sv-AX", "sv-FI", "sv", "sw-CD", "sw-KE", "sw-UG", "sw", "ta-LK", "ta-MY", "ta-SG", "ta", "te", "teo-KE", "teo", "tg", "th", "ti-ER", "ti", "tk", "to", "tr-CY", "tr", "tt", "twq", "tzm", "ug", "uk", "ur-IN", "ur", "uz-Arab", "uz-Cyrl", "uz-Latn", "uz", "vai-Latn", "vai-Vaii", "vai", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo-BJ", "yo", "yue-Hans", "yue-Hant", "yue", "zgh", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK", "zh-Hant-MO", "zh-Hant", "zh", "zu"];
|