@formatjs/intl-datetimeformat 6.11.0 → 6.11.2

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/lib/index.js CHANGED
@@ -1 +1,4 @@
1
- export * from './src/core';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./src/core"), exports);
@@ -1,19 +1,21 @@
1
- import { DateTimeFormat } from './';
2
- import { defineProperty } from '@formatjs/ecma402-abstract';
3
- import { toLocaleString as _toLocaleString, toLocaleDateString as _toLocaleDateString, toLocaleTimeString as _toLocaleTimeString, } from './src/to_locale_string';
4
- defineProperty(Intl, 'DateTimeFormat', { value: DateTimeFormat });
5
- defineProperty(Date.prototype, 'toLocaleString', {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var _1 = require("./");
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
+ var to_locale_string_1 = require("./src/to_locale_string");
6
+ (0, ecma402_abstract_1.defineProperty)(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
7
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleString', {
6
8
  value: function toLocaleString(locales, options) {
7
- return _toLocaleString(this, locales, options);
9
+ return (0, to_locale_string_1.toLocaleString)(this, locales, options);
8
10
  },
9
11
  });
10
- defineProperty(Date.prototype, 'toLocaleDateString', {
12
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
11
13
  value: function toLocaleDateString(locales, options) {
12
- return _toLocaleDateString(this, locales, options);
14
+ return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
13
15
  },
14
16
  });
15
- defineProperty(Date.prototype, 'toLocaleTimeString', {
17
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
16
18
  value: function toLocaleTimeString(locales, options) {
17
- return _toLocaleTimeString(this, locales, options);
19
+ return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
18
20
  },
19
21
  });
package/lib/polyfill.js CHANGED
@@ -1,33 +1,35 @@
1
- import { DateTimeFormat } from './';
2
- import { defineProperty } from '@formatjs/ecma402-abstract';
3
- import { shouldPolyfill } from './should-polyfill';
4
- import { toLocaleString as _toLocaleString, toLocaleDateString as _toLocaleDateString, toLocaleTimeString as _toLocaleTimeString, } from './src/to_locale_string';
5
- if (shouldPolyfill()) {
6
- defineProperty(Intl, 'DateTimeFormat', { value: DateTimeFormat });
7
- defineProperty(Date.prototype, 'toLocaleString', {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var _1 = require("./");
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
+ var should_polyfill_1 = require("./should-polyfill");
6
+ var to_locale_string_1 = require("./src/to_locale_string");
7
+ if ((0, should_polyfill_1.shouldPolyfill)()) {
8
+ (0, ecma402_abstract_1.defineProperty)(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
9
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleString', {
8
10
  value: function toLocaleString(locales, options) {
9
11
  try {
10
- return _toLocaleString(this, locales, options);
12
+ return (0, to_locale_string_1.toLocaleString)(this, locales, options);
11
13
  }
12
14
  catch (error) {
13
15
  return 'Invalid Date';
14
16
  }
15
17
  },
16
18
  });
17
- defineProperty(Date.prototype, 'toLocaleDateString', {
19
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
18
20
  value: function toLocaleDateString(locales, options) {
19
21
  try {
20
- return _toLocaleDateString(this, locales, options);
22
+ return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
21
23
  }
22
24
  catch (error) {
23
25
  return 'Invalid Date';
24
26
  }
25
27
  },
26
28
  });
27
- defineProperty(Date.prototype, 'toLocaleTimeString', {
29
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
28
30
  value: function toLocaleTimeString(locales, options) {
29
31
  try {
30
- return _toLocaleTimeString(this, locales, options);
32
+ return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
31
33
  }
32
34
  catch (error) {
33
35
  return 'Invalid Date';
@@ -1,5 +1,8 @@
1
- import { match } from '@formatjs/intl-localematcher';
2
- import { supportedLocales } from './supported-locales.generated';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldPolyfill = void 0;
4
+ var intl_localematcher_1 = require("@formatjs/intl-localematcher");
5
+ var supported_locales_generated_1 = require("./supported-locales.generated");
3
6
  function supportsDateStyle() {
4
7
  try {
5
8
  return !!new Intl.DateTimeFormat(undefined, {
@@ -47,7 +50,7 @@ function supportedLocalesOf(locale) {
47
50
  var locales = Array.isArray(locale) ? locale : [locale];
48
51
  return (Intl.DateTimeFormat.supportedLocalesOf(locales).length === locales.length);
49
52
  }
50
- export function shouldPolyfill(locale) {
53
+ function shouldPolyfill(locale) {
51
54
  if (locale === void 0) { locale = 'en'; }
52
55
  if (!('DateTimeFormat' in Intl) ||
53
56
  !('formatToParts' in Intl.DateTimeFormat.prototype) ||
@@ -56,6 +59,7 @@ export function shouldPolyfill(locale) {
56
59
  hasUnthrownDateTimeStyleBug() ||
57
60
  !supportsDateStyle() ||
58
61
  !supportedLocalesOf(locale)) {
59
- return locale ? match([locale], supportedLocales, 'en') : undefined;
62
+ return locale ? (0, intl_localematcher_1.match)([locale], supported_locales_generated_1.supportedLocales, 'en') : undefined;
60
63
  }
61
64
  }
65
+ exports.shouldPolyfill = shouldPolyfill;
@@ -1,75 +1,78 @@
1
- import { __assign } from "tslib";
2
- import { invariant } from '@formatjs/ecma402-abstract';
3
- import { DATE_TIME_PROPS, additionPenalty, removalPenalty, longMorePenalty, shortMorePenalty, shortLessPenalty, longLessPenalty, offsetPenalty, } from './utils';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasicFormatMatcher = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
6
+ var utils_1 = require("./utils");
4
7
  /**
5
8
  * https://tc39.es/ecma402/#sec-basicformatmatcher
6
9
  * @param options
7
10
  * @param formats
8
11
  */
9
- export function BasicFormatMatcher(options, formats) {
12
+ function BasicFormatMatcher(options, formats) {
10
13
  var bestScore = -Infinity;
11
14
  var bestFormat = formats[0];
12
- invariant(Array.isArray(formats), 'formats should be a list of things');
15
+ (0, ecma402_abstract_1.invariant)(Array.isArray(formats), 'formats should be a list of things');
13
16
  for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
14
17
  var format = formats_1[_i];
15
18
  var score = 0;
16
- for (var _a = 0, DATE_TIME_PROPS_1 = DATE_TIME_PROPS; _a < DATE_TIME_PROPS_1.length; _a++) {
19
+ for (var _a = 0, DATE_TIME_PROPS_1 = utils_1.DATE_TIME_PROPS; _a < DATE_TIME_PROPS_1.length; _a++) {
17
20
  var prop = DATE_TIME_PROPS_1[_a];
18
21
  var optionsProp = options[prop];
19
22
  var formatProp = format[prop];
20
23
  if (optionsProp === undefined && formatProp !== undefined) {
21
- score -= additionPenalty;
24
+ score -= utils_1.additionPenalty;
22
25
  }
23
26
  else if (optionsProp !== undefined && formatProp === undefined) {
24
- score -= removalPenalty;
27
+ score -= utils_1.removalPenalty;
25
28
  }
26
29
  else if (prop === 'timeZoneName') {
27
30
  if (optionsProp === 'short' || optionsProp === 'shortGeneric') {
28
31
  if (formatProp === 'shortOffset') {
29
- score -= offsetPenalty;
32
+ score -= utils_1.offsetPenalty;
30
33
  }
31
34
  else if (formatProp === 'longOffset') {
32
- score -= offsetPenalty + shortMorePenalty;
35
+ score -= utils_1.offsetPenalty + utils_1.shortMorePenalty;
33
36
  }
34
37
  else if (optionsProp === 'short' && formatProp === 'long') {
35
- score -= shortMorePenalty;
38
+ score -= utils_1.shortMorePenalty;
36
39
  }
37
40
  else if (optionsProp === 'shortGeneric' &&
38
41
  formatProp === 'longGeneric') {
39
- score -= shortMorePenalty;
42
+ score -= utils_1.shortMorePenalty;
40
43
  }
41
44
  else if (optionsProp !== formatProp) {
42
- score -= removalPenalty;
45
+ score -= utils_1.removalPenalty;
43
46
  }
44
47
  }
45
48
  else if (optionsProp === 'shortOffset' &&
46
49
  formatProp === 'longOffset') {
47
- score -= shortMorePenalty;
50
+ score -= utils_1.shortMorePenalty;
48
51
  }
49
52
  else if (optionsProp === 'long' || optionsProp === 'longGeneric') {
50
53
  if (formatProp === 'longOffset') {
51
- score -= offsetPenalty;
54
+ score -= utils_1.offsetPenalty;
52
55
  }
53
56
  else if (formatProp === 'shortOffset') {
54
- score -= offsetPenalty + longLessPenalty;
57
+ score -= utils_1.offsetPenalty + utils_1.longLessPenalty;
55
58
  }
56
59
  else if (optionsProp === 'long' && formatProp === 'short') {
57
- score -= longLessPenalty;
60
+ score -= utils_1.longLessPenalty;
58
61
  }
59
62
  else if (optionsProp === 'longGeneric' &&
60
63
  formatProp === 'shortGeneric') {
61
- score -= longLessPenalty;
64
+ score -= utils_1.longLessPenalty;
62
65
  }
63
66
  else if (optionsProp !== formatProp) {
64
- score -= removalPenalty;
67
+ score -= utils_1.removalPenalty;
65
68
  }
66
69
  }
67
70
  else if (optionsProp === 'longOffset' &&
68
71
  formatProp === 'shortOffset') {
69
- score -= longLessPenalty;
72
+ score -= utils_1.longLessPenalty;
70
73
  }
71
74
  else if (optionsProp !== formatProp) {
72
- score -= removalPenalty;
75
+ score -= utils_1.removalPenalty;
73
76
  }
74
77
  }
75
78
  else if (optionsProp !== formatProp) {
@@ -84,16 +87,16 @@ export function BasicFormatMatcher(options, formats) {
84
87
  var formatPropIndex = values.indexOf(formatProp);
85
88
  var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
86
89
  if (delta === 2) {
87
- score -= longMorePenalty;
90
+ score -= utils_1.longMorePenalty;
88
91
  }
89
92
  else if (delta === 1) {
90
- score -= shortMorePenalty;
93
+ score -= utils_1.shortMorePenalty;
91
94
  }
92
95
  else if (delta === -1) {
93
- score -= shortLessPenalty;
96
+ score -= utils_1.shortLessPenalty;
94
97
  }
95
98
  else if (delta === -2) {
96
- score -= longLessPenalty;
99
+ score -= utils_1.longLessPenalty;
97
100
  }
98
101
  }
99
102
  }
@@ -102,5 +105,6 @@ export function BasicFormatMatcher(options, formats) {
102
105
  bestFormat = format;
103
106
  }
104
107
  }
105
- return __assign({}, bestFormat);
108
+ return tslib_1.__assign({}, bestFormat);
106
109
  }
110
+ exports.BasicFormatMatcher = BasicFormatMatcher;
@@ -1,7 +1,10 @@
1
- import { __assign } from "tslib";
2
- import { invariant } from '@formatjs/ecma402-abstract';
3
- import { DATE_TIME_PROPS, removalPenalty, additionPenalty, differentNumericTypePenalty, longMorePenalty, shortMorePenalty, shortLessPenalty, longLessPenalty, } from './utils';
4
- import { processDateTimePattern } from './skeleton';
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 ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
6
+ var utils_1 = require("./utils");
7
+ var skeleton_1 = require("./skeleton");
5
8
  function isNumericType(t) {
6
9
  return t === 'numeric' || t === '2-digit';
7
10
  }
@@ -11,29 +14,29 @@ function isNumericType(t) {
11
14
  * @param options
12
15
  * @param format
13
16
  */
14
- export function bestFitFormatMatcherScore(options, format) {
17
+ function bestFitFormatMatcherScore(options, format) {
15
18
  var score = 0;
16
19
  if (options.hour12 && !format.hour12) {
17
- score -= removalPenalty;
20
+ score -= utils_1.removalPenalty;
18
21
  }
19
22
  else if (!options.hour12 && format.hour12) {
20
- score -= additionPenalty;
23
+ score -= utils_1.additionPenalty;
21
24
  }
22
- for (var _i = 0, DATE_TIME_PROPS_1 = DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
25
+ for (var _i = 0, DATE_TIME_PROPS_1 = utils_1.DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {
23
26
  var prop = DATE_TIME_PROPS_1[_i];
24
27
  var optionsProp = options[prop];
25
28
  var formatProp = format[prop];
26
29
  if (optionsProp === undefined && formatProp !== undefined) {
27
- score -= additionPenalty;
30
+ score -= utils_1.additionPenalty;
28
31
  }
29
32
  else if (optionsProp !== undefined && formatProp === undefined) {
30
- score -= removalPenalty;
33
+ score -= utils_1.removalPenalty;
31
34
  }
32
35
  else if (optionsProp !== formatProp) {
33
36
  // extra penalty for numeric vs non-numeric
34
37
  if (isNumericType(optionsProp) !==
35
38
  isNumericType(formatProp)) {
36
- score -= differentNumericTypePenalty;
39
+ score -= utils_1.differentNumericTypePenalty;
37
40
  }
38
41
  else {
39
42
  var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];
@@ -41,22 +44,23 @@ export function bestFitFormatMatcherScore(options, format) {
41
44
  var formatPropIndex = values.indexOf(formatProp);
42
45
  var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));
43
46
  if (delta === 2) {
44
- score -= longMorePenalty;
47
+ score -= utils_1.longMorePenalty;
45
48
  }
46
49
  else if (delta === 1) {
47
- score -= shortMorePenalty;
50
+ score -= utils_1.shortMorePenalty;
48
51
  }
49
52
  else if (delta === -1) {
50
- score -= shortLessPenalty;
53
+ score -= utils_1.shortLessPenalty;
51
54
  }
52
55
  else if (delta === -2) {
53
- score -= longLessPenalty;
56
+ score -= utils_1.longLessPenalty;
54
57
  }
55
58
  }
56
59
  }
57
60
  }
58
61
  return score;
59
62
  }
63
+ exports.bestFitFormatMatcherScore = bestFitFormatMatcherScore;
60
64
  /**
61
65
  * https://tc39.es/ecma402/#sec-bestfitformatmatcher
62
66
  * Just alias to basic for now
@@ -64,10 +68,10 @@ export function bestFitFormatMatcherScore(options, format) {
64
68
  * @param formats
65
69
  * @param implDetails Implementation details
66
70
  */
67
- export function BestFitFormatMatcher(options, formats) {
71
+ function BestFitFormatMatcher(options, formats) {
68
72
  var bestScore = -Infinity;
69
73
  var bestFormat = formats[0];
70
- invariant(Array.isArray(formats), 'formats should be a list of things');
74
+ (0, ecma402_abstract_1.invariant)(Array.isArray(formats), 'formats should be a list of things');
71
75
  for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
72
76
  var format = formats_1[_i];
73
77
  var score = bestFitFormatMatcherScore(options, format);
@@ -76,9 +80,9 @@ export function BestFitFormatMatcher(options, formats) {
76
80
  bestFormat = format;
77
81
  }
78
82
  }
79
- var skeletonFormat = __assign({}, bestFormat);
83
+ var skeletonFormat = tslib_1.__assign({}, bestFormat);
80
84
  var patternFormat = { rawPattern: bestFormat.rawPattern };
81
- processDateTimePattern(bestFormat.rawPattern, patternFormat);
85
+ (0, skeleton_1.processDateTimePattern)(bestFormat.rawPattern, patternFormat);
82
86
  // Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
83
87
  // Method adjustFieldTypes
84
88
  for (var prop in skeletonFormat) {
@@ -114,3 +118,4 @@ export function BestFitFormatMatcher(options, formats) {
114
118
  patternFormat.rangePatterns12 = skeletonFormat.rangePatterns12;
115
119
  return patternFormat;
116
120
  }
121
+ exports.BestFitFormatMatcher = BestFitFormatMatcher;
@@ -1,15 +1,18 @@
1
- import { invariant, } from '@formatjs/ecma402-abstract';
2
- export function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateTimeStyleFormat = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
+ function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
3
6
  var dateFormat, timeFormat;
4
7
  if (timeStyle !== undefined) {
5
- invariant(timeStyle === 'full' ||
8
+ (0, ecma402_abstract_1.invariant)(timeStyle === 'full' ||
6
9
  timeStyle === 'long' ||
7
10
  timeStyle === 'medium' ||
8
11
  timeStyle === 'short', 'invalid timeStyle');
9
12
  timeFormat = dataLocaleData.timeFormat[timeStyle];
10
13
  }
11
14
  if (dateStyle !== undefined) {
12
- invariant(dateStyle === 'full' ||
15
+ (0, ecma402_abstract_1.invariant)(dateStyle === 'full' ||
13
16
  dateStyle === 'long' ||
14
17
  dateStyle === 'medium' ||
15
18
  dateStyle === 'short', 'invalid dateStyle');
@@ -45,6 +48,7 @@ export function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
45
48
  if (timeStyle !== undefined) {
46
49
  return timeFormat;
47
50
  }
48
- invariant(dateStyle !== undefined, 'dateStyle should not be undefined');
51
+ (0, ecma402_abstract_1.invariant)(dateStyle !== undefined, 'dateStyle should not be undefined');
49
52
  return dateFormat;
50
53
  }
54
+ exports.DateTimeStyleFormat = DateTimeStyleFormat;
@@ -1,11 +1,14 @@
1
- import { PartitionDateTimePattern } from './PartitionDateTimePattern';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatDateTime = void 0;
4
+ var PartitionDateTimePattern_1 = require("./PartitionDateTimePattern");
2
5
  /**
3
6
  * https://tc39.es/ecma402/#sec-formatdatetime
4
7
  * @param dtf DateTimeFormat
5
8
  * @param x
6
9
  */
7
- export function FormatDateTime(dtf, x, implDetails) {
8
- var parts = PartitionDateTimePattern(dtf, x, implDetails);
10
+ function FormatDateTime(dtf, x, implDetails) {
11
+ var parts = (0, PartitionDateTimePattern_1.PartitionDateTimePattern)(dtf, x, implDetails);
9
12
  var result = '';
10
13
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
11
14
  var part = parts_1[_i];
@@ -13,3 +16,4 @@ export function FormatDateTime(dtf, x, implDetails) {
13
16
  }
14
17
  return result;
15
18
  }
19
+ exports.FormatDateTime = FormatDateTime;
@@ -1,6 +1,9 @@
1
- import { TimeClip, } from '@formatjs/ecma402-abstract';
2
- import { DATE_TIME_PROPS } from './utils';
3
- import { ToLocalTime } from './ToLocalTime';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatDateTimePattern = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
+ var utils_1 = require("./utils");
6
+ var ToLocalTime_1 = require("./ToLocalTime");
4
7
  function pad(n) {
5
8
  if (n < 10) {
6
9
  return "0".concat(n);
@@ -34,9 +37,9 @@ function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
34
37
  * @param dtf
35
38
  * @param x
36
39
  */
37
- export function FormatDateTimePattern(dtf, patternParts, x, _a) {
40
+ function FormatDateTimePattern(dtf, patternParts, x, _a) {
38
41
  var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;
39
- x = TimeClip(x);
42
+ x = (0, ecma402_abstract_1.TimeClip)(x);
40
43
  /** IMPL START */
41
44
  var internalSlots = getInternalSlots(dtf);
42
45
  var dataLocale = internalSlots.dataLocale;
@@ -58,7 +61,7 @@ export function FormatDateTimePattern(dtf, patternParts, x, _a) {
58
61
  nf3Options.useGrouping = false;
59
62
  nf3 = new Intl.NumberFormat(locale, nf3Options);
60
63
  }
61
- var tm = ToLocalTime(x,
64
+ var tm = (0, ToLocalTime_1.ToLocalTime)(x,
62
65
  // @ts-ignore
63
66
  internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
64
67
  var result = [];
@@ -99,7 +102,7 @@ export function FormatDateTimePattern(dtf, patternParts, x, _a) {
99
102
  }
100
103
  result.push({ type: p, value: fv });
101
104
  }
102
- else if (DATE_TIME_PROPS.indexOf(p) > -1) {
105
+ else if (utils_1.DATE_TIME_PROPS.indexOf(p) > -1) {
103
106
  var fv = '';
104
107
  var f = internalSlots[p];
105
108
  // @ts-ignore
@@ -184,3 +187,4 @@ export function FormatDateTimePattern(dtf, patternParts, x, _a) {
184
187
  }
185
188
  return result;
186
189
  }
190
+ exports.FormatDateTimePattern = FormatDateTimePattern;
@@ -1,6 +1,9 @@
1
- import { PartitionDateTimeRangePattern } from './PartitionDateTimeRangePattern';
2
- export function FormatDateTimeRange(dtf, x, y, implDetails) {
3
- var parts = PartitionDateTimeRangePattern(dtf, x, y, implDetails);
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 = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
4
7
  var result = '';
5
8
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
6
9
  var part = parts_1[_i];
@@ -8,3 +11,4 @@ export function FormatDateTimeRange(dtf, x, y, implDetails) {
8
11
  }
9
12
  return result;
10
13
  }
14
+ exports.FormatDateTimeRange = FormatDateTimeRange;
@@ -1,6 +1,9 @@
1
- import { PartitionDateTimeRangePattern } from './PartitionDateTimeRangePattern';
2
- export function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
3
- var parts = PartitionDateTimeRangePattern(dtf, x, y, implDetails);
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 = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
4
7
  var result = new Array(0);
5
8
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
6
9
  var part = parts_1[_i];
@@ -12,3 +15,4 @@ export function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
12
15
  }
13
16
  return result;
14
17
  }
18
+ exports.FormatDateTimeRangeToParts = FormatDateTimeRangeToParts;
@@ -1,5 +1,8 @@
1
- import { PartitionDateTimePattern } from './PartitionDateTimePattern';
2
- import { ArrayCreate } from '@formatjs/ecma402-abstract';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatDateTimeToParts = void 0;
4
+ var PartitionDateTimePattern_1 = require("./PartitionDateTimePattern");
5
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
3
6
  /**
4
7
  * https://tc39.es/ecma402/#sec-formatdatetimetoparts
5
8
  *
@@ -7,9 +10,9 @@ import { ArrayCreate } from '@formatjs/ecma402-abstract';
7
10
  * @param x
8
11
  * @param implDetails
9
12
  */
10
- export function FormatDateTimeToParts(dtf, x, implDetails) {
11
- var parts = PartitionDateTimePattern(dtf, x, implDetails);
12
- var result = ArrayCreate(0);
13
+ function FormatDateTimeToParts(dtf, x, implDetails) {
14
+ var parts = (0, PartitionDateTimePattern_1.PartitionDateTimePattern)(dtf, x, implDetails);
15
+ var result = (0, ecma402_abstract_1.ArrayCreate)(0);
13
16
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
14
17
  var part = parts_1[_i];
15
18
  result.push({
@@ -19,3 +22,4 @@ export function FormatDateTimeToParts(dtf, x, implDetails) {
19
22
  }
20
23
  return result;
21
24
  }
25
+ exports.FormatDateTimeToParts = FormatDateTimeToParts;