@procore/globalization-toolkit 3.0.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.depcheckrc +3 -5
  4. package/CHANGELOG.md +9 -6
  5. package/README.md +133 -74
  6. package/dist/dateTimes/DateTimeFormatter.d.ts +2 -0
  7. package/dist/dateTimes/DateTimeFormatter.js +22 -1
  8. package/dist/dateTimes/DateTimeFormatter.js.map +1 -1
  9. package/dist/getOverrideLocale/GetOverrideLocale.d.ts +3 -0
  10. package/dist/getOverrideLocale/GetOverrideLocale.js +51 -0
  11. package/dist/getOverrideLocale/GetOverrideLocale.js.map +1 -0
  12. package/dist/getOverrideLocale/GetOverrideLocale.types.d.ts +1 -0
  13. package/dist/getOverrideLocale/GetOverrideLocale.types.js +3 -0
  14. package/dist/getOverrideLocale/GetOverrideLocale.types.js.map +1 -0
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.js +5 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/tsconfig.build.tsbuildinfo +1 -1
  19. package/docs/assets/highlight.css +23 -16
  20. package/docs/assets/main.js +4 -3
  21. package/docs/assets/navigation.js +1 -0
  22. package/docs/assets/search.js +1 -1
  23. package/docs/assets/style.css +473 -370
  24. package/docs/classes/CurrencyFormatter.html +25 -172
  25. package/docs/classes/DateTimeFormatter.html +15 -151
  26. package/docs/classes/NumberFormatter.html +20 -179
  27. package/docs/functions/formatCurrency.html +5 -129
  28. package/docs/functions/formatCurrencyToParts.html +5 -129
  29. package/docs/functions/formatDateTime.html +5 -129
  30. package/docs/functions/formatDateTimeToParts.html +5 -129
  31. package/docs/functions/formatNumber.html +5 -129
  32. package/docs/functions/formatNumberToParts.html +5 -129
  33. package/docs/functions/getCurrencySeparators.html +4 -125
  34. package/docs/functions/getDatePartsWithPlaceholders.html +5 -129
  35. package/docs/functions/getDatePlaceholder.html +5 -129
  36. package/docs/functions/getNumberSeparators.html +4 -125
  37. package/docs/functions/getStartDayOfTheWeek.html +4 -125
  38. package/docs/functions/getSupportedCurrencies.html +4 -0
  39. package/docs/functions/parseCurrency.html +5 -129
  40. package/docs/functions/parseNumber.html +5 -129
  41. package/docs/index.html +74 -261
  42. package/docs/interfaces/CurrencyOptions.html +8 -108
  43. package/docs/interfaces/DateTimeOptionsBasic.html +4 -101
  44. package/docs/interfaces/DateTimeOptionsComponentsAll.html +14 -158
  45. package/docs/interfaces/DateTimeOptionsComponentsHourMinute.html +14 -158
  46. package/docs/interfaces/DateTimeOptionsComponentsHourMinuteSecond.html +14 -158
  47. package/docs/interfaces/DateTimeOptionsComponentsMonthDay.html +14 -158
  48. package/docs/interfaces/DateTimeOptionsComponentsWeekdayYearMonthDay.html +14 -158
  49. package/docs/interfaces/DateTimeOptionsComponentsYearMonth.html +14 -158
  50. package/docs/interfaces/DateTimeOptionsComponentsYearMonthDay.html +14 -158
  51. package/docs/interfaces/DateTimeOptionsStyle.html +14 -158
  52. package/docs/interfaces/NumberOptions.html +6 -94
  53. package/docs/modules.html +66 -186
  54. package/docs/types/CurrencyDisplay.html +1 -111
  55. package/docs/types/CurrencySign.html +1 -111
  56. package/docs/types/DateLabelOptions.html +1 -119
  57. package/docs/types/DateStyle.html +1 -111
  58. package/docs/types/DateTimeFormatPart.html +1 -110
  59. package/docs/types/DateTimeOptions.html +1 -110
  60. package/docs/types/DateTimeStyle.html +1 -111
  61. package/docs/types/Day.html +1 -111
  62. package/docs/types/FormatterOptions.html +1 -115
  63. package/docs/types/Hour.html +1 -111
  64. package/docs/types/Locale.html +1 -110
  65. package/docs/types/Minute.html +1 -111
  66. package/docs/types/Month.html +1 -111
  67. package/docs/types/NumberFormatPart.html +1 -110
  68. package/docs/types/NumericTwoDigit.html +1 -111
  69. package/docs/types/Percent.html +1 -111
  70. package/docs/types/Second.html +1 -111
  71. package/docs/types/Separators.html +1 -117
  72. package/docs/types/TimeStyle.html +1 -111
  73. package/docs/types/TimeZoneName.html +1 -111
  74. package/docs/types/Weekday.html +1 -111
  75. package/docs/types/Year.html +1 -111
  76. package/docs/variables/CurrencyDisplay-1.html +1 -122
  77. package/docs/variables/CurrencySign-1.html +1 -118
  78. package/docs/variables/DateStyle-1.html +1 -122
  79. package/docs/variables/DateTimeStyle-1.html +1 -122
  80. package/docs/variables/Day-1.html +1 -118
  81. package/docs/variables/Hour-1.html +1 -118
  82. package/docs/variables/Minute-1.html +1 -118
  83. package/docs/variables/Month-1.html +1 -124
  84. package/docs/variables/NumericTwoDigit-1.html +1 -118
  85. package/docs/variables/Percent-1.html +1 -118
  86. package/docs/variables/Second-1.html +1 -118
  87. package/docs/variables/TimeStyle-1.html +1 -122
  88. package/docs/variables/TimeZoneName-1.html +1 -118
  89. package/docs/variables/Weekday-1.html +1 -120
  90. package/docs/variables/Year-1.html +1 -118
  91. package/package.json +15 -47
  92. package/sonar-project.properties +1 -1
  93. package/tsconfig.build.json +2 -2
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3
+ "changelog": "@changesets/cli/changelog",
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "restricted",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
package/.depcheckrc CHANGED
@@ -1,8 +1,6 @@
1
1
  ignores:
2
- - "cz-conventional-changelog"
3
- - "@commitlint/cli"
4
- - "@commitlint/config-conventional"
5
2
  - "@types/jest"
6
- - semantic-release
3
+ - "@types/node"
7
4
  - ts-node
8
- - ts-jest
5
+ - ts-jest
6
+ - "@commitlint/config-conventional"
package/CHANGELOG.md CHANGED
@@ -1,11 +1,14 @@
1
- # 0.1.0
1
+ # @procore/globalization-toolkit
2
2
 
3
- - test semantic release
3
+ ## 3.2.0
4
4
 
5
- # 0.0.2
5
+ ### Minor Changes
6
6
 
7
- - test automatic release
7
+ - 2434255: locale override mappings added
8
+ - 8bb8e1e: added locale fallback list method
8
9
 
9
- # 0.0.1
10
+ ## 3.1.0
10
11
 
11
- - test
12
+ ### Minor Changes
13
+
14
+ - feat(datetimeformatter): implement formatDateTimeToLocalISOString method
package/README.md CHANGED
@@ -6,10 +6,10 @@ i18n formatting library
6
6
  [![CircleCI](https://circleci.com/gh/procore/globalization-toolkit/tree/main.svg?style=shield&circle-token=2f3787c62ef88e345956761b9d6e243f043a08a7)](https://circleci.com/gh/procore/globalization-toolkit/tree/main)
7
7
  [![NPM](https://img.shields.io/badge/NPM-%40procore%2Fglobalization--toolkit-blue)](https://www.npmjs.com/package/@procore/globalization-toolkit)
8
8
 
9
- Before implementing the Globalization Toolkit (GTK), please review the [Globalization Toolkit Adoption Diagram](https://lucid.app/lucidchart/47c65380-9d87-409a-a15e-77c668e4c474/edit?invitationId=inv_abb5b5f8-3d6f-499f-920d-6dc6b7c9734c&page=0_0#) to determine the best implementation strategy for you. Continue reading for instructions on direct usage of the GTK.
9
+ Before implementing the Globalization Toolkit (GTK), please review the [Globalization Toolkit Adoption Diagram](https://lucid.app/lucidchart/47c65380-9d87-409a-a15e-77c668e4c474/edit?invitationId=inv_abb5b5f8-3d6f-499f-920d-6dc6b7c9734c&page=0_0#) to determine the best implementation strategy for you. Continue reading for instructions on direct usage of the GTK.
10
10
 
11
11
  ## [Engineering Documentation](https://procore.github.io/globalization-toolkit/)
12
- The engineering documentation contains technical documentation for the GTK repo. It details classes, types, interfaces, and features. Continue reading for install and usage instructions.
12
+ The engineering documentation contains technical documentation for the GTK repo. It details classes, types, interfaces, and features. Continue reading for install and usage instructions.
13
13
  Further reading on the GTK:
14
14
  - [GTK Adoption Training Presentation](https://docs.google.com/presentation/d/1FtB2DR5qroKgGcxxWsu5Ac9QHA01I7WM75FUeB67izE/edit?usp=sharing)
15
15
  - [GTK SDR](https://github.com/procore/system-design-records/blob/main/lifecycle/2-pilot/internationalization/0002-globalization-toolkit.md)
@@ -25,17 +25,28 @@ YARN
25
25
  $ yarn add @procore/globalization-toolkit
26
26
  ```
27
27
  ## Usage
28
- The GTK has 3 available classes: `NumberFormatter`, `DateTimeFormatter`, `CurrencyFormatter`. The structure of the GTK Library allows for instantiation of a formatting class with defined options. The instantiated class gives access to related functions. In addition, the GTK makes the class functions available as stand-alone functions. Below are examples of GTK usage with class formatter and with stand-alone functions.
28
+ The GTK has 3 available classes: `NumberFormatter`, `DateTimeFormatter`, `CurrencyFormatter`. The structure of the GTK Library allows for instantiation of a formatting class with defined options. The instantiated class gives access to related functions. In addition, the GTK makes the class functions available as stand-alone functions. Below are examples of GTK usage with class formatter and with stand-alone functions.
29
+
30
+ ### Sanitizing Locales
31
+ The GTK supports industry standard locale codes, which means some locales used in the Procore app will not work with the GTK or may not work as expected. For example, the GTK does NOT support [Procore Custom Locales](https://procoretech.atlassian.net/wiki/spaces/PLATFORM/pages/1039111578/Levels+of+Support+for+Locales+Product+Coverage#Custom-Locales). When implementing the GTK, please sanitize the locale to follow industry standard of `<language>-<region>` like `en-US`.
32
+
33
+ Suggested sanitizations:
34
+ | User Locale | Locale Passed to GTK | Reason |
35
+ |-|-|-|
36
+ | `en-international` | `en-GB` | Custom locales are not supported |
37
+ | `en-owner` | `en-US` | Custom locales are not supported |
38
+ | `en-owner-beta` | `en-US` | Custom locales are not supported |
39
+ | `en-specialty-contractor` | `en-US` | Custom locales are not supported |
40
+ | `en` | `en-US` | `en` will work as expected, but prefer `<language>-<region>` format |
41
+ | `es` | `es-419` | `es` is used for Latin America in the monolith but will format numbers like `es-ES` in the GTK if the region is not specified |
29
42
 
30
- ### A Note on Locales
31
- The GTK supports industry standard locale codes. The GTK does NOT support [Procore Custom Locales](https://procoretech.atlassian.net/wiki/spaces/PLATFORM/pages/1039111578/Levels+of+Support+for+Locales+Product+Coverage#Custom-Locales). When implementing the GTK, please sanitize the locale to follow industry standard of 'region-language' like 'en-US'.
32
43
 
33
44
  ### NumberFormatter Class
34
- The GTK `NumberFormatter` class has the ability to format numbers for a given locale. The [NumberFormatter](https://procore.github.io/globalization-toolkit/classes/NumberFormatter) class is instantiated with [NumberOptions](https://procore.github.io/globalization-toolkit/interfaces/NumberOptions.html) and has 4 available functions:
35
- - `formatNumber(value: number)`,
36
- - `formatNumberToParts(value: number)`,
37
- - `parseNumber(value: string)`, and
38
- - `getNumberSeparators(locale: string)`.
45
+ The GTK `NumberFormatter` class has the ability to format numbers for a given locale. The [NumberFormatter](https://procore.github.io/globalization-toolkit/classes/NumberFormatter) class is instantiated with [NumberOptions](https://procore.github.io/globalization-toolkit/interfaces/NumberOptions.html) and has 4 available functions:
46
+ - `formatNumber(value: number)`,
47
+ - `formatNumberToParts(value: number)`,
48
+ - `parseNumber(value: string)`, and
49
+ - `getNumberSeparators(locale: string)`.
39
50
 
40
51
  The [NumberOptions](https://procore.github.io/globalization-toolkit/interfaces/CurrencyOptions.html) are summarized below:
41
52
  - `locale`: string
@@ -43,7 +54,7 @@ The [NumberOptions](https://procore.github.io/globalization-toolkit/interfaces/C
43
54
  - `minimumFractionDigits?`: number
44
55
  - `percent?`: 'standard', 'decimal'
45
56
 
46
- Below code blocks display usage of the NumberFormatter class and available functions.
57
+ Below code blocks display usage of the NumberFormatter class and available functions.
47
58
  #### [formatNumber()](https://procore.github.io/globalization-toolkit/classes/NumberFormatter.html#formatNumber) & [formatNumberToParts()](https://procore.github.io/globalization-toolkit/classes/NumberFormatter.html#formatNumberToParts)
48
59
  ```ts
49
60
  import { NumberFormatter } from '@procore/globalization-toolkit';
@@ -111,14 +122,14 @@ const numberOptions = { locale: "en-US", minimumFractionDigits: 3 };
111
122
  console.log(formatNumber(value, numberOptions)) // expected output: '1,234.000'
112
123
  ```
113
124
  ### CurrencyFormatter class
114
- The GTK CurrencyFormatter class has the ability to format a number with given options. The [CurrencyFormatter](https://procore.github.io/globalization-toolkit/classes/CurrencyFormatter.html) class is instantiated with [CurrencyOptions](https://procore.github.io/globalization-toolkit/interfaces/CurrencyOptions.html).
115
- The CurrencyFormatter has 5 available functions:
116
- - `formatCurrency(value: number)`,
125
+ The GTK CurrencyFormatter class has the ability to format a number with given options. The [CurrencyFormatter](https://procore.github.io/globalization-toolkit/classes/CurrencyFormatter.html) class is instantiated with [CurrencyOptions](https://procore.github.io/globalization-toolkit/interfaces/CurrencyOptions.html).
126
+ The CurrencyFormatter has 5 available functions:
127
+ - `formatCurrency(value: number)`,
117
128
  - `formatCurrencyToParts(value: number)`
118
- - `parseCurrency(value: string)`
129
+ - `parseCurrency(value: string)`
119
130
  - `getCurrencySeparators()`
120
131
  - `getSupportedCurrencies()`
121
-
132
+
122
133
  The [CurrencyOptions](https://procore.github.io/globalization-toolkit/interfaces/CurrencyOptions.html) are summarized below:
123
134
  - `currencyIsoCode`: string ([acceptable ISO codes](https://github.com/formatjs/formatjs/blob/main/packages/intl-enumerator/src/currencies.generated.ts))
124
135
  - `locale`: string
@@ -127,14 +138,14 @@ The [CurrencyOptions](https://procore.github.io/globalization-toolkit/interfaces
127
138
  - `maximumFractionDigits?`: number
128
139
  - `minimumFractionDigits?`: number
129
140
 
130
- Below code blocks display usage of the CurrencyFormatter class and available functions.
141
+ Below code blocks display usage of the CurrencyFormatter class and available functions.
131
142
 
132
143
  [formatCurrency(value: number)](https://procore.github.io/globalization-toolkit/classes/CurrencyFormatter.html#formatCurrency)
133
144
  ```ts
134
145
  const value = 1234;
135
146
  const currencyOptions = { locale: "en-US", currencyIsoCode: "USD" };
136
147
  const formatter = new CurrencyFormatter(currencyOptions);
137
-
148
+
138
149
  console.log(formatter.formatCurrency(value)) // expected outcome: '$1,234.00'
139
150
  ```
140
151
  Usage with currencyDisplay option
@@ -222,7 +233,7 @@ console.log(formatter.getSupportedCurrencies())
222
233
  * "ALL",
223
234
  * ...
224
235
  * ...
225
- * "ZWL"
236
+ * "ZWL"
226
237
  * ]
227
238
  */
228
239
  ```
@@ -246,12 +257,12 @@ console.log(getCurrencySeparators(currencyOptions)) // expected output: { decima
246
257
  ```
247
258
 
248
259
  ### DateTimeFormatter
249
- The GTK DateTimeFormatter class has the ability to format date and time for the correct timezone. The [DateTimeFormatter](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html) class is instantiated with [DateTimeOptions](https://procore.github.io/globalization-toolkit/types/DateTimeOptions.html).
250
- The DateTimeFormatter has 3 available functions:
251
- - `formatDateTime(value: Date)`,
260
+ The GTK DateTimeFormatter class has the ability to format date and time for the correct timezone. The [DateTimeFormatter](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html) class is instantiated with [DateTimeOptions](https://procore.github.io/globalization-toolkit/types/DateTimeOptions.html).
261
+ The DateTimeFormatter has 3 available functions:
262
+ - `formatDateTime(value: Date)`,
252
263
  - `formatDateTimeToParts(value: Date)`, and
253
- - `getStartDayOfTheWeek()`
254
-
264
+ - `getStartDayOfTheWeek()`
265
+
255
266
  The DateTimeOptions can be used in two ways, but the two options cannot be combined. This follows the pattern of Intl.DateTimeFormat.
256
267
  1. Style Options:
257
268
  - timeStyle: 'short', 'medium', 'long', 'full'
@@ -265,8 +276,8 @@ The DateTimeOptions can be used in two ways, but the two options cannot be combi
265
276
  - minute: 'numeric', '2-digit'
266
277
  - second: 'numeric', '2-digit'
267
278
 
268
- Below code blocks display usage of the DateTimeFormatter class and available functions.
269
- [formatDateTime(value: Date)](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html#formatDateTime)
279
+ Below code blocks display usage of the DateTimeFormatter class and available functions.
280
+ [formatDateTime(value: Date)](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html#formatDateTime)
270
281
  SIMPLE OPTIONS
271
282
  ```ts
272
283
  import { DateTimeFormatter } from '@procore/globalization-toolkit';
@@ -315,7 +326,7 @@ const dateTimeOptions = {
315
326
  const formatter = new DateTimeFormatter(dateTimeOptions);
316
327
 
317
328
  console.log(formatter.formatDateTime(value))
318
- /** expected output:
329
+ /** expected output:
319
330
  * [ { type: "weekday", value: "Saturday", },
320
331
  * { type: "literal", value: ", ", },
321
332
  * { type: "day", value: "5", },
@@ -329,7 +340,25 @@ console.log(formatter.formatDateTime(value))
329
340
  * { type: "minute", value: "00",}, ];
330
341
  **/
331
342
  ```
332
- [getStartDayOfTheWeek()](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html#getStartDayOfTheWeek)
343
+ [formatDateTimeToLocalISOString(value: Date)]
344
+ This function returns a local ISO 8601 string.
345
+ This method was designed only for internal purposes.
346
+ Must not be used to display dates in the Procore UI.
347
+
348
+ ```ts
349
+ const value = new Date(Date.UTC(1955, 10, 5, 6, 0, 16, 738));
350
+ const dateTimeOptions = {
351
+ locale: "en-GB",
352
+ timeZone: "UTC",
353
+ dateStyle: DateStyle.FULL,
354
+ timeStyle: TimeStyle.SHORT,
355
+ };
356
+ const formatter = new DateTimeFormatter(dateTimeOptions);
357
+
358
+ console.log(formatter.formatDateTimeToLocalISOString(value))
359
+ // expected output: "1955-11-05";
360
+ ```
361
+ [getStartDayOfTheWeek()](https://procore.github.io/globalization-toolkit/classes/DateTimeFormatter.html#getStartDayOfTheWeek)
333
362
  This function returns an index value representing the start day of the week on the locale's calendar { Sunday: 0, Monday: 1 ...etc }
334
363
 
335
364
  ```ts
@@ -339,7 +368,7 @@ const formatter = new DateTimeFormatter(dateTimeOptions);
339
368
  console.log(formatter.startDayOfTheWeek()); // expected output: 0
340
369
  ```
341
370
  ### DateTimeFormatter Functions
342
- The functions used on the NumberFormatter class are also available as stand alone functions. Read more information about each function in the GTK Documentation.
371
+ The functions used on the DateTimeFormatter class are also available as stand alone functions. Read more information about each function in the GTK Documentation.
343
372
  - [formatDateTime()](https://procore.github.io/globalization-toolkit/functions/formatDateTime.html)
344
373
  - [formaDateTimeToParts()](https://procore.github.io/globalization-toolkit/functions/formatDateTimeToParts.html)
345
374
  - [getStartDayOfTheWeek(locale: string)](https://procore.github.io/globalization-toolkit/functions/getStartDayOfTheWeek.html)
@@ -352,6 +381,60 @@ const value = new Date(Date.UTC(1955, 10, 5, 6, 0, 16, 738));
352
381
  const dateTimeOptions = { locale: "en-US", timeZone: "UTC" };
353
382
 
354
383
  console.log(formatDateTime(value, dateTimeOptions)) // expected output: 11/5/1955
384
+ ```
385
+ ### GetOverrideLocale Function
386
+ The getOverrideLocale function returns a mapped locale based on predefined settings.
387
+ If the environment locale isn't directly supported, it provides a fallback from the predefined mappings.
388
+
389
+ Note: This override locale is meant for translation and should not be used directly with GTK formatting functions. For formatting, refer to the [Sanitizing Locales](#sanitizing-locales) section.
390
+
391
+ #### Usage
392
+ Here is an example of how to use the getOverrideLocale function:
393
+
394
+ ```ts
395
+ import { getOverrideLocale } from '@procore/globalization-toolkit';
396
+
397
+ // Example 1: Known supported locale
398
+ const locale1 = getOverrideLocale('ja-JP');
399
+ console.log(locale1); // Output: ja-JP
400
+
401
+ // Example 2: Fallback locale
402
+ const locale2 = getOverrideLocale('en-AE');
403
+ console.log(locale2); // Output: en-GB
404
+
405
+ // Example 3: Unknown locale
406
+ const locale3 = getOverrideLocale('unknown');
407
+ console.log(locale3); // Output: en
408
+
409
+ ```
410
+
411
+ ### `getFallbackLocaleList` Function
412
+ The `getFallbackLocaleList` function returns a list of locales which should have translation files loaded in the client, including fallbacks when available in addition to the English source.
413
+ If the environment locale is not supported directly, it overrides the locale according to predefined mappings.
414
+
415
+ ***Important***
416
+ This method should be only used by clients that don't support custom locales.
417
+
418
+ The example below shows usage of the standalone function: `getFallbackLocaleList()`.
419
+ ```ts
420
+ import { getFallbackLocaleList } from '@procore/globalization-toolkit';
421
+
422
+ // Example 1: Known supported locale
423
+ const locale1 = getFallbackLocaleList('ja-JP');
424
+ console.log(locale1); // Output: ['ja-JP', 'en']
425
+
426
+ // Example 2: Known supported locale with fallback available
427
+ const locale2 = getOverrideLocale('es-ES');
428
+ console.log(locale2); // Output: ['es-ES', 'es', 'en']
429
+
430
+ // Example 3: Unsupported locale
431
+ const locale3 = getOverrideLocale('en-AE');
432
+ console.log(locale3); // Output: ['en-GB', 'en']
433
+
434
+ // Example 4: Unknown/Custom locale (eg. en-owner)
435
+ const locale4 = getOverrideLocale('unknown');
436
+ console.log(locale4); // Output: ['en']
437
+
355
438
  ```
356
439
  ## Polyfills
357
440
  The GTK implementation relies heavily on [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) functionality. This is generally well-supported by browsers, but depending on the browser versions you intend to support and GTK features you plan to use, it may require polyfills. In particular, consumers have seen issues with Safari versions <14.1. If you intend to support older browser versions, we recommend using the [Format.JS polyfills](https://formatjs.io/docs/polyfills), of which `NumberFormat`, `PluralRules`, `Locale`, `GetCanonicalLocales`, and `supportedValuesOf` are the ones relevant to GTK. Please reach out if you have questions.
@@ -392,63 +475,36 @@ $ npm run test -- -u
392
475
 
393
476
  To check formatting run `npm run lint:check` and `npm run format:check`.
394
477
 
395
- ## Committing Changes
396
-
397
- Our repo follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
398
- and [Semantic Versioning](https://semver.org/) specifications.
399
- The Conventional Commit format is used to map commits to the next Semantic Version published to `NPM`,
400
- and helps to maintain a more easily readable commit history.
401
-
402
- Generally, commits should be in the format:
403
-
404
- ```text
405
- <type>[optional scope]: <description>
406
-
407
- [optional body]
408
-
409
- [optional footer(s)]
410
- ```
411
-
412
- We use the command line tool [`commitizen`](https://github.com/commitizen/cz-cli#using-the-command-line-tool) to help walk you through generating a Conventional Commit.
413
-
414
- **To invoke this tool run:**
478
+ To check dependencies run
415
479
 
416
480
  ```sh
417
- $ npm run cm
481
+ $ npm run depcheck
418
482
  ```
419
483
 
420
- (Optional: [run commitizen on `git commit`](https://github.com/commitizen/cz-cli#optional-running-commitizen-on-git-commit))
421
-
422
- #### Certain commits are analyzed and mapped to versioning as follows:
423
-
424
- - `MAJOR` release if `BREAKING CHANGE` exists in the commit footer.
484
+ # Documentation
425
485
 
426
- - `MINOR` release for commit type `feat`.
486
+ We auto-generate documentation on what the Globalization Toolkit offers by utilizing [`Typedoc`](https://typedoc.org/example/).
487
+ Once you generate the updated documentation, you can navigate it locally by opening 'docs/index.html'.
427
488
 
428
- - `PATCH` release for commit types `fix` or `perf`.
489
+ To generate updated documentation run:
429
490
 
430
- - No release is triggered for all other commit types.
431
- And commits that do not match any format rules or have `no-release` as the scope
432
- will not trigger a release.
433
-
434
- Additionally, `releaseRules` are specified in `package.json` for specific commits:
435
-
436
- - `build(deps-dev):` does not trigger a release (development dependency changes, typically version bumps by `dependabot`).
437
- - `build(deps):` triggers a `PATCH` release.
491
+ ```sh
492
+ $ npm run typedoc
493
+ ```
438
494
 
439
- _Details about how commit types are mapped to versioning can be found in the [commit-analyzer documentation](https://github.com/semantic-release/commit-analyzer/#default-rules-matching)._
495
+ ## Versioning and Publishing
440
496
 
441
- # Publishing
497
+ We use [`changesets`][changesets] to manage releases, and encourage you to include a changeset with each commit or pull request.
442
498
 
443
- Merges to `main` will trigger the `publish` workflow in CircleCi.
444
- We use [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/) to manage releases and publishing to `NPM`.
445
- Semantic Release relies on the project's commit history
446
- to create release notes and determine the next version.
499
+ To create a changeset run `npm run changeset` and follow the prompt instructions.
447
500
 
448
- ### Release Notes:
501
+ To publish a release with changes:
449
502
 
450
- The `<description>` for commits selected for publishing are added to the release notes
451
- and can be found in the **Releases** section of Github.
503
+ - Create new branch (e.g., `git checkout -b chore/release`).
504
+ - Run `npm run changeset version` to create a release containing all changes. This command will update the version of GTK, as well update the `CHANGELOG.md` file.
505
+ - Commit the changes (e.g., `git commit -m "chore: release"`).
506
+ - Create a pull request. `git push -u origin HEAD`, and then create pull request in the web UI.
507
+ - Once the pull request is merged to `main` the updated packages will be published to npm once the CI pipeline is completed.
452
508
 
453
509
  ## License
454
510
 
@@ -465,3 +521,6 @@ The package is available under the [Procore Developers License](https://www.proc
465
521
  Procore - building the software that builds the world.
466
522
 
467
523
  Learn more about the #1 most widely used construction management software at [procore.com](https://www.procore.com/)
524
+
525
+
526
+ [changesets]: https://github.com/changesets/changesets/
@@ -5,10 +5,12 @@ export declare class DateTimeFormatter {
5
5
  constructor(dateTimeOptions: DateTimeOptions);
6
6
  formatDateTime(value: Date | number): string;
7
7
  formatDateTimeToParts(value: Date | number): DateTimeFormatPart[];
8
+ formatDateTimeToLocalISOString(value: Date | number): string;
8
9
  getStartDayOfTheWeek(): number;
9
10
  }
10
11
  export declare function formatDateTime(value: Date | number, dateTimeOptions: DateTimeOptions): string;
11
12
  export declare function formatDateTimeToParts(value: Date | number, dateTimeOptions: DateTimeOptions): DateTimeFormatPart[];
13
+ export declare function formatDateTimeToLocalISOString(value: Date | number, dateTimeOptions: DateTimeOptions): string;
12
14
  export declare function getStartDayOfTheWeek(locale: Locale): number;
13
15
  export declare function getDatePartsWithPlaceholders(locale: Locale, dateLabels: DateLabelOptions): DateTimeFormatPart[];
14
16
  export declare function getDatePlaceholder(locale: Locale, dateLabels: DateLabelOptions): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToParts = exports.formatDateTime = exports.DateTimeFormatter = void 0;
3
+ exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToLocalISOString = exports.formatDateTimeToParts = exports.formatDateTime = exports.DateTimeFormatter = void 0;
4
4
  const weekstart_1 = require("weekstart");
5
5
  const DateTime_types_1 = require("./DateTime.types");
6
6
  const DateTimeUtils_1 = require("./DateTimeUtils");
@@ -14,6 +14,22 @@ class DateTimeFormatter {
14
14
  formatDateTimeToParts(value) {
15
15
  return this.formatter.formatToParts(value);
16
16
  }
17
+ formatDateTimeToLocalISOString(value) {
18
+ var _a, _b, _c;
19
+ const dateTimeOptions = this.formatter.resolvedOptions();
20
+ const formatter = (0, DateTimeUtils_1.getDateTimeFormatter)({
21
+ locale: dateTimeOptions.locale,
22
+ timeZone: dateTimeOptions.timeZone,
23
+ year: DateTime_types_1.Year.NUMERIC,
24
+ month: DateTime_types_1.Month.TWO_DIGIT,
25
+ day: DateTime_types_1.Day.TWO_DIGIT,
26
+ });
27
+ const parts = formatter.formatToParts(value);
28
+ const year = (_a = parts.find((prop) => prop.type === "year")) === null || _a === void 0 ? void 0 : _a.value;
29
+ const month = (_b = parts.find((prop) => prop.type === "month")) === null || _b === void 0 ? void 0 : _b.value;
30
+ const day = (_c = parts.find((prop) => prop.type === "day")) === null || _c === void 0 ? void 0 : _c.value;
31
+ return `${year}-${month}-${day}`;
32
+ }
17
33
  getStartDayOfTheWeek() {
18
34
  return (0, weekstart_1.getWeekStartByLocale)(this.formatter.resolvedOptions().locale);
19
35
  }
@@ -29,6 +45,11 @@ function formatDateTimeToParts(value, dateTimeOptions) {
29
45
  return formatter.formatDateTimeToParts(value);
30
46
  }
31
47
  exports.formatDateTimeToParts = formatDateTimeToParts;
48
+ function formatDateTimeToLocalISOString(value, dateTimeOptions) {
49
+ const formatter = new DateTimeFormatter(dateTimeOptions);
50
+ return formatter.formatDateTimeToLocalISOString(value);
51
+ }
52
+ exports.formatDateTimeToLocalISOString = formatDateTimeToLocalISOString;
32
53
  function getStartDayOfTheWeek(locale) {
33
54
  const formatter = new DateTimeFormatter({ locale });
34
55
  return formatter.getStartDayOfTheWeek();
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeFormatter.js","sourceRoot":"","sources":["../../src/dateTimes/DateTimeFormatter.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,qDAQ0B;AAC1B,mDAAuD;AAEvD,MAAa,iBAAiB;IAM5B,YAAY,eAAgC;QAC1C,IAAI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U,CAAC,GAAG,CAAC;gBAC5B,MAAM;YACR,KAAK,MAAM;gBACT,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;gBAC7B,MAAM;SACT;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AA7BD,oEA6BC;AAQD,SAAgB,kBAAkB,CAChC,MAAc,EACd,UAA4B;IAE5B,MAAM,KAAK,GAAG,4BAA4B,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC;AAND,gDAMC"}
@@ -0,0 +1,3 @@
1
+ import { Locale } from "./GetOverrideLocale.types";
2
+ export declare function getOverrideLocale(envLocale: string): Locale;
3
+ export declare function getFallbackLocaleList(envLocale: string): Locale[];
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFallbackLocaleList = exports.getOverrideLocale = void 0;
4
+ const SUPPORTED_LOCALES = [
5
+ "de-DE",
6
+ "en-AU",
7
+ "en-CA",
8
+ "en-GB",
9
+ "en",
10
+ "es-ES",
11
+ "es",
12
+ "fr-CA",
13
+ "fr-FR",
14
+ "is-IS",
15
+ "ja-JP",
16
+ "pseudo",
17
+ "pt-BR",
18
+ "th-TH",
19
+ "zh-SG",
20
+ ];
21
+ const OVERWRITE_LOCALE_MAP = {
22
+ "en-AE": "en-GB",
23
+ "en-SG": "en-GB",
24
+ "es-419": "es",
25
+ };
26
+ function getOverrideLocale(envLocale) {
27
+ if (SUPPORTED_LOCALES.includes(envLocale)) {
28
+ return envLocale;
29
+ }
30
+ if (OVERWRITE_LOCALE_MAP[envLocale]) {
31
+ return OVERWRITE_LOCALE_MAP[envLocale];
32
+ }
33
+ return "en";
34
+ }
35
+ exports.getOverrideLocale = getOverrideLocale;
36
+ const FALLBACK_LOCALE_MAP = {
37
+ "es-ES": "es",
38
+ "fr-FR": "fr-CA",
39
+ };
40
+ function getFallbackLocaleList(envLocale) {
41
+ const validLocale = getOverrideLocale(envLocale);
42
+ if (validLocale === "en") {
43
+ return ["en"];
44
+ }
45
+ if (FALLBACK_LOCALE_MAP[validLocale]) {
46
+ return [validLocale, FALLBACK_LOCALE_MAP[validLocale], "en"];
47
+ }
48
+ return [validLocale, "en"];
49
+ }
50
+ exports.getFallbackLocaleList = getFallbackLocaleList;
51
+ //# sourceMappingURL=GetOverrideLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOverrideLocale.js","sourceRoot":"","sources":["../../src/getOverrideLocale/GetOverrideLocale.ts"],"names":[],"mappings":";;;AAGA,MAAM,iBAAiB,GAAa;IAClC,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAC;AAMF,MAAM,oBAAoB,GAA2B;IACnD,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,IAAI;CACN,CAAC;AAOX,SAAgB,iBAAiB,CAAC,SAAiB;IACjD,IAAI,iBAAiB,CAAC,QAAQ,CAAC,SAAmB,CAAC,EAAE;QACnD,OAAO,SAAmB,CAAC;KAC5B;IACD,IAAI,oBAAoB,CAAC,SAAS,CAAC,EAAE;QACnC,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AATD,8CASC;AAKD,MAAM,mBAAmB,GAA2B;IAClD,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,OAAO;CACjB,CAAC;AAOF,SAAgB,qBAAqB,CAAC,SAAiB;IAErD,MAAM,WAAW,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAEjD,IAAI,WAAW,KAAK,IAAI,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IACD,IAAI,mBAAmB,CAAC,WAAW,CAAC,EAAE;QACpC,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;KAC9D;IAED,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC;AAZD,sDAYC"}
@@ -0,0 +1 @@
1
+ export type Locale = "de-DE" | "en-AE" | "en-AU" | "en-CA" | "en-GB" | "en-SG" | "en" | "es-ES" | "es" | "fr-CA" | "fr-FR" | "is-IS" | "ja-JP" | "pt-BR" | "th-TH" | "zh-SG" | "pseudo";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=GetOverrideLocale.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOverrideLocale.types.js","sourceRoot":"","sources":["../../src/getOverrideLocale/GetOverrideLocale.types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { NumberFormatter, formatNumber, formatNumberToParts, parseNumber, getNumberSeparators, } from "./numbers/NumberFormatter";
2
2
  export { CurrencyFormatter, formatCurrency, formatCurrencyToParts, parseCurrency, getCurrencySeparators, getSupportedCurrencies, } from "./numbers/CurrencyFormatter";
3
- export { DateTimeFormatter, formatDateTime, formatDateTimeToParts, getStartDayOfTheWeek, getDatePartsWithPlaceholders, getDatePlaceholder, } from "./dateTimes/DateTimeFormatter";
3
+ export { DateTimeFormatter, formatDateTime, formatDateTimeToLocalISOString, formatDateTimeToParts, getStartDayOfTheWeek, getDatePartsWithPlaceholders, getDatePlaceholder, } from "./dateTimes/DateTimeFormatter";
4
+ export { getOverrideLocale, getFallbackLocaleList, } from "./getOverrideLocale/GetOverrideLocale";
4
5
  export type { Percent, NumberOptions, NumberFormatPart, Separators, } from "./numbers/Number.types";
5
6
  export type { CurrencyDisplay, CurrencySign, CurrencyOptions, } from "./numbers/Currency.types";
6
7
  export type { DateTimeStyle, NumericTwoDigit, DateStyle, TimeStyle, TimeZoneName, Weekday, Year, Month, Day, Hour, Minute, Second, DateLabelOptions, DateTimeOptionsBasic, DateTimeOptionsStyle, DateTimeOptionsComponentsAll, DateTimeOptionsComponentsWeekdayYearMonthDay, DateTimeOptionsComponentsYearMonthDay, DateTimeOptionsComponentsYearMonth, DateTimeOptionsComponentsMonthDay, DateTimeOptionsComponentsHourMinuteSecond, DateTimeOptionsComponentsHourMinute, DateTimeOptions, DateTimeFormatPart, } from "./dateTimes/DateTime.types";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToParts = exports.formatDateTime = exports.DateTimeFormatter = exports.getSupportedCurrencies = exports.getCurrencySeparators = exports.parseCurrency = exports.formatCurrencyToParts = exports.formatCurrency = exports.CurrencyFormatter = exports.getNumberSeparators = exports.parseNumber = exports.formatNumberToParts = exports.formatNumber = exports.NumberFormatter = void 0;
12
+ exports.getFallbackLocaleList = exports.getOverrideLocale = exports.getDatePlaceholder = exports.getDatePartsWithPlaceholders = exports.getStartDayOfTheWeek = exports.formatDateTimeToParts = exports.formatDateTimeToLocalISOString = exports.formatDateTime = exports.DateTimeFormatter = exports.getSupportedCurrencies = exports.getCurrencySeparators = exports.parseCurrency = exports.formatCurrencyToParts = exports.formatCurrency = exports.CurrencyFormatter = exports.getNumberSeparators = exports.parseNumber = exports.formatNumberToParts = exports.formatNumber = exports.NumberFormatter = void 0;
13
13
  var NumberFormatter_1 = require("./numbers/NumberFormatter");
14
14
  Object.defineProperty(exports, "NumberFormatter", { enumerable: true, get: function () { return NumberFormatter_1.NumberFormatter; } });
15
15
  Object.defineProperty(exports, "formatNumber", { enumerable: true, get: function () { return NumberFormatter_1.formatNumber; } });
@@ -26,10 +26,14 @@ Object.defineProperty(exports, "getSupportedCurrencies", { enumerable: true, get
26
26
  var DateTimeFormatter_1 = require("./dateTimes/DateTimeFormatter");
27
27
  Object.defineProperty(exports, "DateTimeFormatter", { enumerable: true, get: function () { return DateTimeFormatter_1.DateTimeFormatter; } });
28
28
  Object.defineProperty(exports, "formatDateTime", { enumerable: true, get: function () { return DateTimeFormatter_1.formatDateTime; } });
29
+ Object.defineProperty(exports, "formatDateTimeToLocalISOString", { enumerable: true, get: function () { return DateTimeFormatter_1.formatDateTimeToLocalISOString; } });
29
30
  Object.defineProperty(exports, "formatDateTimeToParts", { enumerable: true, get: function () { return DateTimeFormatter_1.formatDateTimeToParts; } });
30
31
  Object.defineProperty(exports, "getStartDayOfTheWeek", { enumerable: true, get: function () { return DateTimeFormatter_1.getStartDayOfTheWeek; } });
31
32
  Object.defineProperty(exports, "getDatePartsWithPlaceholders", { enumerable: true, get: function () { return DateTimeFormatter_1.getDatePartsWithPlaceholders; } });
32
33
  Object.defineProperty(exports, "getDatePlaceholder", { enumerable: true, get: function () { return DateTimeFormatter_1.getDatePlaceholder; } });
34
+ var GetOverrideLocale_1 = require("./getOverrideLocale/GetOverrideLocale");
35
+ Object.defineProperty(exports, "getOverrideLocale", { enumerable: true, get: function () { return GetOverrideLocale_1.getOverrideLocale; } });
36
+ Object.defineProperty(exports, "getFallbackLocaleList", { enumerable: true, get: function () { return GetOverrideLocale_1.getFallbackLocaleList; } });
33
37
  exports.r2gSmokeTest = () => __awaiter(void 0, void 0, void 0, function* () {
34
38
  return Promise.resolve(true);
35
39
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAMmC;AALjC,kHAAA,eAAe,OAAA;AACf,+G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