@formatjs/intl-datetimeformat 7.2.3 → 7.2.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.
Files changed (132) hide show
  1. package/locale-data/ar-IL.js +2 -1
  2. package/locale-data/bm.js +2 -1
  3. package/locale-data/br.js +2 -1
  4. package/locale-data/ca-AD.js +2 -1
  5. package/locale-data/ca-FR.js +2 -1
  6. package/locale-data/ca-IT.js +2 -1
  7. package/locale-data/ce.js +2 -1
  8. package/locale-data/ckb-IR.js +2 -1
  9. package/locale-data/cs.js +2 -1
  10. package/locale-data/da.js +2 -1
  11. package/locale-data/de-AT.js +2 -1
  12. package/locale-data/de-BE.js +2 -1
  13. package/locale-data/de-IT.js +2 -1
  14. package/locale-data/de.js +2 -1
  15. package/locale-data/dje.js +2 -1
  16. package/locale-data/dsb.js +2 -1
  17. package/locale-data/ee-TG.js +2 -1
  18. package/locale-data/en-AT.js +2 -1
  19. package/locale-data/en-BE.js +2 -1
  20. package/locale-data/en-DE.js +2 -1
  21. package/locale-data/en-DK.js +2 -1
  22. package/locale-data/en-FI.js +2 -1
  23. package/locale-data/en-NL.js +2 -1
  24. package/locale-data/en-SE.js +2 -1
  25. package/locale-data/en-SI.js +2 -1
  26. package/locale-data/et.js +2 -1
  27. package/locale-data/fa.js +2 -1
  28. package/locale-data/ff-Adlm-BF.js +2 -1
  29. package/locale-data/ff-Adlm-GW.js +2 -1
  30. package/locale-data/ff-Adlm-NE.js +2 -1
  31. package/locale-data/ff-Adlm.js +2 -1
  32. package/locale-data/ff-Latn-BF.js +2 -1
  33. package/locale-data/ff-Latn-GN.js +2 -1
  34. package/locale-data/ff-Latn-GW.js +2 -1
  35. package/locale-data/ff-Latn-NE.js +2 -1
  36. package/locale-data/fi.js +2 -1
  37. package/locale-data/fo-DK.js +2 -1
  38. package/locale-data/fr-BE.js +2 -1
  39. package/locale-data/fr-BF.js +2 -1
  40. package/locale-data/fr-BJ.js +2 -1
  41. package/locale-data/fr-BL.js +2 -1
  42. package/locale-data/fr-CD.js +2 -1
  43. package/locale-data/fr-CG.js +2 -1
  44. package/locale-data/fr-CI.js +2 -1
  45. package/locale-data/fr-GA.js +2 -1
  46. package/locale-data/fr-GF.js +2 -1
  47. package/locale-data/fr-GN.js +2 -1
  48. package/locale-data/fr-GP.js +2 -1
  49. package/locale-data/fr-MC.js +2 -1
  50. package/locale-data/fr-MF.js +2 -1
  51. package/locale-data/fr-ML.js +2 -1
  52. package/locale-data/fr-MQ.js +2 -1
  53. package/locale-data/fr-NC.js +2 -1
  54. package/locale-data/fr-NE.js +2 -1
  55. package/locale-data/fr-PM.js +2 -1
  56. package/locale-data/fr-RE.js +2 -1
  57. package/locale-data/fr-TG.js +2 -1
  58. package/locale-data/fr-WF.js +2 -1
  59. package/locale-data/fr-YT.js +2 -1
  60. package/locale-data/fr.js +2 -1
  61. package/locale-data/fur.js +2 -1
  62. package/locale-data/fy.js +2 -1
  63. package/locale-data/gsw-FR.js +2 -1
  64. package/locale-data/ha-NE.js +2 -1
  65. package/locale-data/he.js +2 -1
  66. package/locale-data/hr.js +2 -1
  67. package/locale-data/hsb.js +2 -1
  68. package/locale-data/hy.js +2 -1
  69. package/locale-data/id.js +2 -1
  70. package/locale-data/is.js +2 -1
  71. package/locale-data/it.js +2 -1
  72. package/locale-data/jv.js +2 -1
  73. package/locale-data/kea.js +2 -1
  74. package/locale-data/kgp.js +2 -1
  75. package/locale-data/khq.js +2 -1
  76. package/locale-data/kk.js +2 -1
  77. package/locale-data/ksh.js +2 -1
  78. package/locale-data/ku.js +2 -1
  79. package/locale-data/ln-AO.js +2 -1
  80. package/locale-data/ln-CG.js +2 -1
  81. package/locale-data/ln.js +2 -1
  82. package/locale-data/lrc.js +2 -1
  83. package/locale-data/lu.js +2 -1
  84. package/locale-data/mgh.js +2 -1
  85. package/locale-data/ms-ID.js +2 -1
  86. package/locale-data/mzn.js +2 -1
  87. package/locale-data/nb-SJ.js +2 -1
  88. package/locale-data/nds-NL.js +2 -1
  89. package/locale-data/nds.js +2 -1
  90. package/locale-data/nl-AW.js +2 -1
  91. package/locale-data/nl-BE.js +2 -1
  92. package/locale-data/nl-BQ.js +2 -1
  93. package/locale-data/nl-CW.js +2 -1
  94. package/locale-data/nl-SR.js +2 -1
  95. package/locale-data/nl.js +2 -1
  96. package/locale-data/os-RU.js +2 -1
  97. package/locale-data/pt-AO.js +2 -1
  98. package/locale-data/pt-CV.js +2 -1
  99. package/locale-data/pt-GW.js +2 -1
  100. package/locale-data/pt-MZ.js +2 -1
  101. package/locale-data/pt-PT.js +2 -1
  102. package/locale-data/pt-ST.js +2 -1
  103. package/locale-data/pt.js +2 -1
  104. package/locale-data/ro-MD.js +2 -1
  105. package/locale-data/ro.js +2 -1
  106. package/locale-data/ru-KZ.js +2 -1
  107. package/locale-data/ru-MD.js +2 -1
  108. package/locale-data/ru.js +2 -1
  109. package/locale-data/sah.js +2 -1
  110. package/locale-data/sc.js +2 -1
  111. package/locale-data/se-FI.js +2 -1
  112. package/locale-data/se-SE.js +2 -1
  113. package/locale-data/seh.js +2 -1
  114. package/locale-data/ses.js +2 -1
  115. package/locale-data/sk.js +2 -1
  116. package/locale-data/sl.js +2 -1
  117. package/locale-data/smn.js +2 -1
  118. package/locale-data/su-Latn.js +2 -1
  119. package/locale-data/su.js +2 -1
  120. package/locale-data/sv-AX.js +2 -1
  121. package/locale-data/sv-FI.js +2 -1
  122. package/locale-data/sv.js +2 -1
  123. package/locale-data/sw-CD.js +2 -1
  124. package/locale-data/tr.js +2 -1
  125. package/locale-data/tt.js +2 -1
  126. package/locale-data/twq.js +2 -1
  127. package/locale-data/yo-BJ.js +2 -1
  128. package/locale-data/yrl.js +2 -1
  129. package/package.json +3 -3
  130. package/polyfill.iife.js +13 -1
  131. package/src/core.js +20 -1
  132. package/test262-main.js +5 -1
