@ui5/webcomponents-localization 1.12.0-rc.0 → 1.12.0-rc.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.
Files changed (130) hide show
  1. package/.eslintrc.js +3 -0
  2. package/CHANGELOG.md +20 -0
  3. package/dist/Assets-static.js.map +1 -1
  4. package/dist/Assets.js.map +1 -1
  5. package/dist/DateFormat.js.map +1 -1
  6. package/dist/LocaleData.js.map +1 -1
  7. package/dist/dates/CalendarDate.js.map +1 -1
  8. package/dist/dates/ExtremeDates.js.map +1 -1
  9. package/dist/dates/UniversalDate.js.map +1 -1
  10. package/dist/dates/calculateWeekNumber.js.map +1 -1
  11. package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -1
  12. package/dist/dates/getDaysInMonth.js.map +1 -1
  13. package/dist/dates/getRoundedTimestamp.js.map +1 -1
  14. package/dist/dates/getTodayUTCTimestamp.js.map +1 -1
  15. package/dist/dates/modifyDateBy.js.map +1 -1
  16. package/dist/dates/transformDateToSecondaryType.js.map +1 -1
  17. package/dist/features/calendar/Buddhist.js.map +1 -1
  18. package/dist/features/calendar/Gregorian.js.map +1 -1
  19. package/dist/features/calendar/Islamic.js.map +1 -1
  20. package/dist/features/calendar/Japanese.js.map +1 -1
  21. package/dist/features/calendar/Persian.js.map +1 -1
  22. package/dist/generated/assets/cldr/ar.json +2804 -6704
  23. package/dist/generated/assets/cldr/ar_EG.json +2804 -6704
  24. package/dist/generated/assets/cldr/ar_SA.json +2804 -6704
  25. package/dist/generated/assets/cldr/bg.json +2727 -5742
  26. package/dist/generated/assets/cldr/ca.json +2670 -5793
  27. package/dist/generated/assets/cldr/cs.json +2710 -6294
  28. package/dist/generated/assets/cldr/cy.json +2791 -6612
  29. package/dist/generated/assets/cldr/da.json +2591 -5651
  30. package/dist/generated/assets/cldr/de.json +2608 -5713
  31. package/dist/generated/assets/cldr/de_AT.json +2608 -5714
  32. package/dist/generated/assets/cldr/de_CH.json +2608 -5712
  33. package/dist/generated/assets/cldr/el.json +2589 -5579
  34. package/dist/generated/assets/cldr/el_CY.json +2589 -5579
  35. package/dist/generated/assets/cldr/en.json +2577 -5732
  36. package/dist/generated/assets/cldr/en_AU.json +2586 -5724
  37. package/dist/generated/assets/cldr/en_GB.json +2578 -5733
  38. package/dist/generated/assets/cldr/en_HK.json +2584 -5739
  39. package/dist/generated/assets/cldr/en_IE.json +2578 -5733
  40. package/dist/generated/assets/cldr/en_IN.json +2579 -5734
  41. package/dist/generated/assets/cldr/en_NZ.json +2578 -5733
  42. package/dist/generated/assets/cldr/en_PG.json +2578 -5734
  43. package/dist/generated/assets/cldr/en_SG.json +2579 -5735
  44. package/dist/generated/assets/cldr/en_ZA.json +2578 -5734
  45. package/dist/generated/assets/cldr/es.json +2633 -5641
  46. package/dist/generated/assets/cldr/es_AR.json +2638 -5643
  47. package/dist/generated/assets/cldr/es_BO.json +2638 -5642
  48. package/dist/generated/assets/cldr/es_CL.json +2638 -5643
  49. package/dist/generated/assets/cldr/es_CO.json +2637 -5642
  50. package/dist/generated/assets/cldr/es_MX.json +2638 -5644
  51. package/dist/generated/assets/cldr/es_PE.json +2638 -5642
  52. package/dist/generated/assets/cldr/es_UY.json +2638 -5644
  53. package/dist/generated/assets/cldr/es_VE.json +2638 -5643
  54. package/dist/generated/assets/cldr/et.json +2593 -5729
  55. package/dist/generated/assets/cldr/fa.json +2606 -5647
  56. package/dist/generated/assets/cldr/fi.json +2635 -5804
  57. package/dist/generated/assets/cldr/fr.json +2583 -5741
  58. package/dist/generated/assets/cldr/fr_BE.json +2583 -5741
  59. package/dist/generated/assets/cldr/fr_CA.json +2598 -5735
  60. package/dist/generated/assets/cldr/fr_CH.json +2600 -5759
  61. package/dist/generated/assets/cldr/fr_LU.json +2583 -5741
  62. package/dist/generated/assets/cldr/he.json +2699 -6175
  63. package/dist/generated/assets/cldr/hi.json +2593 -5558
  64. package/dist/generated/assets/cldr/hr.json +2646 -5681
  65. package/dist/generated/assets/cldr/hu.json +2592 -5686
  66. package/dist/generated/assets/cldr/id.json +2538 -5420
  67. package/dist/generated/assets/cldr/it.json +2583 -5712
  68. package/dist/generated/assets/cldr/it_CH.json +2583 -5712
  69. package/dist/generated/assets/cldr/ja.json +2655 -5626
  70. package/dist/generated/assets/cldr/kk.json +2583 -5487
  71. package/dist/generated/assets/cldr/ko.json +2632 -5534
  72. package/dist/generated/assets/cldr/lt.json +2714 -6243
  73. package/dist/generated/assets/cldr/lv.json +2638 -5874
  74. package/dist/generated/assets/cldr/ms.json +2532 -5245
  75. package/dist/generated/assets/cldr/nb.json +2615 -5740
  76. package/dist/generated/assets/cldr/nl.json +2595 -5613
  77. package/dist/generated/assets/cldr/nl_BE.json +2595 -5613
  78. package/dist/generated/assets/cldr/pl.json +2717 -5972
  79. package/dist/generated/assets/cldr/pt.json +2600 -5567
  80. package/dist/generated/assets/cldr/pt_PT.json +2651 -5702
  81. package/dist/generated/assets/cldr/ro.json +2639 -5852
  82. package/dist/generated/assets/cldr/ru.json +2698 -6169
  83. package/dist/generated/assets/cldr/ru_UA.json +2698 -6169
  84. package/dist/generated/assets/cldr/sk.json +2720 -6166
  85. package/dist/generated/assets/cldr/sl.json +2682 -6136
  86. package/dist/generated/assets/cldr/sr.json +2657 -5888
  87. package/dist/generated/assets/cldr/sr_Latn.json +2658 -5889
  88. package/dist/generated/assets/cldr/sv.json +2625 -5774
  89. package/dist/generated/assets/cldr/th.json +2626 -5627
  90. package/dist/generated/assets/cldr/tr.json +2606 -5809
  91. package/dist/generated/assets/cldr/uk.json +2678 -6115
  92. package/dist/generated/assets/cldr/vi.json +2549 -5435
  93. package/dist/generated/assets/cldr/zh_CN.json +2541 -5429
  94. package/dist/generated/assets/cldr/zh_HK.json +2549 -5437
  95. package/dist/generated/assets/cldr/zh_SG.json +2548 -5437
  96. package/dist/generated/assets/cldr/zh_TW.json +2556 -5525
  97. package/dist/getCachedLocaleDataInstance.js.map +1 -1
  98. package/dist/locale/getLocaleData.js.map +1 -1
  99. package/dist/sap/base/util/LoaderExtensions.js.map +1 -1
  100. package/dist/sap/ui/core/Configuration.js.map +1 -1
  101. package/dist/sap/ui/core/Core.js.map +1 -1
  102. package/dist/sap/ui/core/FormatSettings.js.map +1 -1
  103. package/package-scripts.js +2 -2
  104. package/package.json +5 -5
  105. package/tsconfig.json +1 -0
  106. package/src/Assets-static.ts +0 -2
  107. package/src/Assets.ts +0 -2
  108. package/src/DateFormat.ts +0 -8
  109. package/src/LocaleData.ts +0 -8
  110. package/src/dates/CalendarDate.ts +0 -232
  111. package/src/dates/ExtremeDates.ts +0 -40
  112. package/src/dates/UniversalDate.ts +0 -51
  113. package/src/dates/calculateWeekNumber.ts +0 -53
  114. package/src/dates/convertMonthNumbersToMonthNames.ts +0 -34
  115. package/src/dates/getDaysInMonth.ts +0 -11
  116. package/src/dates/getRoundedTimestamp.ts +0 -14
  117. package/src/dates/getTodayUTCTimestamp.ts +0 -10
  118. package/src/dates/modifyDateBy.ts +0 -42
  119. package/src/dates/transformDateToSecondaryType.ts +0 -21
  120. package/src/features/calendar/Buddhist.ts +0 -1
  121. package/src/features/calendar/Gregorian.ts +0 -1
  122. package/src/features/calendar/Islamic.ts +0 -1
  123. package/src/features/calendar/Japanese.ts +0 -1
  124. package/src/features/calendar/Persian.ts +0 -1
  125. package/src/getCachedLocaleDataInstance.ts +0 -15
  126. package/src/locale/getLocaleData.ts +0 -28
  127. package/src/sap/base/util/LoaderExtensions.ts +0 -17
  128. package/src/sap/ui/core/Configuration.ts +0 -22
  129. package/src/sap/ui/core/Core.ts +0 -15
  130. package/src/sap/ui/core/FormatSettings.ts +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"getCachedLocaleDataInstance.js","sourceRoot":"","sources":["../src/getCachedLocaleDataInstance.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,MAAM,2BAA2B,GAAG,CAAC,MAAc,EAAE,EAAE;IACtD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACvB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KAChE;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"getCachedLocaleDataInstance.js","sourceRoot":"","sources":["../src/getCachedLocaleDataInstance.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,MAAM,2BAA2B,GAAG,CAAC,MAAc,EAAE,EAAE;IACtD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACvB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KAChE;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC","sourcesContent":["import type Locale from \"@ui5/webcomponents-base/dist/locale/Locale.js\";\nimport type LocaleT from \"sap/ui/core/Locale\";\nimport LocaleData from \"./LocaleData.js\";\n\nconst cache = new Map<Locale, LocaleData>();\n\nconst getCachedLocaleDataInstance = (locale: Locale) => {\n\tif (!cache.has(locale)) {\n\t\tcache.set(locale, new LocaleData(locale as unknown as LocaleT));\n\t}\n\n\treturn cache.get(locale)!;\n};\n\nexport default getCachedLocaleDataInstance;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getLocaleData.js","sourceRoot":"","sources":["../../src/locale/getLocaleData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6DAA6D,CAAC;AACxF,OAAO,SAAS,MAAM,kDAAkD,CAAC;AAEzE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,IAAY,EAAuB,EAAE;IACjE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAExC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC/B,MAAM,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9E,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KACxE;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"getLocaleData.js","sourceRoot":"","sources":["../../src/locale/getLocaleData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6DAA6D,CAAC;AACxF,OAAO,SAAS,MAAM,kDAAkD,CAAC;AAEzE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,IAAY,EAAuB,EAAE;IACjE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAExC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAC/B,MAAM,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9E,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,UAAU,CAAC,MAA4B,CAAC,CAAC,CAAC;KACxE;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { fetchCldr } from \"@ui5/webcomponents-base/dist/asset-registries/LocaleData.js\";\nimport getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport type LocaleT from \"sap/ui/core/Locale\";\nimport LocaleData from \"../LocaleData.js\";\n\nconst instances = new Map<string, LocaleData>();\n\n/**\n * Fetches and returns а LocaleData object for the required locale\n * For more information on this object's API, please see:\n * https://sdk.openui5.org/api/sap.ui.core.LocaleData\n *\n * @param { string } lang - if left empty, will use the configured/current locale\n * @returns { Promise<LocaleData> }\n */\nconst getLocaleData = async (lang: string): Promise<LocaleData> => {\n\tconst locale = getLocale(lang);\n\tconst localeLang = locale.getLanguage();\n\n\tif (!instances.has(localeLang)) {\n\t\tawait fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());\n\t\tinstances.set(localeLang, new LocaleData(locale as unknown as LocaleT));\n\t}\n\n\treturn instances.get(localeLang)!;\n};\n\nexport default getLocaleData;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LoaderExtensions.js","sourceRoot":"","sources":["../../../../src/sap/base/util/LoaderExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC1E,IAAI,CAAC,YAAY,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACxB,YAAY;CACZ,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"LoaderExtensions.js","sourceRoot":"","sources":["../../../../src/sap/base/util/LoaderExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC1E,IAAI,CAAC,YAAY,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,GAAG,CAAC,CAAC;KAClD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACxB,YAAY;CACZ,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { getLocaleData } from \"@ui5/webcomponents-base/dist/asset-registries/LocaleData.js\";\n\nconst loadResource = (moduleName: string) => {\n\tconst moduleFormat = moduleName.match(/sap\\/ui\\/core\\/cldr\\/(\\w+)\\.json/);\n\tif (!moduleFormat) {\n\t\tthrow new Error(`Unknown module \"${moduleName}\"`);\n\t}\n\n\tconst localeId = moduleFormat[1];\n\treturn getLocaleData(localeId);\n};\n\nconst LoaderExtensions = {\n\tloadResource,\n};\n\nexport default LoaderExtensions;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,4BAA4B,MAAM,mEAAmE,CAAC;AAC7G,aAAa;AACb,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB,WAAW;IACX,eAAe;IACf,qBAAqB,EAAE,GAAG,EAAE,CAAC,4BAA4B,CAAC,2IAA2I,CAAC;IACtM,aAAa,EAAE,OAAO;IACtB,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;IACvC,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAY;CAC5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,4BAA4B,MAAM,mEAAmE,CAAC;AAC7G,aAAa;AACb,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB,WAAW;IACX,eAAe;IACf,qBAAqB,EAAE,GAAG,EAAE,CAAC,4BAA4B,CAAC,2IAA2I,CAAC;IACtM,aAAa,EAAE,OAAO;IACtB,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;IACvC,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAY;CAC5D,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { getLanguage } from \"@ui5/webcomponents-base/dist/config/Language.js\";\nimport { getCalendarType } from \"@ui5/webcomponents-base/dist/config/CalendarType.js\";\nimport getDesigntimePropertyAsArray from \"@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js\";\n// @ts-ignore\nimport TimezoneUtil from \"./format/TimezoneUtil.js\";\nimport FormatSettings from \"./FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Configuration Shim\n */\nconst Configuration = {\n\tgetLanguage,\n\tgetCalendarType,\n\tgetSupportedLanguages: () => getDesigntimePropertyAsArray(\"$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$\"),\n\tgetOriginInfo: emptyFn,\n\tgetFormatSettings: () => FormatSettings,\n\tgetTimezone: () => TimezoneUtil.getLocalTimezone() as string,\n};\n\nexport default Configuration;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Core.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Core.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,IAAI,GAAG;IACZ,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa;IACrC,wBAAwB,EAAE,OAAO,EAAE;IACnC,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;CACvC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Core.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/Core.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,IAAI,GAAG;IACZ,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa;IACrC,wBAAwB,EAAE,OAAO,EAAE;IACnC,iBAAiB,EAAE,GAAG,EAAE,CAAC,cAAc;CACvC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import FormatSettings from \"./FormatSettings.js\";\nimport Configuration from \"./Configuration.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 Core shim\n */\nconst Core = {\n\tgetConfiguration: () => Configuration,\n\tgetLibraryResourceBundle: emptyFn(),\n\tgetFormatSettings: () => FormatSettings,\n};\n\nexport default Core;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSettings.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/FormatSettings.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAEzG,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,cAAc,GAAG;IACtB,eAAe,EAAE,SAAS;IAC1B,mBAAmB,EAAE,OAAO;IAC5B,mBAAmB,EAAE,OAAO;IAC5B,gCAAgC;CAChC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FormatSettings.js","sourceRoot":"","sources":["../../../../src/sap/ui/core/FormatSettings.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uDAAuD,CAAC;AAEzG,MAAM,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,MAAM,cAAc,GAAG;IACtB,eAAe,EAAE,SAAS;IAC1B,mBAAmB,EAAE,OAAO;IAC5B,mBAAmB,EAAE,OAAO;IAC5B,gCAAgC;CAChC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport { getLegacyDateCalendarCustomizing } from \"@ui5/webcomponents-base/dist/config/FormatSettings.js\";\n\nconst emptyFn = () => {};\n\n/**\n * OpenUI5 FormatSettings shim\n */\nconst FormatSettings = {\n\tgetFormatLocale: getLocale,\n\tgetLegacyDateFormat: emptyFn,\n\tgetCustomLocaleData: emptyFn,\n\tgetLegacyDateCalendarCustomizing,\n};\n\nexport default FormatSettings;\n"]}
@@ -5,7 +5,7 @@ const esmAbsToRel = resolve.sync("@ui5/webcomponents-tools/lib/esm-abs-to-rel/in
5
5
 
6
6
  const scripts = {
7
7
  clean: "rimraf dist",
8
- lint: "eslint . --config config/.eslintrc.js",
8
+ lint: "cross-env UI5_TS=true eslint . --config config/.eslintrc.js",
9
9
  build: {
10
10
  "default": "nps lint clean copy.used-modules copy.cldr copy.overlay build.replace-amd build.replace-export-true build.replace-export-false build.amd-to-es6 build.replace-global-core-usage build.esm-abs-to-rel build.jsonImports build.typescript copy.src",
11
11
  "replace-amd": "replace-in-file sap.ui.define define dist/**/*.js",
@@ -20,7 +20,7 @@ const scripts = {
20
20
  typescript: "tsc",
21
21
  copy: {
22
22
  "used-modules": `node "${copyUsedModules}" ./used-modules.txt dist/`,
23
- cldr: `copy-and-watch "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/*.json" dist/generated/assets/cldr/`,
23
+ cldr: `node ./lib/copy-and-strip-cldr/index.js "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/" dist/generated/assets/cldr/`,
24
24
  overlay: `copy-and-watch "overlay/**/*.js" dist/`,
25
25
  src: `copy-and-watch "src/**/*.js" dist/`,
26
26
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-localization",
3
- "version": "1.12.0-rc.0",
3
+ "version": "1.12.0-rc.2",
4
4
  "description": "Localization for UI5 Web Components",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -28,14 +28,14 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@openui5/sap.ui.core": "1.109.0",
31
- "@ui5/webcomponents-tools": "1.12.0-rc.0",
32
- "chromedriver": "109.0.0",
31
+ "@ui5/webcomponents-tools": "1.12.0-rc.2",
32
+ "chromedriver": "110.0.0",
33
33
  "mkdirp": "^1.0.4",
34
34
  "resolve": "^1.20.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "@types/openui5": "^1.109.0",
38
- "@ui5/webcomponents-base": "1.12.0-rc.0"
38
+ "@ui5/webcomponents-base": "1.12.0-rc.2"
39
39
  },
40
- "gitHead": "f5e3a2ba480455bc1154eee1b04ee04ebb0dbe14"
40
+ "gitHead": "2af8e0fa36a3c85253cbc4f76f6b92b1c5a7a47f"
41
41
  }
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "outDir": "dist",
8
8
  "skipLibCheck": true,
9
9
  "sourceMap": true,
10
+ "inlineSources": true,
10
11
  "strict": true,
11
12
  "moduleResolution": "node",
12
13
  },
@@ -1,2 +0,0 @@
1
- // Currently the base package provides CLDR assets only
2
- import "./generated/json-imports/LocaleData-static.js";
package/src/Assets.ts DELETED
@@ -1,2 +0,0 @@
1
- // Currently the base package provides CLDR assets only
2
- import "./generated/json-imports/LocaleData.js";
package/src/DateFormat.ts DELETED
@@ -1,8 +0,0 @@
1
- import type DateFormatT from "sap/ui/core/format/DateFormat";
2
- // @ts-ignore
3
- import DateFormatNative from "./sap/ui/core/format/DateFormat.js";
4
-
5
- const DateFormatWrapped = DateFormatNative as typeof DateFormatT;
6
- class DateFormat extends DateFormatWrapped {}
7
-
8
- export default DateFormat;
package/src/LocaleData.ts DELETED
@@ -1,8 +0,0 @@
1
- import type LocaleDataOpenUI5T from "sap/ui/core/LocaleData";
2
- // @ts-ignore
3
- import LocaleDataNative from "./sap/ui/core/LocaleData.js";
4
-
5
- const LocaleDataWrapped = LocaleDataNative as typeof LocaleDataOpenUI5T;
6
- class LocaleData extends LocaleDataWrapped {}
7
-
8
- export default LocaleData;
@@ -1,232 +0,0 @@
1
- import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
- import UniversalDate from "./UniversalDate.js";
3
-
4
- class CalendarDate {
5
- _oUDate!: Date | UniversalDate;
6
-
7
- constructor(year?: number | CalendarDate, month?: number | string, date?: number, calendarType?: string) { // eslint-disable-line
8
- let aArgs = arguments, // eslint-disable-line
9
- oJSDate: Date,
10
- oNow: Date,
11
- sCalendarType!: CalendarType;
12
-
13
- switch (aArgs.length) {
14
- case 0: // defaults to the current date
15
- oNow = new Date();
16
- return (this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate()) as CalendarDate);
17
-
18
- case 1: // CalendarDate
19
- case 2: // CalendarDate, sCalendarType
20
- if (!(aArgs[0] instanceof CalendarDate)) {
21
- throw new Error("Invalid arguments: the first argument must be of type CalendarDate.");
22
- }
23
- sCalendarType = aArgs[1] ? aArgs[1] : (aArgs[0]._oUDate as UniversalDate).sCalendarType;
24
- // Use source.valueOf() (returns the same point of time regardless calendar type) instead of
25
- // source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date
26
- oJSDate = new Date(aArgs[0].valueOf());
27
-
28
- // Make this date really local. Now getters are safe.
29
- oJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());
30
- oJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());
31
-
32
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
33
- break;
34
-
35
- case 3: // year, month, date
36
- case 4: // year, month, date, sCalendarType
37
- checkNumericLike(aArgs[0] as number, `Invalid year: ${aArgs[0] as number}`);
38
- checkNumericLike(aArgs[1] as number, `Invalid month: ${aArgs[1] as number}`);
39
- checkNumericLike(aArgs[2] as number, `Invalid date: ${aArgs[2] as number}`);
40
-
41
- oJSDate = new Date(0, 0, 1);
42
- oJSDate.setFullYear(aArgs[0] as number, aArgs[1] as number, aArgs[2] as number); // 2 digits year is not supported. If so, it is considered as full year as well.
43
-
44
- if (aArgs[3]) {
45
- sCalendarType = aArgs[3];
46
- }
47
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
48
- break;
49
-
50
- default:
51
- throw new Error(`${"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType"
52
- + "or 2) year, month, date, (optional) calendarType"}${aArgs as unknown as string}`);
53
- }
54
- }
55
-
56
- getYear() {
57
- return this._oUDate.getUTCFullYear();
58
- }
59
-
60
- setYear(year: number) {
61
- checkNumericLike(year, `Invalid year: ${year}`);
62
- this._oUDate.setUTCFullYear(year);
63
- return this;
64
- }
65
-
66
- getMonth() {
67
- return this._oUDate.getUTCMonth();
68
- }
69
-
70
- /**
71
- * Sets the given month as ordinal month of the year.
72
- * @param {int} month An integer between 0 and 11, representing the months January through December( or their
73
- * equivalent month names for the given calendar).
74
- * If the specified value is is outside of the expected range, this method attempts to update the date information
75
- * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
76
- * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
77
- * 0 will result in the previous month's last day.
78
- * -1 will result in the day before the previous month's last day.
79
- * 32 will result in:
80
- * - first day of the next month if the current month has 31 days.
81
- * - second day of the next month if the current month has 30 days.
82
- * Other value will result in adding or subtracting days according to the given value.
83
- * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
84
- */
85
- setMonth(month: number, date?: number) {
86
- checkNumericLike(month, `Invalid month: ${month}`);
87
- if (date || date === 0) {
88
- checkNumericLike(date, `Invalid date: ${date}`);
89
- this._oUDate.setUTCMonth(month, date);
90
- } else {
91
- this._oUDate.setUTCMonth(month);
92
- }
93
- return this;
94
- }
95
-
96
- getDate() {
97
- return this._oUDate.getUTCDate();
98
- }
99
-
100
- setDate(date: number) {
101
- checkNumericLike(date, `Invalid date: ${date}`);
102
- this._oUDate.setUTCDate(date);
103
- return this;
104
- }
105
-
106
- getDay() {
107
- return this._oUDate.getUTCDay();
108
- }
109
-
110
- getCalendarType() {
111
- return (this._oUDate as UniversalDate).sCalendarType;
112
- }
113
-
114
- isBefore(oCalendarDate: CalendarDate) {
115
- checkCalendarDate(oCalendarDate);
116
- return this.valueOf() < oCalendarDate.valueOf();
117
- }
118
-
119
- isAfter(oCalendarDate: CalendarDate) {
120
- checkCalendarDate(oCalendarDate);
121
- return this.valueOf() > oCalendarDate.valueOf();
122
- }
123
-
124
- isSameOrBefore(oCalendarDate: CalendarDate) {
125
- checkCalendarDate(oCalendarDate);
126
- return this.valueOf() <= oCalendarDate.valueOf();
127
- }
128
-
129
- isSameOrAfter(oCalendarDate: CalendarDate) {
130
- checkCalendarDate(oCalendarDate);
131
- return this.valueOf() >= oCalendarDate.valueOf();
132
- }
133
-
134
- isSame(oCalendarDate: CalendarDate) {
135
- checkCalendarDate(oCalendarDate);
136
- return this.valueOf() === oCalendarDate.valueOf();
137
- }
138
-
139
- toLocalJSDate() {
140
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
141
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
142
- const oLocalDate = new Date(this._oUDate.getTime());
143
-
144
- // Make this date really local. Now getters are safe.
145
- oLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());
146
- oLocalDate.setHours(0, 0, 0, 0);
147
-
148
- return oLocalDate;
149
- }
150
-
151
- toUTCJSDate() {
152
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
153
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
154
- const oUTCDate = new Date(this._oUDate.getTime());
155
- oUTCDate.setUTCHours(0, 0, 0, 0);
156
-
157
- return oUTCDate;
158
- }
159
-
160
- toString() {
161
- return `${(this._oUDate as UniversalDate).sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;
162
- }
163
-
164
- valueOf() {
165
- return this._oUDate.getTime();
166
- }
167
-
168
- static fromLocalJSDate(oJSDate: Date, sCalendarType?: CalendarType) {
169
- // Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests
170
- // because Date object in the test is different than the Date object in the application (due to the iframe).
171
- // We can use jQuery.type or this method:
172
- function isValidDate(date: Date) {
173
- return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date as unknown as number); // eslint-disable-line
174
- }
175
- if (!isValidDate(oJSDate)) {
176
- throw new Error(`Date parameter must be a JavaScript Date object: [${oJSDate as unknown as string}].`);
177
- }
178
- return new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);
179
- }
180
-
181
- static fromTimestamp(iTimestamp: number, sCalendarType?: CalendarType) {
182
- const oCalDate = new CalendarDate(0, 0, 1);
183
- let oUDate;
184
- try {
185
- oUDate = UniversalDate.getInstance(new Date(iTimestamp), sCalendarType);
186
- } catch (e) {
187
- oUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior
188
- }
189
- oCalDate._oUDate = oUDate;
190
- return oCalDate;
191
- }
192
- }
193
-
194
- function createUniversalUTCDate(oDate: Date, sCalendarType: CalendarType) {
195
- if (sCalendarType) {
196
- return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
197
- }
198
- return new UniversalDate(createUTCDate(oDate).getTime());
199
- }
200
-
201
- /**
202
- * Creates a JavaScript UTC Date corresponding to the given JavaScript Date.
203
- * @param {Date} oDate JavaScript date object. Time related information is cut.
204
- * @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
205
- */
206
- function createUTCDate(oDate: Date) {
207
- const oUTCDate = new Date(Date.UTC(0, 0, 1));
208
-
209
- oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());
210
-
211
- return oUTCDate;
212
- }
213
-
214
- function checkCalendarDate(oCalendarDate: CalendarDate) {
215
- if (!(oCalendarDate instanceof CalendarDate)) {
216
- throw new Error(`Invalid calendar date: [${oCalendarDate as unknown as string}]. Expected: CalendarDate`);
217
- }
218
- }
219
-
220
- /**
221
- * Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not.
222
- * @param {any} value The value of any type to check. If null or undefined, this method throws an error.
223
- * @param {string} message The message to be used if an error is to be thrown
224
- * @throws will throw an error if the value is null or undefined or is not like a number
225
- */
226
- function checkNumericLike(value: any, message: string) {
227
- if (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line
228
- throw message;
229
- }
230
- }
231
-
232
- export default CalendarDate;
@@ -1,40 +0,0 @@
1
- import CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
- import CalendarDate from "./CalendarDate.js";
3
-
4
- const cache = new Map<string, CalendarDate>();
5
-
6
- const getMinCalendarDate = (primaryCalendarType: CalendarType) => {
7
- const key = `min ${primaryCalendarType}`;
8
-
9
- if (!cache.has(key)) {
10
- const minDate = new CalendarDate(1, 0, 1, primaryCalendarType);
11
- minDate.setYear(1);
12
- minDate.setMonth(0);
13
- minDate.setDate(1);
14
- cache.set(key, minDate);
15
- }
16
-
17
- return cache.get(key)!;
18
- };
19
-
20
- const getMaxCalendarDate = (primaryCalendarType: CalendarType) => {
21
- const key = `max ${primaryCalendarType}`;
22
-
23
- if (!cache.has(key)) {
24
- const maxDate = new CalendarDate(1, 0, 1, primaryCalendarType);
25
- maxDate.setYear(9999);
26
- maxDate.setMonth(11);
27
- const tempDate = new CalendarDate(maxDate, primaryCalendarType);
28
- tempDate.setDate(1);
29
- tempDate.setMonth(tempDate.getMonth() + 1, 0);
30
- maxDate.setDate(tempDate.getDate());// 31st for Gregorian Calendar
31
- cache.set(key, maxDate);
32
- }
33
-
34
- return cache.get(key)!;
35
- };
36
-
37
- export {
38
- getMinCalendarDate,
39
- getMaxCalendarDate,
40
- };
@@ -1,51 +0,0 @@
1
- import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
- // @ts-ignore
3
- import UniversalDateNative from "../sap/ui/core/date/UniversalDate.js";
4
-
5
- type UniversalDate = {
6
- new (time: number): UniversalDate;
7
- oDate: Date,
8
- sCalendarType: string,
9
- getInstance: (oDate: Date, sCalendarType?: CalendarType) => UniversalDate,
10
- getDate: () => number,
11
- getMonth: () => number,
12
- getFullYear: () => number,
13
- getYear: () => number,
14
- getDay: () => number,
15
- getHours: () => number,
16
- getMinutes: () => number,
17
- getSeconds: () => number,
18
- getMilliseconds: () => number,
19
- getUTCDate: () => number,
20
- getUTCMonth: () => number,
21
- getUTCFullYear: () => number,
22
- getUTCDay: () => number,
23
- getUTCHours: () => number,
24
- getUTCMinutes: () => number,
25
- getUTCSeconds: () => number,
26
- getUTCMilliseconds: () => number,
27
- getTime: () => number,
28
- valueOf: () => number,
29
- getTimezoneOffset: () => number,
30
- toString: () => string,
31
- toDateString: () => string,
32
- setDate: (dayValue: number) => number,
33
- setFullYear: (yearValue: number, monthValue?: number, dateValue?: number) => number,
34
- setYear: (yearValue: number) => number,
35
- setMonth: (monthValue: number, dayValue?: number) => number,
36
- setHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number,
37
- setMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number,
38
- setSeconds: (secondsValue: number, msValue?: number) => number,
39
- setMilliseconds: (setMilliseconds: number) => number,
40
- setUTCDate:(dayValue: number) => number,
41
- setUTCFullYear: (yearValue: number, monthValue?: number, dayValue?: number) => number,
42
- setUTCMonth: (monthValue: number, dayValue?: number) => number,
43
- setUTCHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number,
44
- setUTCMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number,
45
- setUTCSeconds: (secondsValue: number, msValue?: number) => number,
46
- setUTCMilliseconds: (setMilliseconds: number) => number,
47
- }
48
-
49
- const UniversalDate: UniversalDate = UniversalDateNative;
50
-
51
- export default UniversalDate;
@@ -1,53 +0,0 @@
1
- import type Locale from "@ui5/webcomponents-base/dist/locale/Locale.js";
2
- import UniversalDate from "./UniversalDate.js";
3
- import type LocaleData from "../LocaleData.js";
4
-
5
- const calculateWeekNumber = (confFirstDayOfWeek: number | undefined, oDate: Date, iYear: number, oLocale: Locale, oLocaleData: LocaleData) => {
6
- let iWeekNum = 0;
7
- let iWeekDay = 0;
8
- const iFirstDayOfWeek = Number.isInteger(confFirstDayOfWeek) ? confFirstDayOfWeek! : oLocaleData.getFirstDayOfWeek();
9
-
10
- // search Locale for containing "en-US", since sometimes
11
- // when any user settings have been defined, subtag "sapufmt" is added to the locale name
12
- // this is described inside sap.ui.core.Configuration file
13
- if (oLocale && (oLocale.getLanguage() === "en" && oLocale.getRegion() === "US")) {
14
- /*
15
- * in US the week starts with Sunday
16
- * The first week of the year starts with January 1st. But Dec. 31 is still in the last year
17
- * So the week beginning in December and ending in January has 2 week numbers
18
- */
19
- const oJanFirst = new UniversalDate(oDate.getTime());
20
- oJanFirst.setUTCFullYear(iYear, 0, 1);
21
- iWeekDay = oJanFirst.getUTCDay();
22
-
23
- // get the date for the same weekday like jan 1.
24
- const oCheckDate = new UniversalDate(oDate.getTime());
25
- oCheckDate.setUTCDate(oCheckDate.getUTCDate() - oCheckDate.getUTCDay() + iWeekDay);
26
-
27
- iWeekNum = Math.round((oCheckDate.getTime() - oJanFirst.getTime()) / 86400000 / 7) + 1;
28
- } else {
29
- // normally the first week of the year is the one where the first Thursday of the year is
30
- // find Thursday of this week
31
- // if the checked day is before the 1. day of the week use a day of the previous week to check
32
- const oThursday = new UniversalDate(oDate.getTime());
33
- oThursday.setUTCDate(oThursday.getUTCDate() - iFirstDayOfWeek);
34
- iWeekDay = oThursday.getUTCDay();
35
- oThursday.setUTCDate(oThursday.getUTCDate() - iWeekDay + 4);
36
-
37
- const oFirstDayOfYear = new UniversalDate(oThursday.getTime());
38
- oFirstDayOfYear.setUTCMonth(0, 1);
39
- iWeekDay = oFirstDayOfYear.getUTCDay();
40
- let iAddDays = 0;
41
- if (iWeekDay > 4) {
42
- iAddDays = 7; // first day of year is after Thursday, so first Thursday is in the next week
43
- }
44
- const oFirstThursday = new UniversalDate(oFirstDayOfYear.getTime());
45
- oFirstThursday.setUTCDate(1 - iWeekDay + 4 + iAddDays);
46
-
47
- iWeekNum = Math.round((oThursday.getTime() - oFirstThursday.getTime()) / 86400000 / 7) + 1;
48
- }
49
-
50
- return iWeekNum;
51
- };
52
-
53
- export default calculateWeekNumber;
@@ -1,34 +0,0 @@
1
- import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
2
- import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
3
- import getCachedLocaleDataInstance from "../getCachedLocaleDataInstance.js";
4
-
5
- /**
6
- * Convert month number to month name (text).
7
- * If the numbers of the two months are the same you will get the name of the month,
8
- * otherwise you will get the two names separated by a dash
9
- *
10
- * @param firstMonth CalendarDate Month
11
- * @param lastMonth CalendarDate Month
12
- * @param calendarType calendar type
13
- * @returns {String}
14
- */
15
- const convertMonthNumbersToMonthNames = (firstMonth: number, lastMonth: number, calendarType?: CalendarType) => {
16
- const localeData = getCachedLocaleDataInstance(getLocale());
17
- const pattern = localeData.getIntervalPattern("");
18
- const secondaryMonthsNames = localeData.getMonthsStandAlone("abbreviated", calendarType) as Array<string>;
19
- const secondaryMonthsNamesWide = localeData.getMonthsStandAlone("wide", calendarType) as Array<string>;
20
-
21
- if (firstMonth === lastMonth) {
22
- return {
23
- text: localeData.getMonths("abbreviated", calendarType)[firstMonth],
24
- textInfo: localeData.getMonths("wide", calendarType)[firstMonth],
25
- };
26
- }
27
-
28
- return {
29
- text: pattern.replace(/\{0\}/, secondaryMonthsNames[firstMonth]).replace(/\{1\}/, secondaryMonthsNames[lastMonth]),
30
- textInfo: pattern.replace(/\{0\}/, secondaryMonthsNamesWide[firstMonth]).replace(/\{1\}/, secondaryMonthsNamesWide[lastMonth]),
31
- };
32
- };
33
-
34
- export default convertMonthNumbersToMonthNames;
@@ -1,11 +0,0 @@
1
- import CalendarDate from "./CalendarDate.js";
2
-
3
- const getDaysInMonth = (date: CalendarDate) => {
4
- const tempCalendarDate = new CalendarDate(date);
5
- tempCalendarDate.setDate(1);
6
- tempCalendarDate.setMonth(tempCalendarDate.getMonth() + 1);
7
- tempCalendarDate.setDate(0);
8
- return tempCalendarDate.getDate();
9
- };
10
-
11
- export default getDaysInMonth;
@@ -1,14 +0,0 @@
1
- /**
2
- * Returns a timestamp with only the year, month and day (with zero hours, minutes and seconds) and without 000 for milliseconds
3
- * @param { number } millisecondsUTC
4
- * @returns { number }
5
- */
6
- const getRoundedTimestamp = (millisecondsUTC: number) => {
7
- if (!millisecondsUTC) {
8
- millisecondsUTC = new Date().getTime();
9
- }
10
- const rounded = millisecondsUTC - (millisecondsUTC % (24 * 60 * 60 * 1000));
11
- return rounded / 1000;
12
- };
13
-
14
- export default getRoundedTimestamp;
@@ -1,10 +0,0 @@
1
- import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
- import CalendarDate from "./CalendarDate.js";
3
-
4
- /**
5
- * Returns a UTC timestamp representing today
6
- * @public
7
- */
8
- const getTodayUTCTimestamp = (primaryCalendarType: CalendarType) => CalendarDate.fromLocalJSDate(new Date(), primaryCalendarType).valueOf() / 1000;
9
-
10
- export default getTodayUTCTimestamp;
@@ -1,42 +0,0 @@
1
- import CalendarDate from "./CalendarDate.js";
2
-
3
- /**
4
- * Adds or subtracts a given amount of days/months/years from a date.
5
- * If minDate or maxDate are given, the result will be enforced within these limits
6
- *
7
- * @param date CalendarDate instance
8
- * @param amount how many days/months/years to add (can be a negative number)
9
- * @param unit what to modify: "day", "month" or "year"
10
- * @param minDate minimum date to enforce
11
- * @param maxDate maximum date to enforce
12
- */
13
- const modifyDateBy = (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => {
14
- const newDate = new CalendarDate(date);
15
- if (unit === "day") {
16
- newDate.setDate(date.getDate() + amount);
17
- } else if (unit === "month") {
18
- newDate.setMonth(date.getMonth() + amount);
19
- const stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month
20
- const monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month
21
- if (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios
22
- newDate.setDate(0);
23
- }
24
- } else {
25
- newDate.setYear(date.getYear() + amount);
26
- if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
27
- newDate.setDate(0); // Select the last day of the month
28
- }
29
- }
30
-
31
- if (minDate && newDate.valueOf() < minDate.valueOf()) {
32
- return new CalendarDate(minDate);
33
- }
34
-
35
- if (maxDate && newDate.valueOf() > maxDate.valueOf()) {
36
- return new CalendarDate(maxDate);
37
- }
38
-
39
- return newDate;
40
- };
41
-
42
- export default modifyDateBy;
@@ -1,21 +0,0 @@
1
- import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
- import CalendarDate from "./CalendarDate.js";
3
- import getDaysInMonth from "./getDaysInMonth.js";
4
-
5
- const transformDateToSecondaryType = (primaryCalendarType: CalendarType | undefined, secondaryCalendarType: CalendarType| undefined, timeStamp: number, hasYearPicker?: boolean) => {
6
- let firstDate = CalendarDate.fromLocalJSDate(new Date(timeStamp * 1000), primaryCalendarType);
7
- let lastDate = CalendarDate.fromLocalJSDate(new Date(timeStamp * 1000), primaryCalendarType);
8
- firstDate.setDate(1);
9
-
10
- if (hasYearPicker) {
11
- firstDate.setMonth(0);
12
- lastDate.setMonth(11);
13
- }
14
-
15
- lastDate.setDate(getDaysInMonth(lastDate));
16
- firstDate = new CalendarDate(firstDate, secondaryCalendarType);
17
- lastDate = new CalendarDate(lastDate, secondaryCalendarType);
18
- return { firstDate, lastDate };
19
- };
20
-
21
- export default transformDateToSecondaryType;
@@ -1 +0,0 @@
1
- import "../../sap/ui/core/date/Buddhist.js";
@@ -1 +0,0 @@
1
- import "../../sap/ui/core/date/Gregorian.js";