@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,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BasicFormatMatcher = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var utils_1 = require("../utils");
|
|
6
|
-
var utils_2 = require("./utils");
|
|
7
|
-
/**
|
|
8
|
-
* https://tc39.es/ecma402/#sec-basicformatmatcher
|
|
9
|
-
* @param options
|
|
10
|
-
* @param formats
|
|
11
|
-
*/
|
|
12
|
-
function BasicFormatMatcher(options, formats) {
|
|
13
|
-
var bestScore = -Infinity;
|
|
14
|
-
var bestFormat = formats[0];
|
|
15
|
-
utils_1.invariant(Array.isArray(formats), 'formats should be a list of things');
|
|
16
|
-
for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
|
|
17
|
-
var format = formats_1[_i];
|
|
18
|
-
var score = 0;
|
|
19
|
-
for (var _a = 0, DATE_TIME_PROPS_1 = utils_2.DATE_TIME_PROPS; _a < DATE_TIME_PROPS_1.length; _a++) {
|
|
20
|
-
var prop = DATE_TIME_PROPS_1[_a];
|
|
21
|
-
var optionsProp = options[prop];
|
|
22
|
-
var formatProp = format[prop];
|
|
23
|
-
if (optionsProp === undefined && formatProp !== undefined) {
|
|
24
|
-
score -= utils_2.additionPenalty;
|
|
25
|
-
}
|
|
26
|
-
else if (optionsProp !== undefined && formatProp === undefined) {
|
|
27
|
-
score -= utils_2.removalPenalty;
|
|
28
|
-
}
|
|
29
|
-
else if (optionsProp !== formatProp) {
|
|
30
|
-
var values = void 0;
|
|
31
|
-
if (prop === 'fractionalSecondDigits') {
|
|
32
|
-
values = [1, 2, 3];
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];
|
|
36
|
-
}
|
|
37
|
-
var optionsPropIndex = values.indexOf(optionsProp);
|
|
38
|
-
var formatPropIndex = values.indexOf(formatProp);
|
|
39
|
-
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
|
|
40
|
-
if (delta === 2) {
|
|
41
|
-
score -= utils_2.longMorePenalty;
|
|
42
|
-
}
|
|
43
|
-
else if (delta === 1) {
|
|
44
|
-
score -= utils_2.shortMorePenalty;
|
|
45
|
-
}
|
|
46
|
-
else if (delta === -1) {
|
|
47
|
-
score -= utils_2.shortLessPenalty;
|
|
48
|
-
}
|
|
49
|
-
else if (delta === -2) {
|
|
50
|
-
score -= utils_2.longLessPenalty;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (score > bestScore) {
|
|
55
|
-
bestScore = score;
|
|
56
|
-
bestFormat = format;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return tslib_1.__assign({}, bestFormat);
|
|
60
|
-
}
|
|
61
|
-
exports.BasicFormatMatcher = BasicFormatMatcher;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DateTimeFormatOptions, Formats } from '../types/date-time';
|
|
2
|
-
/**
|
|
3
|
-
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
|
|
4
|
-
* with some modifications
|
|
5
|
-
* @param options
|
|
6
|
-
* @param format
|
|
7
|
-
*/
|
|
8
|
-
export declare function bestFitFormatMatcherScore(options: DateTimeFormatOptions, format: Formats): number;
|
|
9
|
-
/**
|
|
10
|
-
* https://tc39.es/ecma402/#sec-bestfitformatmatcher
|
|
11
|
-
* Just alias to basic for now
|
|
12
|
-
* @param options
|
|
13
|
-
* @param formats
|
|
14
|
-
* @param implDetails Implementation details
|
|
15
|
-
*/
|
|
16
|
-
export declare function BestFitFormatMatcher(options: DateTimeFormatOptions, formats: Formats[]): Formats;
|
|
17
|
-
//# sourceMappingURL=BestFitFormatMatcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BestFitFormatMatcher.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DateTimeFormat/BestFitFormatMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,OAAO,EAAU,MAAM,oBAAoB,CAAA;AAoB1E;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,OAAO,GACd,MAAM,CA0CR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,OAAO,EAAE,WAsDnB"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BestFitFormatMatcher = exports.bestFitFormatMatcherScore = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var utils_1 = require("../utils");
|
|
6
|
-
var utils_2 = require("./utils");
|
|
7
|
-
var skeleton_1 = require("./skeleton");
|
|
8
|
-
function isNumericType(t) {
|
|
9
|
-
return t === 'numeric' || t === '2-digit';
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611
|
|
13
|
-
* with some modifications
|
|
14
|
-
* @param options
|
|
15
|
-
* @param format
|
|
16
|
-
*/
|
|
17
|
-
function bestFitFormatMatcherScore(options, format) {
|
|
18
|
-
var score = 0;
|
|
19
|
-
if (options.hour12 && !format.hour12) {
|
|
20
|
-
score -= utils_2.removalPenalty;
|
|
21
|
-
}
|
|
22
|
-
else if (!options.hour12 && format.hour12) {
|
|
23
|
-
score -= utils_2.additionPenalty;
|
|
24
|
-
}
|
|
25
|
-
for (var _i = 0, DATE_TIME_PROPS_1 = utils_2.DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
|
|
26
|
-
var prop = DATE_TIME_PROPS_1[_i];
|
|
27
|
-
var optionsProp = options[prop];
|
|
28
|
-
var formatProp = format[prop];
|
|
29
|
-
if (optionsProp === undefined && formatProp !== undefined) {
|
|
30
|
-
score -= utils_2.additionPenalty;
|
|
31
|
-
}
|
|
32
|
-
else if (optionsProp !== undefined && formatProp === undefined) {
|
|
33
|
-
score -= utils_2.removalPenalty;
|
|
34
|
-
}
|
|
35
|
-
else if (optionsProp !== formatProp) {
|
|
36
|
-
// extra penalty for numeric vs non-numeric
|
|
37
|
-
if (isNumericType(optionsProp) !==
|
|
38
|
-
isNumericType(formatProp)) {
|
|
39
|
-
score -= utils_2.differentNumericTypePenalty;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];
|
|
43
|
-
var optionsPropIndex = values.indexOf(optionsProp);
|
|
44
|
-
var formatPropIndex = values.indexOf(formatProp);
|
|
45
|
-
var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
|
|
46
|
-
if (delta === 2) {
|
|
47
|
-
score -= utils_2.longMorePenalty;
|
|
48
|
-
}
|
|
49
|
-
else if (delta === 1) {
|
|
50
|
-
score -= utils_2.shortMorePenalty;
|
|
51
|
-
}
|
|
52
|
-
else if (delta === -1) {
|
|
53
|
-
score -= utils_2.shortLessPenalty;
|
|
54
|
-
}
|
|
55
|
-
else if (delta === -2) {
|
|
56
|
-
score -= utils_2.longLessPenalty;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return score;
|
|
62
|
-
}
|
|
63
|
-
exports.bestFitFormatMatcherScore = bestFitFormatMatcherScore;
|
|
64
|
-
/**
|
|
65
|
-
* https://tc39.es/ecma402/#sec-bestfitformatmatcher
|
|
66
|
-
* Just alias to basic for now
|
|
67
|
-
* @param options
|
|
68
|
-
* @param formats
|
|
69
|
-
* @param implDetails Implementation details
|
|
70
|
-
*/
|
|
71
|
-
function BestFitFormatMatcher(options, formats) {
|
|
72
|
-
var bestScore = -Infinity;
|
|
73
|
-
var bestFormat = formats[0];
|
|
74
|
-
utils_1.invariant(Array.isArray(formats), 'formats should be a list of things');
|
|
75
|
-
for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
|
|
76
|
-
var format = formats_1[_i];
|
|
77
|
-
var score = bestFitFormatMatcherScore(options, format);
|
|
78
|
-
if (score > bestScore) {
|
|
79
|
-
bestScore = score;
|
|
80
|
-
bestFormat = format;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
var skeletonFormat = tslib_1.__assign({}, bestFormat);
|
|
84
|
-
var patternFormat = { rawPattern: bestFormat.rawPattern };
|
|
85
|
-
skeleton_1.processDateTimePattern(bestFormat.rawPattern, patternFormat);
|
|
86
|
-
// Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
|
|
87
|
-
// Method adjustFieldTypes
|
|
88
|
-
for (var prop in skeletonFormat) {
|
|
89
|
-
var skeletonValue = skeletonFormat[prop];
|
|
90
|
-
var patternValue = patternFormat[prop];
|
|
91
|
-
var requestedValue = options[prop];
|
|
92
|
-
// Don't mess with minute/second or we can get in the situation of
|
|
93
|
-
// 7:0:0 which is weird
|
|
94
|
-
if (prop === 'minute' || prop === 'second') {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
// Nothing to do here
|
|
98
|
-
if (!requestedValue) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
// https://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons
|
|
102
|
-
// Looks like we should not convert numeric to alphabetic but the other way
|
|
103
|
-
// around is ok
|
|
104
|
-
if (isNumericType(patternValue) &&
|
|
105
|
-
!isNumericType(requestedValue)) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (skeletonValue === requestedValue) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
patternFormat[prop] = requestedValue;
|
|
112
|
-
}
|
|
113
|
-
// Copy those over
|
|
114
|
-
patternFormat.pattern = skeletonFormat.pattern;
|
|
115
|
-
patternFormat.pattern12 = skeletonFormat.pattern12;
|
|
116
|
-
patternFormat.skeleton = skeletonFormat.skeleton;
|
|
117
|
-
patternFormat.rangePatterns = skeletonFormat.rangePatterns;
|
|
118
|
-
patternFormat.rangePatterns12 = skeletonFormat.rangePatterns12;
|
|
119
|
-
return patternFormat;
|
|
120
|
-
}
|
|
121
|
-
exports.BestFitFormatMatcher = BestFitFormatMatcher;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { DateTimeFormatOptions, DateTimeFormatLocaleInternalData, Formats } from '../types/date-time';
|
|
2
|
-
export declare function DateTimeStyleFormat(dateStyle: DateTimeFormatOptions['dateStyle'], timeStyle: DateTimeFormatOptions['timeStyle'], dataLocaleData: DateTimeFormatLocaleInternalData): Formats;
|
|
3
|
-
//# sourceMappingURL=DateTimeStyleFormat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeStyleFormat.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DateTimeFormat/DateTimeStyleFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,gCAAgC,EAChC,OAAO,EACR,MAAM,oBAAoB,CAAA;AAG3B,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC,EAC7C,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC,EAC7C,cAAc,EAAE,gCAAgC,GAC/C,OAAO,CAuDT"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateTimeStyleFormat = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
5
|
-
function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
|
|
6
|
-
var dateFormat, timeFormat;
|
|
7
|
-
if (timeStyle !== undefined) {
|
|
8
|
-
utils_1.invariant(timeStyle === 'full' ||
|
|
9
|
-
timeStyle === 'long' ||
|
|
10
|
-
timeStyle === 'medium' ||
|
|
11
|
-
timeStyle === 'short', 'invalid timeStyle');
|
|
12
|
-
timeFormat = dataLocaleData.timeFormat[timeStyle];
|
|
13
|
-
}
|
|
14
|
-
if (dateStyle !== undefined) {
|
|
15
|
-
utils_1.invariant(dateStyle === 'full' ||
|
|
16
|
-
dateStyle === 'long' ||
|
|
17
|
-
dateStyle === 'medium' ||
|
|
18
|
-
dateStyle === 'short', 'invalid dateStyle');
|
|
19
|
-
dateFormat = dataLocaleData.dateFormat[dateStyle];
|
|
20
|
-
}
|
|
21
|
-
if (dateStyle !== undefined && timeStyle !== undefined) {
|
|
22
|
-
var format = {};
|
|
23
|
-
for (var field in dateFormat) {
|
|
24
|
-
if (field !== 'pattern') {
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
format[field] = dateFormat[field];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
for (var field in timeFormat) {
|
|
30
|
-
if (field !== 'pattern' && field !== 'pattern12') {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
format[field] = timeFormat[field];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
var connector = dataLocaleData.dateTimeFormat[dateStyle];
|
|
36
|
-
var pattern = connector
|
|
37
|
-
.replace('{0}', timeFormat.pattern)
|
|
38
|
-
.replace('{1}', dateFormat.pattern);
|
|
39
|
-
format.pattern = pattern;
|
|
40
|
-
if ('pattern12' in timeFormat) {
|
|
41
|
-
var pattern12 = connector
|
|
42
|
-
.replace('{0}', timeFormat.pattern12)
|
|
43
|
-
.replace('{1}', dateFormat.pattern);
|
|
44
|
-
format.pattern12 = pattern12;
|
|
45
|
-
}
|
|
46
|
-
return format;
|
|
47
|
-
}
|
|
48
|
-
if (timeStyle !== undefined) {
|
|
49
|
-
return timeFormat;
|
|
50
|
-
}
|
|
51
|
-
utils_1.invariant(dateStyle !== undefined, 'dateStyle should not be undefined');
|
|
52
|
-
return dateFormat;
|
|
53
|
-
}
|
|
54
|
-
exports.DateTimeStyleFormat = DateTimeStyleFormat;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PartitionDateTimePattern } from './PartitionDateTimePattern';
|
|
2
|
-
/**
|
|
3
|
-
* https://tc39.es/ecma402/#sec-formatdatetime
|
|
4
|
-
* @param dtf DateTimeFormat
|
|
5
|
-
* @param x
|
|
6
|
-
*/
|
|
7
|
-
export declare function FormatDateTime(dtf: Intl.DateTimeFormat, x: number, implDetails: Parameters<typeof PartitionDateTimePattern>[2]): string;
|
|
8
|
-
//# sourceMappingURL=FormatDateTime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatDateTime.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DateTimeFormat/FormatDateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AAEnE;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,UAQ5D"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatDateTime = void 0;
|
|
4
|
-
var PartitionDateTimePattern_1 = require("./PartitionDateTimePattern");
|
|
5
|
-
/**
|
|
6
|
-
* https://tc39.es/ecma402/#sec-formatdatetime
|
|
7
|
-
* @param dtf DateTimeFormat
|
|
8
|
-
* @param x
|
|
9
|
-
*/
|
|
10
|
-
function FormatDateTime(dtf, x, implDetails) {
|
|
11
|
-
var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);
|
|
12
|
-
var result = '';
|
|
13
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
14
|
-
var part = parts_1[_i];
|
|
15
|
-
result += part.value;
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
exports.FormatDateTime = FormatDateTime;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IntlDateTimeFormatInternal, DateTimeFormatLocaleInternalData, IntlDateTimeFormatPart } from '../types/date-time';
|
|
2
|
-
import { ToLocalTimeImplDetails } from './ToLocalTime';
|
|
3
|
-
export interface FormatDateTimePatternImplDetails {
|
|
4
|
-
getInternalSlots(dtf: Intl.DateTimeFormat): IntlDateTimeFormatInternal;
|
|
5
|
-
localeData: Record<string, DateTimeFormatLocaleInternalData>;
|
|
6
|
-
getDefaultTimeZone(): string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
|
|
10
|
-
* @param dtf
|
|
11
|
-
* @param x
|
|
12
|
-
*/
|
|
13
|
-
export declare function FormatDateTimePattern(dtf: Intl.DateTimeFormat, patternParts: IntlDateTimeFormatPart[], x: number, { getInternalSlots, localeData, getDefaultTimeZone, tzData, }: FormatDateTimePatternImplDetails & ToLocalTimeImplDetails): IntlDateTimeFormatPart[];
|
|
14
|
-
//# sourceMappingURL=FormatDateTimePattern.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormatDateTimePattern.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DateTimeFormat/FormatDateTimePattern.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,sBAAsB,EACvB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAc,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAuCjE,MAAM,WAAW,gCAAgC;IAC/C,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,0BAA0B,CAAA;IACtE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC,CAAA;IAC5D,kBAAkB,IAAI,MAAM,CAAA;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,YAAY,EAAE,sBAAsB,EAAE,EACtC,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,MAAM,GACP,EAAE,gCAAgC,GAAG,sBAAsB,GAC3D,sBAAsB,EAAE,CAkJ1B"}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatDateTimePattern = void 0;
|
|
4
|
-
var utils_1 = require("./utils");
|
|
5
|
-
var ToLocalTime_1 = require("./ToLocalTime");
|
|
6
|
-
var _262_1 = require("../262");
|
|
7
|
-
function pad(n) {
|
|
8
|
-
if (n < 10) {
|
|
9
|
-
return "0" + n;
|
|
10
|
-
}
|
|
11
|
-
return String(n);
|
|
12
|
-
}
|
|
13
|
-
function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
|
|
14
|
-
var offsetInMinutes = Math.floor(offsetInMs / 60000);
|
|
15
|
-
var mins = Math.abs(offsetInMinutes) % 60;
|
|
16
|
-
var hours = Math.floor(Math.abs(offsetInMinutes) / 60);
|
|
17
|
-
var _a = hourFormat.split(';'), positivePattern = _a[0], negativePattern = _a[1];
|
|
18
|
-
var offsetStr = '';
|
|
19
|
-
var pattern = offsetInMs < 0 ? negativePattern : positivePattern;
|
|
20
|
-
if (style === 'long') {
|
|
21
|
-
offsetStr = pattern
|
|
22
|
-
.replace('HH', pad(hours))
|
|
23
|
-
.replace('H', String(hours))
|
|
24
|
-
.replace('mm', pad(mins))
|
|
25
|
-
.replace('m', String(mins));
|
|
26
|
-
}
|
|
27
|
-
else if (mins || hours) {
|
|
28
|
-
if (!mins) {
|
|
29
|
-
pattern = pattern.replace(/:?m+/, '');
|
|
30
|
-
}
|
|
31
|
-
offsetStr = pattern.replace(/H+/, String(hours)).replace(/m+/, String(mins));
|
|
32
|
-
}
|
|
33
|
-
return gmtFormat.replace('{0}', offsetStr);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
|
|
37
|
-
* @param dtf
|
|
38
|
-
* @param x
|
|
39
|
-
*/
|
|
40
|
-
function FormatDateTimePattern(dtf, patternParts, x, _a) {
|
|
41
|
-
var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;
|
|
42
|
-
x = _262_1.TimeClip(x);
|
|
43
|
-
/** IMPL START */
|
|
44
|
-
var internalSlots = getInternalSlots(dtf);
|
|
45
|
-
var dataLocale = internalSlots.dataLocale;
|
|
46
|
-
var dataLocaleData = localeData[dataLocale];
|
|
47
|
-
/** IMPL END */
|
|
48
|
-
var locale = internalSlots.locale;
|
|
49
|
-
var nfOptions = Object.create(null);
|
|
50
|
-
nfOptions.useGrouping = false;
|
|
51
|
-
var nf = new Intl.NumberFormat(locale, nfOptions);
|
|
52
|
-
var nf2Options = Object.create(null);
|
|
53
|
-
nf2Options.minimumIntegerDigits = 2;
|
|
54
|
-
nf2Options.useGrouping = false;
|
|
55
|
-
var nf2 = new Intl.NumberFormat(locale, nf2Options);
|
|
56
|
-
var fractionalSecondDigits = internalSlots.fractionalSecondDigits;
|
|
57
|
-
var nf3;
|
|
58
|
-
if (fractionalSecondDigits !== undefined) {
|
|
59
|
-
var nf3Options = Object.create(null);
|
|
60
|
-
nf3Options.minimumIntegerDigits = fractionalSecondDigits;
|
|
61
|
-
nf3Options.useGrouping = false;
|
|
62
|
-
nf3 = new Intl.NumberFormat(locale, nf3Options);
|
|
63
|
-
}
|
|
64
|
-
var tm = ToLocalTime_1.ToLocalTime(x,
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
|
|
67
|
-
var result = [];
|
|
68
|
-
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
|
|
69
|
-
var patternPart = patternParts_1[_i];
|
|
70
|
-
var p = patternPart.type;
|
|
71
|
-
if (p === 'literal') {
|
|
72
|
-
result.push({
|
|
73
|
-
type: 'literal',
|
|
74
|
-
value: patternPart.value,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
else if (p === 'fractionalSecondDigits') {
|
|
78
|
-
var v = Math.floor(tm.millisecond * Math.pow(10, ((fractionalSecondDigits || 0) - 3)));
|
|
79
|
-
result.push({
|
|
80
|
-
// @ts-expect-error Spec is not there yet
|
|
81
|
-
type: 'fractionalSecond',
|
|
82
|
-
value: nf3.format(v),
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
else if (utils_1.DATE_TIME_PROPS.indexOf(p) > -1) {
|
|
86
|
-
var fv = '';
|
|
87
|
-
var f = internalSlots[p];
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
var v = tm[p];
|
|
90
|
-
if (p === 'year' && v <= 0) {
|
|
91
|
-
v = 1 - v;
|
|
92
|
-
}
|
|
93
|
-
if (p === 'month') {
|
|
94
|
-
v++;
|
|
95
|
-
}
|
|
96
|
-
var hourCycle = internalSlots.hourCycle;
|
|
97
|
-
if (p === 'hour' && (hourCycle === 'h11' || hourCycle === 'h12')) {
|
|
98
|
-
v = v % 12;
|
|
99
|
-
if (v === 0 && hourCycle === 'h12') {
|
|
100
|
-
v = 12;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (p === 'hour' && hourCycle === 'h24') {
|
|
104
|
-
if (v === 0) {
|
|
105
|
-
v = 24;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (f === 'numeric') {
|
|
109
|
-
fv = nf.format(v);
|
|
110
|
-
}
|
|
111
|
-
else if (f === '2-digit') {
|
|
112
|
-
fv = nf2.format(v);
|
|
113
|
-
if (fv.length > 2) {
|
|
114
|
-
fv = fv.slice(fv.length - 2, fv.length);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
else if (f === 'narrow' || f === 'short' || f === 'long') {
|
|
118
|
-
if (p === 'era') {
|
|
119
|
-
fv = dataLocaleData[p][f][v];
|
|
120
|
-
}
|
|
121
|
-
else if (p === 'timeZoneName') {
|
|
122
|
-
var timeZoneName = dataLocaleData.timeZoneName, gmtFormat = dataLocaleData.gmtFormat, hourFormat = dataLocaleData.hourFormat;
|
|
123
|
-
var timeZone = internalSlots.timeZone || getDefaultTimeZone();
|
|
124
|
-
var timeZoneData = timeZoneName[timeZone];
|
|
125
|
-
if (timeZoneData && timeZoneData[f]) {
|
|
126
|
-
fv = timeZoneData[f][+tm.inDST];
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
// Fallback to gmtFormat
|
|
130
|
-
fv = offsetToGmtString(gmtFormat, hourFormat, tm.timeZoneOffset, f);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else if (p === 'month') {
|
|
134
|
-
fv = dataLocaleData.month[f][v - 1];
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
fv = dataLocaleData[p][f][v];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
result.push({
|
|
141
|
-
type: p,
|
|
142
|
-
value: fv,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
else if (p === 'ampm') {
|
|
146
|
-
var v = tm.hour;
|
|
147
|
-
var fv = void 0;
|
|
148
|
-
if (v > 11) {
|
|
149
|
-
fv = dataLocaleData.pm;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
fv = dataLocaleData.am;
|
|
153
|
-
}
|
|
154
|
-
result.push({
|
|
155
|
-
type: 'dayPeriod',
|
|
156
|
-
value: fv,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
else if (p === 'relatedYear') {
|
|
160
|
-
var v = tm.relatedYear;
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
var fv = nf.format(v);
|
|
163
|
-
result.push({
|
|
164
|
-
// @ts-ignore TODO: Fix TS type
|
|
165
|
-
type: 'relatedYear',
|
|
166
|
-
value: fv,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
else if (p === 'yearName') {
|
|
170
|
-
var v = tm.yearName;
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
var fv = nf.format(v);
|
|
173
|
-
result.push({
|
|
174
|
-
// @ts-ignore TODO: Fix TS type
|
|
175
|
-
type: 'yearName',
|
|
176
|
-
value: fv,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return result;
|
|
181
|
-
}
|
|
182
|
-
exports.FormatDateTimePattern = FormatDateTimePattern;
|
|
@@ -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,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatDateTimeRange = void 0;
|
|
4
|
-
var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
|
|
5
|
-
function FormatDateTimeRange(dtf, x, y, implDetails) {
|
|
6
|
-
var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
7
|
-
var result = '';
|
|
8
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
9
|
-
var part = parts_1[_i];
|
|
10
|
-
result += part.value;
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
exports.FormatDateTimeRange = FormatDateTimeRange;
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatDateTimeRangeToParts = void 0;
|
|
4
|
-
var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
|
|
5
|
-
function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
|
|
6
|
-
var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
|
|
7
|
-
var result = new Array(0);
|
|
8
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
9
|
-
var part = parts_1[_i];
|
|
10
|
-
result.push({
|
|
11
|
-
type: part.type,
|
|
12
|
-
value: part.value,
|
|
13
|
-
source: part.source,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
exports.FormatDateTimeRangeToParts = FormatDateTimeRangeToParts;
|
|
@@ -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,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormatDateTimeToParts = void 0;
|
|
4
|
-
var PartitionDateTimePattern_1 = require("./PartitionDateTimePattern");
|
|
5
|
-
var _262_1 = require("../262");
|
|
6
|
-
/**
|
|
7
|
-
* https://tc39.es/ecma402/#sec-formatdatetimetoparts
|
|
8
|
-
*
|
|
9
|
-
* @param dtf
|
|
10
|
-
* @param x
|
|
11
|
-
* @param implDetails
|
|
12
|
-
*/
|
|
13
|
-
function FormatDateTimeToParts(dtf, x, implDetails) {
|
|
14
|
-
var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);
|
|
15
|
-
var result = _262_1.ArrayCreate(0);
|
|
16
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
17
|
-
var part = parts_1[_i];
|
|
18
|
-
result.push({
|
|
19
|
-
type: part.type,
|
|
20
|
-
value: part.value,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
exports.FormatDateTimeToParts = FormatDateTimeToParts;
|
|
@@ -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"}
|