@brightspace-ui/intl 3.48.4 → 3.48.6

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/dateTime.js CHANGED
@@ -643,6 +643,19 @@ export function convertLocalToUTCDateTime(date) {
643
643
  };
644
644
  }
645
645
 
646
+ function convertLocalDateToInstant(date) {
647
+ if (!getDocumentLocaleSettings().timezone.identifier) return date;
648
+ const utc = convertLocalToUTCDateTime({
649
+ year: date.getFullYear(),
650
+ month: date.getMonth() + 1,
651
+ date: date.getDate(),
652
+ hours: date.getHours(),
653
+ minutes: date.getMinutes(),
654
+ seconds: date.getSeconds()
655
+ });
656
+ return new Date(Date.UTC(utc.year, utc.month - 1, utc.date, utc.hours, utc.minutes, utc.seconds));
657
+ }
658
+
646
659
  export function convertUTCToLocalDateTime(date) {
647
660
  if (!getDocumentLocaleSettings().timezone.identifier) {
648
661
  return date;
@@ -872,7 +885,7 @@ export function getDateTimeDescriptor() {
872
885
 
873
886
  export function formatTime(date, options = {}) {
874
887
 
875
- if (options.skeleton) return formatDateTimeSkeleton(date, options, { date: false });
888
+ if (options.skeleton) return formatDateTimeSkeleton(convertLocalDateToInstant(date), options, { date: false });
876
889
 
877
890
  const descriptor = getDateTimeDescriptor();
878
891
  const settings = getDocumentLocaleSettings();
@@ -970,7 +983,7 @@ export function parseTime(input, options) {
970
983
 
971
984
  export function formatDate(date, options = {}) {
972
985
 
973
- if (options.skeleton) return formatDateTimeSkeleton(date, options, { time: false });
986
+ if (options.skeleton) return formatDateTimeSkeleton(convertLocalDateToInstant(date), options, { time: false });
974
987
 
975
988
  const descriptor = getDateTimeDescriptor();
976
989
 
@@ -1054,7 +1067,7 @@ export function parseDate(input) {
1054
1067
 
1055
1068
  export function formatDateTime(date, options = {}) {
1056
1069
 
1057
- if (options.skeleton) return formatDateTimeSkeleton(date, options);
1070
+ if (options.skeleton) return formatDateTimeSkeleton(convertLocalDateToInstant(date), options);
1058
1071
 
1059
1072
  const format = options.format || 'short';
1060
1073
 
@@ -5,7 +5,7 @@ import { localeData } from './locale-data/current.js';
5
5
  const documentLocaleSettings = getDocumentLocaleSettings();
6
6
 
7
7
  export function formatDateTimeSkeleton(dateTime, options = {}) {
8
- const { date = true, time = true, locale } = arguments[2] || {};
8
+ const { date = true, time = true } = arguments[2] || {};
9
9
 
10
10
  const {
11
11
  timezone: timeZone =
@@ -72,7 +72,7 @@ export function formatDateTimeSkeleton(dateTime, options = {}) {
72
72
  });
73
73
  }
74
74
  };
75
- const dateFormatter = new IntlMessageFormat(msg, locale || documentLocaleSettings.language, null, { formatters });
75
+ const dateFormatter = new IntlMessageFormat(msg, localeData.sourceLocale, null, { formatters });
76
76
  const formatted = dateFormatter.format({ dateTime });
77
77
  return formatted;
78
78
  }
@@ -1,8 +1,8 @@
1
1
  export default {
2
- languageDisplayName: "català",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Català",
3
+ territoryDisplayName: "Espanya",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "català",
5
+ localeDisplayName: "Català (Espanya)",
6
6
  sourceLocale: "ca",
7
7
  localeCode: "ca",
8
8
  likelySubtag: "ca-Latn-ES",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Cymraeg",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Y Deyrnas Unedig",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Cymraeg",
5
+ localeDisplayName: "Cymraeg (Y Deyrnas Unedig)",
6
6
  sourceLocale: "cy",
7
7
  localeCode: "cy",
8
8
  likelySubtag: "cy-Latn-GB",
@@ -1,8 +1,8 @@
1
1
  export default {
2
- languageDisplayName: "dansk",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Dansk",
3
+ territoryDisplayName: "danmark",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "dansk",
5
+ localeDisplayName: "Dansk (danmark)",
6
6
  sourceLocale: "da",
7
7
  localeCode: "da",
8
8
  likelySubtag: "da-Latn-DK",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Deutsch",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Deutschland",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Deutsch",
5
+ localeDisplayName: "Deutsch (Deutschland)",
6
6
  sourceLocale: "de",
7
7
  localeCode: "de",
8
8
  likelySubtag: "de-Latn-DE",
@@ -4,7 +4,7 @@ export default {
4
4
  scriptDisplayName: "",
5
5
  localeDisplayName: "English (Canada)",
6
6
  sourceLocale: "en-CA",
7
- localeCode: "en-CA",
7
+ localeCode: "en-ca",
8
8
  likelySubtag: "en-Latn-CA",
9
9
  layout: {
10
10
  orientation: {
@@ -4,7 +4,7 @@ export default {
4
4
  scriptDisplayName: "",
5
5
  localeDisplayName: "English (United Kingdom)",
6
6
  sourceLocale: "en-GB",
7
- localeCode: "en-GB",
7
+ localeCode: "en-gb",
8
8
  likelySubtag: "en-Latn-GB",
9
9
  layout: {
10
10
  orientation: {
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "English",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "United States",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "English",
5
+ localeDisplayName: "English (United States)",
6
6
  sourceLocale: "en",
7
7
  localeCode: "en",
8
8
  likelySubtag: "en-Latn-US",
@@ -1,10 +1,10 @@
1
1
  export default {
2
- languageDisplayName: "español",
2
+ languageDisplayName: "Español",
3
3
  territoryDisplayName: "Latinoamérica",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "español (Latinoamérica)",
5
+ localeDisplayName: "Español (Latinoamérica)",
6
6
  sourceLocale: "es-419",
7
- localeCode: "es-419",
7
+ localeCode: "es",
8
8
  likelySubtag: "es-Latn-419",
9
9
  layout: {
10
10
  orientation: {
@@ -34,26 +34,22 @@ export default {
34
34
  short: "dd/MM/y"
35
35
  },
36
36
  dateFormatItems: {
37
- Ehm: "E h:mm a",
38
37
  EHm: "E HH:mm",
39
- Ehms: "E h:mm:ss a",
40
38
  EHms: "E HH:mm:ss",
41
39
  GyMMMd: "d MMM y G",
42
- Hmsvvvv: "HH:mm:ss (vvvv)",
43
- MMd: "d/MM",
44
- MMdd: "dd/MM",
45
- MMMEd: "E d 'de' MMM",
46
- yMEd: "E, d/M/y",
47
- yMM: "MM/y",
48
- yMMMEd: "EEE, d 'de' MMM 'de' y",
49
- yQQQ: "QQQ y",
50
40
  H: "HH",
51
41
  Hm: "HH:mm",
52
42
  Hms: "HH:mm:ss",
53
43
  Hmsv: "HH:mm:ss v",
44
+ Hmsvvvv: "HH:mm:ss (vvvv)",
54
45
  Hmv: "HH:mm v",
55
46
  MMMdd: "dd-MMM",
47
+ yMEd: "E, d/M/y",
48
+ yMMMEd: "EEE, d 'de' MMM 'de' y",
49
+ yQQQ: "QQQ y",
56
50
  Ed: "E d",
51
+ Ehm: "E h:mm a",
52
+ Ehms: "E h:mm:ss a",
57
53
  Gy: "y G",
58
54
  GyM: "M/y G",
59
55
  GyMd: "d/M/y G",
@@ -71,12 +67,16 @@ export default {
71
67
  Hv: "H 'h' v",
72
68
  Md: "d/M",
73
69
  MEd: "E, d/M",
70
+ MMd: "d/MM",
71
+ MMdd: "dd/MM",
74
72
  MMMd: "d 'de' MMM",
73
+ MMMEd: "E d 'de' MMM",
75
74
  MMMMd: "d 'de' MMMM",
76
75
  MMMMEd: "E, d 'de' MMMM",
77
76
  MMMMW: "'semana' W 'de' MMMM",
78
77
  yM: "M/y",
79
78
  yMd: "d/M/y",
79
+ yMM: "MM/y",
80
80
  yMMM: "MMMM 'de' y",
81
81
  yMMMd: "d MMM y",
82
82
  yMMMM: "MMMM y",
@@ -138,22 +138,22 @@ export default {
138
138
  },
139
139
  standAlone: {
140
140
  abbreviated: {
141
- am: "a. m.",
142
- pm: "p. m.",
143
141
  noon: "mediodía",
144
142
  morning1: "madrugada",
145
143
  morning2: "mañana",
146
144
  evening1: "tarde",
147
- night1: "noche"
145
+ night1: "noche",
146
+ am: "a. m.",
147
+ pm: "p. m."
148
148
  },
149
149
  narrow: {
150
- am: "a. m.",
151
- pm: "p. m.",
152
150
  noon: "mediodía",
153
151
  morning1: "madrugada",
154
152
  morning2: "mañana",
155
153
  evening1: "tarde",
156
- night1: "noche"
154
+ night1: "noche",
155
+ am: "a. m.",
156
+ pm: "p. m."
157
157
  },
158
158
  wide: {
159
159
  am: "a. m.",
@@ -1,10 +1,10 @@
1
1
  export default {
2
- languageDisplayName: "español",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Español",
3
+ territoryDisplayName: "España",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "español",
5
+ localeDisplayName: "Español (España)",
6
6
  sourceLocale: "es",
7
- localeCode: "es",
7
+ localeCode: "es-es",
8
8
  likelySubtag: "es-Latn-ES",
9
9
  layout: {
10
10
  orientation: {
@@ -1,10 +1,10 @@
1
1
  export default {
2
- languageDisplayName: "français",
3
- territoryDisplayName: "Canada",
2
+ languageDisplayName: "Français",
3
+ territoryDisplayName: "Ontario",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "français (Canada, Ontario)",
5
+ localeDisplayName: "Français (Ontario)",
6
6
  sourceLocale: "fr-CA",
7
- localeCode: "fr-CA-u-sd-caon",
7
+ localeCode: "fr-on",
8
8
  likelySubtag: "fr-Latn-CA",
9
9
  layout: {
10
10
  orientation: {
@@ -1,10 +1,10 @@
1
1
  export default {
2
- languageDisplayName: "français",
2
+ languageDisplayName: "Français",
3
3
  territoryDisplayName: "Canada",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "français (Canada)",
5
+ localeDisplayName: "Français (Canada)",
6
6
  sourceLocale: "fr-CA",
7
- localeCode: "fr-CA",
7
+ localeCode: "fr",
8
8
  likelySubtag: "fr-Latn-CA",
9
9
  layout: {
10
10
  orientation: {
@@ -1,10 +1,10 @@
1
1
  export default {
2
- languageDisplayName: "français",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Français",
3
+ territoryDisplayName: "France",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "français",
5
+ localeDisplayName: "Français (France)",
6
6
  sourceLocale: "fr",
7
- localeCode: "fr",
7
+ localeCode: "fr-fr",
8
8
  likelySubtag: "fr-Latn-FR",
9
9
  layout: {
10
10
  orientation: {
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  languageDisplayName: "Gaeilge",
3
+ territoryDisplayName: "",
4
+ scriptDisplayName: "",
3
5
  localeDisplayName: "Gaeilge",
4
6
  sourceLocale: "ga",
5
7
  localeCode: "ga",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "ʻŌlelo Hawaiʻi",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "ʻAmelika Hui Pū ʻIa",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "ʻŌlelo Hawaiʻi",
5
+ localeDisplayName: "ʻŌlelo Hawaiʻi (ʻAmelika Hui Pū ʻIa)",
6
6
  sourceLocale: "haw",
7
7
  localeCode: "haw",
8
8
  likelySubtag: "haw-Latn-US",
@@ -1,8 +1,8 @@
1
1
  export default {
2
- languageDisplayName: "हिन्दी",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "हिंदी",
3
+ territoryDisplayName: "भारत",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "हिन्दी",
5
+ localeDisplayName: "हिंदी (भारत)",
6
6
  sourceLocale: "hi",
7
7
  localeCode: "hi",
8
8
  likelySubtag: "hi-Deva-IN",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "日本語",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "日本",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "日本語",
5
+ localeDisplayName: "日本語 (日本)",
6
6
  sourceLocale: "ja",
7
7
  localeCode: "ja",
8
8
  likelySubtag: "ja-Jpan-JP",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "한국어",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "대한민국",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "한국어",
5
+ localeDisplayName: "한국어 (대한민국)",
6
6
  sourceLocale: "ko",
7
7
  localeCode: "ko",
8
8
  likelySubtag: "ko-Kore-KR",
@@ -112,9 +112,7 @@ export default {
112
112
  evening1: "저녁",
113
113
  night1: "밤",
114
114
  am: "오전",
115
- pm: "오후",
116
- _original_am: "AM",
117
- _original_pm: "PM"
115
+ pm: "오후"
118
116
  },
119
117
  narrow: {
120
118
  midnight: "자정",
@@ -125,9 +123,7 @@ export default {
125
123
  evening1: "저녁",
126
124
  night1: "밤",
127
125
  am: "오전",
128
- pm: "오후",
129
- _original_am: "AM",
130
- _original_pm: "PM"
126
+ pm: "오후"
131
127
  },
132
128
  wide: {
133
129
  am: "오전",
@@ -151,9 +147,7 @@ export default {
151
147
  evening1: "저녁",
152
148
  night1: "밤",
153
149
  am: "아침",
154
- pm: "오후",
155
- _original_am: "AM",
156
- _original_pm: "PM"
150
+ pm: "오후"
157
151
  },
158
152
  narrow: {
159
153
  midnight: "자정",
@@ -164,9 +158,7 @@ export default {
164
158
  evening1: "저녁",
165
159
  night1: "밤",
166
160
  am: "아침",
167
- pm: "오후",
168
- _original_am: "AM",
169
- _original_pm: "PM"
161
+ pm: "오후"
170
162
  },
171
163
  wide: {
172
164
  am: "오전",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Māori",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Aotearoa",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Māori",
5
+ localeDisplayName: "Māori (Aotearoa)",
6
6
  sourceLocale: "mi",
7
7
  localeCode: "mi",
8
8
  likelySubtag: "mi-Latn-NZ",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Nederlands",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Nederland",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Nederlands",
5
+ localeDisplayName: "Nederlands (Nederland)",
6
6
  sourceLocale: "nl",
7
7
  localeCode: "nl",
8
8
  likelySubtag: "nl-Latn-NL",
@@ -1,8 +1,8 @@
1
1
  export default {
2
- languageDisplayName: "português",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Português",
3
+ territoryDisplayName: "Brasil",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "português",
5
+ localeDisplayName: "Português (Brasil)",
6
6
  sourceLocale: "pt",
7
7
  localeCode: "pt",
8
8
  likelySubtag: "pt-Latn-BR",
@@ -1,8 +1,8 @@
1
1
  export default {
2
- languageDisplayName: "svenska",
3
- territoryDisplayName: "",
2
+ languageDisplayName: "Svenska",
3
+ territoryDisplayName: "Sverige",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "svenska",
5
+ localeDisplayName: "Svenska (Sverige)",
6
6
  sourceLocale: "sv",
7
7
  localeCode: "sv",
8
8
  likelySubtag: "sv-Latn-SE",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "ไทย",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "ไทย",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "ไทย",
5
+ localeDisplayName: "ไทย (ไทย)",
6
6
  sourceLocale: "th",
7
7
  localeCode: "th",
8
8
  likelySubtag: "th-Thai-TH",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Türkçe",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Türkiye",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Türkçe",
5
+ localeDisplayName: "Türkçe (Türkiye)",
6
6
  sourceLocale: "tr",
7
7
  localeCode: "tr",
8
8
  likelySubtag: "tr-Latn-TR",
@@ -1,5 +1,7 @@
1
1
  export default {
2
2
  languageDisplayName: "اردو",
3
+ territoryDisplayName: "",
4
+ scriptDisplayName: "",
3
5
  localeDisplayName: "اردو",
4
6
  sourceLocale: "ur",
5
7
  localeCode: "ur",
@@ -1,8 +1,8 @@
1
1
  export default {
2
2
  languageDisplayName: "Tiếng Việt",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "Việt Nam",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "Tiếng Việt",
5
+ localeDisplayName: "Tiếng Việt (Việt Nam)",
6
6
  sourceLocale: "vi",
7
7
  localeCode: "vi",
8
8
  likelySubtag: "vi-Latn-VN",
@@ -1,10 +1,10 @@
1
1
  export default {
2
2
  languageDisplayName: "中文",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "繁体",
4
4
  scriptDisplayName: "繁體",
5
- localeDisplayName: "中文 (繁體)",
5
+ localeDisplayName: "中文(繁体)",
6
6
  sourceLocale: "zh-Hant",
7
- localeCode: "zh-Hant",
7
+ localeCode: "zh-tw",
8
8
  likelySubtag: "zh-Hant-TW",
9
9
  layout: {
10
10
  orientation: {
@@ -1,10 +1,10 @@
1
1
  export default {
2
2
  languageDisplayName: "中文",
3
- territoryDisplayName: "",
3
+ territoryDisplayName: "简体",
4
4
  scriptDisplayName: "",
5
- localeDisplayName: "中文",
5
+ localeDisplayName: "中文(简体)",
6
6
  sourceLocale: "zh",
7
- localeCode: "zh",
7
+ localeCode: "zh-cn",
8
8
  likelySubtag: "zh-Hans-CN",
9
9
  layout: {
10
10
  orientation: {
@@ -11,7 +11,7 @@ export const supportedLocalesDetails = [
11
11
  { id: 11, code: 'en-gb', source: 'en-GB', pack: 'en-gb', dir: 'ltr', name: 'English (United Kingdom)' },
12
12
  { id: 1, code: 'en-us', source: 'en', pack: 'en', dir: 'ltr', name: 'English (United States)' },
13
13
  { id: 30, code: 'es-es', source: 'es', pack: 'es-es', dir: 'ltr', name: 'Español (España)' },
14
- { id: 18, code: 'es-mx', source: 'es-MX', pack: 'es', overrideCode: 'es-419', dir: 'ltr', name: 'Español (Latinoamérica)' },
14
+ { id: 18, code: 'es-mx', source: 'es-419', pack: 'es', overrideCode: 'es-419', dir: 'ltr', name: 'Español (Latinoamérica)' },
15
15
  { id: 2, code: 'fr-ca', source: 'fr-CA', pack: 'fr', dir: 'ltr', name: 'Français (Canada)' },
16
16
  { id: 29, code: 'fr-fr', source: 'fr', pack: 'fr-fr', dir: 'ltr', name: 'Français (France)' },
17
17
  { id: 32, code: 'fr-on', source: 'fr-CA', pack: 'fr-on', overrideCode: 'fr-CA-u-sd-caon', dir: 'ltr', name: 'Français (Ontario)' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/intl",
3
- "version": "3.48.4",
3
+ "version": "3.48.6",
4
4
  "description": "Internationalization APIs for number, date, time and file size formatting and parsing in D2L Brightspace.",
5
5
  "main": "lib/number.js",
6
6
  "type": "module",