@@ -2100,7 +2100,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
2100
2100
  "gregory"
2101
2101
  ],
2102
2102
  "hc": [
2103
- "h23"
2103
+ "h23",
2104
+ "h12"
2104
2105
  ]
2105
2106
  },
2106
2107
  "locale": "smn"
@@ -3079,7 +3079,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
3079
3079
  "islamic-tbla"
3080
3080
  ],
3081
3081
  "hc": [
3082
- "h23"
3082
+ "h23",
3083
+ "h12"
3083
3084
  ]
3084
3085
  },
3085
3086
  "locale": "su-Latn"
package/locale-data/su.js CHANGED
@@ -3079,7 +3079,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
3079
3079
  "islamic-tbla"
3080
3080
  ],
3081
3081
  "hc": [
3082
- "h23"
3082
+ "h23",
3083
+ "h12"
3083
3084
  ]
3084
3085
  },
3085
3086
  "locale": "su"
@@ -5146,7 +5146,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
5146
5146
  "gregory"
5147
5147
  ],
5148
5148
  "hc": [
5149
- "h23"
5149
+ "h23",
5150
+ "h12"
5150
5151
  ]
5151
5152
  },
5152
5153
  "locale": "sv-AX"
@@ -5212,7 +5212,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
5212
5212
  "gregory"
5213
5213
  ],
5214
5214
  "hc": [
5215
- "h23"
5215
+ "h23",
5216
+ "h12"
5216
5217
  ]
5217
5218
  },
5218
5219
  "locale": "sv-FI"
package/locale-data/sv.js CHANGED
@@ -5212,7 +5212,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
5212
5212
  "gregory"
5213
5213
  ],
5214
5214
  "hc": [
5215
- "h23"
5215
+ "h23",
5216
+ "h12"
5216
5217
  ]
5217
5218
  },
5218
5219
  "locale": "sv"
@@ -4537,7 +4537,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
4537
4537
  ],
4538
4538
  "hc": [
4539
4539
  "",
4540
- "h23"
4540
+ "h23",
4541
+ "h12"
4541
4542
  ]
4542
4543
  },
4543
4544
  "locale": "sw-CD"
package/locale-data/tr.js CHANGED
@@ -4655,7 +4655,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
4655
4655
  ],
4656
4656
  "hc": [
4657
4657
  "h23",
4658
- ""
4658
+ "",
4659
+ "h12"
4659
4660
  ]
4660
4661
  },
4661
4662
  "locale": "tr"
package/locale-data/tt.js CHANGED
@@ -4486,7 +4486,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
4486
4486
  "gregory"
4487
4487
  ],
4488
4488
  "hc": [
4489
- "h23"
4489
+ "h23",
4490
+ "h12"
4490
4491
  ]
4491
4492
  },
4492
4493
  "locale": "tt"
@@ -2103,7 +2103,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
2103
2103
  "islamic-tbla"
2104
2104
  ],
2105
2105
  "hc": [
2106
- "h23"
2106
+ "h23",
2107
+ "h12"
2107
2108
  ]
2108
2109
  },
2109
2110
  "locale": "twq"
@@ -4501,7 +4501,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
4501
4501
  ],
4502
4502
  "hc": [
4503
4503
  "h23",
4504
- ""
4504
+ "",
4505
+ "h12"
4505
4506
  ]
4506
4507
  },
4507
4508
  "locale": "yo-BJ"
@@ -4803,7 +4803,8 @@ if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'funct
4803
4803
  ],
4804
4804
  "hc": [
4805
4805
  "h23",
4806
- ""
4806
+ "",
4807
+ "h12"
4807
4808
  ]
4808
4809
  },
4809
4810
  "locale": "yrl"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
3
  "description": "Intl.DateTimeFormat polyfill",
4
- "version": "7.2.3",
4
+ "version": "7.2.4",
5
5
  "license": "MIT",
6
6
  "author": "Long Ho <holevietlong@gmail.com>",
7
7
  "type": "module",
@@ -18,8 +18,8 @@
18
18
  "dependencies": {
19
19
  "decimal.js": "^10.6.0",
20
20
  "tslib": "^2.8.1",
21
- "@formatjs/intl-localematcher": "0.8.1",
22
- "@formatjs/ecma402-abstract": "3.1.1"
21
+ "@formatjs/ecma402-abstract": "3.1.1",
22
+ "@formatjs/intl-localematcher": "0.8.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@formatjs/intl-getcanonicallocales": "3.2.1",
package/polyfill.iife.js CHANGED
@@ -8493,6 +8493,18 @@
8493
8493
  DateTimeFormat.relevantExtensionKeys = ["nu", "ca", "hc"];
8494
8494
  DateTimeFormat.__defaultTimeZone = DEFAULT_TIMEZONE;
8495
8495
  DateTimeFormat.getDefaultTimeZone = () => DateTimeFormat.__defaultTimeZone;
8496
+ function findIntervalFormat(skeleton, intervalFormats) {
8497
+ const commaIdx = skeleton.indexOf(", ");
8498
+ if (commaIdx === -1)
8499
+ return void 0;
8500
+ const datePart = skeleton.slice(0, commaIdx);
8501
+ const timePart = skeleton.slice(commaIdx + 2);
8502
+ const canonical = timePart.replace(/[^a-zA-Z]/g, "").replace(/[abB]/g, "").replace(/(.)\1+/g, "$1");
8503
+ if (canonical === timePart)
8504
+ return void 0;
8505
+ const canonicalKey = `${datePart}, ${canonical}`;
8506
+ return intervalFormats[canonicalKey];
8507
+ }
8496
8508
  DateTimeFormat.__addLocaleData = function __addLocaleData(...data2) {
8497
8509
  for (const { data: d, locale } of data2) {
8498
8510
  const _a = d, {
@@ -8535,7 +8547,7 @@
8535
8547
  (skeleton) => parseDateTimeSkeleton(
8536
8548
  skeleton,
8537
8549
  formats[calendar][skeleton],
8538
- intervalFormats[skeleton],
8550
+ intervalFormats[skeleton] || findIntervalFormat(skeleton, intervalFormats),
8539
8551
  intervalFormats.intervalFormatFallback
8540
8552
  )
8541
8553
  );
package/src/core.js CHANGED
@@ -198,6 +198,25 @@ DateTimeFormat.relevantExtensionKeys = [
198
198
  ];
199
199
  DateTimeFormat.__defaultTimeZone = DEFAULT_TIMEZONE;
200
200
  DateTimeFormat.getDefaultTimeZone = () => DateTimeFormat.__defaultTimeZone;
201
+ /**
202
+ * GH #4535: When a format skeleton uses raw pattern form (e.g., "MMMEd, h:mm a")
203
+ * instead of canonical form (e.g., "MMMEd, hm"), interval formats won't match
204
+ * by exact key. This function finds the matching canonical interval format by
205
+ * normalizing the time portion of the skeleton.
206
+ */
207
+ function findIntervalFormat(skeleton, intervalFormats) {
208
+ const commaIdx = skeleton.indexOf(", ");
209
+ if (commaIdx === -1) return undefined;
210
+ const datePart = skeleton.slice(0, commaIdx);
211
+ const timePart = skeleton.slice(commaIdx + 2);
212
+ // Canonicalize the time part: strip non-skeleton chars (colons, spaces),
213
+ // remove AM/PM markers (a/b/B are implied by h/K hour symbols),
214
+ // and collapse repeated field chars (hh→h, mm→m, ss→s)
215
+ const canonical = timePart.replace(/[^a-zA-Z]/g, "").replace(/[abB]/g, "").replace(/(.)\1+/g, "$1");
216
+ if (canonical === timePart) return undefined;
217
+ const canonicalKey = `${datePart}, ${canonical}`;
218
+ return intervalFormats[canonicalKey];
219
+ }
201
220
  DateTimeFormat.__addLocaleData = function __addLocaleData(...data) {
202
221
  for (const { data: d, locale } of data) {
203
222
  const { dateFormat, timeFormat, dateTimeFormat, formats, intervalFormats, ...rawData } = d;
@@ -225,7 +244,7 @@ DateTimeFormat.__addLocaleData = function __addLocaleData(...data) {
225
244
  formats: {}
226
245
  };
227
246
  for (const calendar in formats) {
228
- processedData.formats[calendar] = Object.keys(formats[calendar]).map((skeleton) => parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback));
247
+ processedData.formats[calendar] = Object.keys(formats[calendar]).map((skeleton) => parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton] || findIntervalFormat(skeleton, intervalFormats), intervalFormats.intervalFormatFallback));
229
248
  }
230
249
  const minimizedLocale = new Intl.Locale(locale).minimize().toString();
231
250
  DateTimeFormat.localeData[locale] = DateTimeFormat.localeData[minimizedLocale] = processedData;
package/test262-main.js CHANGED
@@ -5427,7 +5427,11 @@ Intl.DateTimeFormat.__addLocaleData({
5427
5427
  hourCycle: "h23",
5428
5428
  nu: ["latn"],
5429
5429
  ca: ["gregory"],
5430
- hc: ["h23", ""]
5430
+ hc: [
5431
+ "h23",
5432
+ "",
5433
+ "h12"
5434
+ ]
5431
5435
  },
5432
5436
  locale: "de"
5433
5437
  }, {