@ui5/webcomponents-localization 0.0.0-b053ad005 → 0.0.0-b132dd7b9

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 (245) hide show
  1. package/.eslintignore +2 -1
  2. package/.npsrc.json +3 -0
  3. package/CHANGELOG.md +1761 -0
  4. package/README.md +6 -9
  5. package/dist/.tsbuildinfo +1 -0
  6. package/dist/Assets-fetch.d.ts +1 -0
  7. package/dist/Assets-fetch.js +3 -0
  8. package/dist/Assets-fetch.js.map +1 -0
  9. package/dist/Assets.d.ts +1 -0
  10. package/dist/Assets.js +1 -0
  11. package/dist/Assets.js.map +1 -0
  12. package/dist/CalendarUtils.d.ts +3 -0
  13. package/dist/CalendarUtils.js +6 -0
  14. package/dist/CalendarUtils.js.map +1 -0
  15. package/dist/DateFormat.d.ts +5 -0
  16. package/dist/DateFormat.js +6 -2
  17. package/dist/DateFormat.js.map +1 -0
  18. package/dist/LocaleData.d.ts +5 -0
  19. package/dist/LocaleData.js +6 -2
  20. package/dist/LocaleData.js.map +1 -0
  21. package/dist/dates/CalendarDate.d.ts +42 -0
  22. package/dist/dates/CalendarDate.js +171 -201
  23. package/dist/dates/CalendarDate.js.map +1 -0
  24. package/dist/dates/ExtremeDates.d.ts +5 -0
  25. package/dist/dates/ExtremeDates.js +25 -35
  26. package/dist/dates/ExtremeDates.js.map +1 -0
  27. package/dist/dates/UI5Date.d.ts +5 -0
  28. package/dist/dates/UI5Date.js +7 -0
  29. package/dist/dates/UI5Date.js.map +1 -0
  30. package/dist/dates/UniversalDate.d.ts +47 -0
  31. package/dist/dates/UniversalDate.js +5 -0
  32. package/dist/dates/UniversalDate.js.map +1 -0
  33. package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
  34. package/dist/dates/convertMonthNumbersToMonthNames.js +30 -0
  35. package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
  36. package/dist/dates/getDaysInMonth.d.ts +3 -0
  37. package/dist/dates/getDaysInMonth.js +10 -0
  38. package/dist/dates/getDaysInMonth.js.map +1 -0
  39. package/dist/dates/getRoundedTimestamp.d.ts +7 -0
  40. package/dist/dates/getRoundedTimestamp.js +10 -9
  41. package/dist/dates/getRoundedTimestamp.js.map +1 -0
  42. package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
  43. package/dist/dates/getTodayUTCTimestamp.js +3 -3
  44. package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
  45. package/dist/dates/modifyDateBy.d.ts +14 -0
  46. package/dist/dates/modifyDateBy.js +42 -29
  47. package/dist/dates/modifyDateBy.js.map +1 -0
  48. package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
  49. package/dist/dates/transformDateToSecondaryType.js +18 -0
  50. package/dist/dates/transformDateToSecondaryType.js.map +1 -0
  51. package/dist/features/calendar/Buddhist.js +1 -0
  52. package/dist/features/calendar/Buddhist.js.map +1 -0
  53. package/dist/features/calendar/Gregorian.js +1 -0
  54. package/dist/features/calendar/Gregorian.js.map +1 -0
  55. package/dist/features/calendar/Islamic.js +1 -0
  56. package/dist/features/calendar/Islamic.js.map +1 -0
  57. package/dist/features/calendar/Japanese.js +1 -0
  58. package/dist/features/calendar/Japanese.js.map +1 -0
  59. package/dist/features/calendar/Persian.js +1 -0
  60. package/dist/features/calendar/Persian.js.map +1 -0
  61. package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
  62. package/dist/generated/assets/cldr/ar.json +1690 -511
  63. package/dist/generated/assets/cldr/ar_EG.json +1690 -511
  64. package/dist/generated/assets/cldr/ar_SA.json +1785 -607
  65. package/dist/generated/assets/cldr/bg.json +1663 -663
  66. package/dist/generated/assets/cldr/ca.json +1635 -550
  67. package/dist/generated/assets/cldr/cnr.json +6169 -0
  68. package/dist/generated/assets/cldr/cs.json +1618 -409
  69. package/dist/generated/assets/cldr/cy.json +1686 -640
  70. package/dist/generated/assets/cldr/da.json +1579 -542
  71. package/dist/generated/assets/cldr/de.json +1504 -374
  72. package/dist/generated/assets/cldr/de_AT.json +1494 -364
  73. package/dist/generated/assets/cldr/de_CH.json +1513 -383
  74. package/dist/generated/assets/cldr/el.json +1220 -273
  75. package/dist/generated/assets/cldr/el_CY.json +1220 -273
  76. package/dist/generated/assets/cldr/en.json +1619 -548
  77. package/dist/generated/assets/cldr/en_AU.json +1757 -637
  78. package/dist/generated/assets/cldr/en_GB.json +1630 -528
  79. package/dist/generated/assets/cldr/en_HK.json +1713 -608
  80. package/dist/generated/assets/cldr/en_IE.json +1678 -576
  81. package/dist/generated/assets/cldr/en_IN.json +1661 -555
  82. package/dist/generated/assets/cldr/en_NZ.json +1697 -595
  83. package/dist/generated/assets/cldr/en_PG.json +1698 -596
  84. package/dist/generated/assets/cldr/en_SG.json +1687 -582
  85. package/dist/generated/assets/cldr/en_ZA.json +1675 -573
  86. package/dist/generated/assets/cldr/es.json +1893 -704
  87. package/dist/generated/assets/cldr/es_AR.json +1835 -645
  88. package/dist/generated/assets/cldr/es_BO.json +1880 -690
  89. package/dist/generated/assets/cldr/es_CL.json +1721 -639
  90. package/dist/generated/assets/cldr/es_CO.json +1637 -554
  91. package/dist/generated/assets/cldr/es_MX.json +2050 -860
  92. package/dist/generated/assets/cldr/es_PE.json +1565 -591
  93. package/dist/generated/assets/cldr/es_UY.json +1593 -619
  94. package/dist/generated/assets/cldr/es_VE.json +1611 -637
  95. package/dist/generated/assets/cldr/et.json +1426 -368
  96. package/dist/generated/assets/cldr/fa.json +1548 -483
  97. package/dist/generated/assets/cldr/fi.json +1528 -343
  98. package/dist/generated/assets/cldr/fr.json +1435 -419
  99. package/dist/generated/assets/cldr/fr_BE.json +1432 -416
  100. package/dist/generated/assets/cldr/fr_CA.json +1571 -555
  101. package/dist/generated/assets/cldr/fr_CH.json +1385 -369
  102. package/dist/generated/assets/cldr/fr_LU.json +1435 -419
  103. package/dist/generated/assets/cldr/he.json +1697 -536
  104. package/dist/generated/assets/cldr/hi.json +1221 -193
  105. package/dist/generated/assets/cldr/hr.json +1760 -485
  106. package/dist/generated/assets/cldr/hu.json +1390 -303
  107. package/dist/generated/assets/cldr/id.json +1640 -570
  108. package/dist/generated/assets/cldr/it.json +1489 -455
  109. package/dist/generated/assets/cldr/it_CH.json +1489 -455
  110. package/dist/generated/assets/cldr/ja.json +1143 -86
  111. package/dist/generated/assets/cldr/kk.json +1782 -570
  112. package/dist/generated/assets/cldr/ko.json +1192 -162
  113. package/dist/generated/assets/cldr/lt.json +1383 -288
  114. package/dist/generated/assets/cldr/lv.json +1369 -369
  115. package/dist/generated/assets/cldr/mk.json +6045 -0
  116. package/dist/generated/assets/cldr/ms.json +1598 -551
  117. package/dist/generated/assets/cldr/nb.json +1265 -209
  118. package/dist/generated/assets/cldr/nl.json +1741 -425
  119. package/dist/generated/assets/cldr/nl_BE.json +1741 -425
  120. package/dist/generated/assets/cldr/pl.json +1903 -492
  121. package/dist/generated/assets/cldr/pt.json +1913 -605
  122. package/dist/generated/assets/cldr/pt_PT.json +1871 -633
  123. package/dist/generated/assets/cldr/ro.json +1590 -482
  124. package/dist/generated/assets/cldr/ru.json +1608 -514
  125. package/dist/generated/assets/cldr/ru_UA.json +1602 -508
  126. package/dist/generated/assets/cldr/sk.json +1629 -569
  127. package/dist/generated/assets/cldr/sl.json +1532 -430
  128. package/dist/generated/assets/cldr/sr.json +1459 -346
  129. package/dist/generated/assets/cldr/sr_Latn.json +2088 -991
  130. package/dist/generated/assets/cldr/sv.json +1508 -445
  131. package/dist/generated/assets/cldr/th.json +1313 -237
  132. package/dist/generated/assets/cldr/tr.json +1549 -436
  133. package/dist/generated/assets/cldr/uk.json +1619 -520
  134. package/dist/generated/assets/cldr/vi.json +1423 -429
  135. package/dist/generated/assets/cldr/zh_CN.json +1425 -342
  136. package/dist/generated/assets/cldr/zh_HK.json +1396 -312
  137. package/dist/generated/assets/cldr/zh_SG.json +1401 -317
  138. package/dist/generated/assets/cldr/zh_TW.json +1256 -193
  139. package/dist/generated/json-imports/LocaleData-fetch.d.ts +1 -0
  140. package/dist/generated/json-imports/LocaleData-fetch.js +93 -0
  141. package/dist/generated/json-imports/LocaleData-fetch.js.map +1 -0
  142. package/dist/generated/json-imports/LocaleData.d.ts +1 -0
  143. package/dist/generated/json-imports/LocaleData.js +89 -88
  144. package/dist/generated/json-imports/LocaleData.js.map +1 -0
  145. package/dist/getCachedLocaleDataInstance.d.ts +4 -0
  146. package/dist/getCachedLocaleDataInstance.js +6 -9
  147. package/dist/getCachedLocaleDataInstance.js.map +1 -0
  148. package/dist/locale/getLocaleData.d.ts +11 -0
  149. package/dist/locale/getLocaleData.js +13 -17
  150. package/dist/locale/getLocaleData.js.map +1 -0
  151. package/dist/sap/base/Event.js +59 -0
  152. package/dist/sap/base/Eventing.js +146 -0
  153. package/dist/sap/base/Log.js +2 -240
  154. package/dist/sap/base/assert.js +31 -5
  155. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  156. package/dist/sap/base/config.js +17 -0
  157. package/dist/sap/base/i18n/Formatting.d.ts +8 -0
  158. package/dist/sap/base/i18n/Formatting.js +11 -0
  159. package/dist/sap/base/i18n/Formatting.js.map +1 -0
  160. package/dist/sap/base/i18n/LanguageTag.js +173 -0
  161. package/dist/sap/base/i18n/Localization.d.ts +4 -0
  162. package/dist/sap/base/i18n/Localization.js +12 -0
  163. package/dist/sap/base/i18n/Localization.js.map +1 -0
  164. package/dist/sap/base/i18n/date/CalendarType.js +43 -0
  165. package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +105 -0
  166. package/dist/sap/base/i18n/date/TimezoneUtils.js +319 -0
  167. package/dist/sap/base/strings/camelize.js +30 -0
  168. package/dist/sap/base/strings/formatMessage.js +88 -15
  169. package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
  170. package/dist/sap/base/util/LoaderExtensions.js +9 -12
  171. package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
  172. package/dist/sap/base/util/ObjectPath.d.ts +4 -0
  173. package/dist/sap/base/util/ObjectPath.js +4 -33
  174. package/dist/sap/base/util/ObjectPath.js.map +1 -0
  175. package/dist/sap/base/util/Version.js +157 -0
  176. package/dist/sap/base/util/_merge.js +83 -26
  177. package/dist/sap/base/util/array/uniqueSort.js +37 -15
  178. package/dist/sap/base/util/deepClone.js +102 -0
  179. package/dist/sap/base/util/deepEqual.js +75 -51
  180. package/dist/sap/base/util/extend.js +58 -7
  181. package/dist/sap/base/util/isEmptyObject.js +34 -0
  182. package/dist/sap/base/util/isPlainObject.js +35 -1
  183. package/dist/sap/base/util/now.js +24 -3
  184. package/dist/sap/base/util/resolveReference.js +3 -0
  185. package/dist/sap/base/util/uid.js +27 -0
  186. package/dist/sap/ui/base/DataType.js +657 -0
  187. package/dist/sap/ui/base/Interface.js +47 -1
  188. package/dist/sap/ui/base/Metadata.js +435 -171
  189. package/dist/sap/ui/base/Object.js +284 -48
  190. package/dist/sap/ui/core/CalendarType.js +24 -8
  191. package/dist/sap/ui/core/Configuration.d.ts +17 -0
  192. package/dist/sap/ui/core/Configuration.js +23 -0
  193. package/dist/sap/ui/core/Configuration.js.map +1 -0
  194. package/dist/sap/ui/core/Core.d.ts +25 -0
  195. package/dist/sap/ui/core/Core.js +7 -32
  196. package/dist/sap/ui/core/Core.js.map +1 -0
  197. package/dist/sap/ui/core/FormatSettings.d.ts +9 -0
  198. package/dist/sap/ui/core/FormatSettings.js +12 -0
  199. package/dist/sap/ui/core/FormatSettings.js.map +1 -0
  200. package/dist/sap/ui/core/Locale.js +190 -142
  201. package/dist/sap/ui/core/LocaleData.js +2665 -1202
  202. package/dist/sap/ui/core/Supportability.js +5 -0
  203. package/dist/sap/ui/core/Theming.js +539 -0
  204. package/dist/sap/ui/core/date/Buddhist.js +162 -93
  205. package/dist/sap/ui/core/date/CalendarUtils.js +65 -0
  206. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -0
  207. package/dist/sap/ui/core/date/Gregorian.js +25 -10
  208. package/dist/sap/ui/core/date/Islamic.js +298 -185
  209. package/dist/sap/ui/core/date/Japanese.js +212 -117
  210. package/dist/sap/ui/core/date/Persian.js +324 -195
  211. package/dist/sap/ui/core/date/UI5Date.js +991 -0
  212. package/dist/sap/ui/core/date/UniversalDate.js +1251 -211
  213. package/dist/sap/ui/core/date/_Calendars.js +10 -1
  214. package/dist/sap/ui/core/format/DateFormat.js +3163 -1794
  215. package/dist/sap/ui/core/format/TimezoneUtil.js +24 -0
  216. package/package-scripts.cjs +28 -0
  217. package/package.json +14 -6
  218. package/tsconfig.json +24 -0
  219. package/used-modules.txt +28 -2
  220. package/dist/Assets-static.js +0 -2
  221. package/dist/dates/calculateWeekNumber.js +0 -51
  222. package/dist/generated/json-imports/LocaleData-static.js +0 -89
  223. package/dist/sap/ui/Device.js +0 -5
  224. package/hash.txt +0 -1
  225. package/package-scripts.js +0 -40
  226. package/src/Assets-static.js +0 -2
  227. package/src/Assets.js +0 -2
  228. package/src/DateFormat.js +0 -3
  229. package/src/LocaleData.js +0 -3
  230. package/src/dates/CalendarDate.js +0 -223
  231. package/src/dates/ExtremeDates.js +0 -39
  232. package/src/dates/calculateWeekNumber.js +0 -51
  233. package/src/dates/getRoundedTimestamp.js +0 -14
  234. package/src/dates/getTodayUTCTimestamp.js +0 -9
  235. package/src/dates/modifyDateBy.js +0 -42
  236. package/src/getCachedLocaleDataInstance.js +0 -13
  237. package/src/locale/getLocaleData.js +0 -27
  238. package/src/sap/base/util/LoaderExtensions.js +0 -17
  239. package/src/sap/ui/core/Core.js +0 -38
  240. /package/{config/.eslintrc.js → .eslintrc.cjs} +0 -0
  241. /package/{src/features/calendar/Buddhist.js → dist/features/calendar/Buddhist.d.ts} +0 -0
  242. /package/{src/features/calendar/Gregorian.js → dist/features/calendar/Gregorian.d.ts} +0 -0
  243. /package/{src/features/calendar/Islamic.js → dist/features/calendar/Islamic.d.ts} +0 -0
  244. /package/{src/features/calendar/Japanese.js → dist/features/calendar/Japanese.d.ts} +0 -0
  245. /package/{src/features/calendar/Persian.js → dist/features/calendar/Persian.d.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * OpenUI5
3
+ * (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+ import TimezoneUtils from "../../../base/i18n/date/TimezoneUtils.js";
7
+ /**
8
+ * Static collection of utility functions to handle time zone related conversions
9
+ *
10
+ * @author SAP SE
11
+ * @version 1.120.17
12
+ * @namespace
13
+ * @name module:sap/ui/core/format/TimezoneUtils
14
+ * @private
15
+ * @ui5-restricted sap.ui.core.Configuration, sap.ui.core.format.DateFormat
16
+ *
17
+ * @borrows sap/base/i18n/date/TimezoneUtils.isValidTimezone as isValidTimezone
18
+ * @borrows sap/base/i18n/date/TimezoneUtils.convertToTimezone as convertToTimezone
19
+ * @borrows sap/base/i18n/date/TimezoneUtils._getParts as _getParts
20
+ * @borrows sap/base/i18n/date/TimezoneUtils._getDateFromParts as _getDateFromParts
21
+ * @borrows sap/base/i18n/date/TimezoneUtils.calculateOffset as calculateOffset
22
+ * @borrows sap/base/i18n/date/TimezoneUtils.getLocalTimezone as getLocalTimezone
23
+ */
24
+ export default TimezoneUtils;
@@ -0,0 +1,28 @@
1
+ const resolve = require("resolve");
2
+
3
+ const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js");
4
+ const amdToES6 = resolve.sync("@ui5/webcomponents-tools/lib/amd-to-es6/index.js");
5
+ const noRequire = resolve.sync("@ui5/webcomponents-tools/lib/amd-to-es6/no-remaining-require.js");
6
+
7
+ const scripts = {
8
+ clean: "rimraf src/generated && rimraf dist",
9
+ lint: "eslint .",
10
+ generate: "nps clean copy.used-modules copy.cldr copy.overlay build.amd-to-es6 build.jsonImports",
11
+ build: {
12
+ "default": "nps clean copy.used-modules copy.cldr copy.overlay build.amd-to-es6 build.jsonImports build.typescript build.no-remaining-require",
13
+ "amd-to-es6": `node "${amdToES6}" dist/`,
14
+ "no-remaining-require": `node "${noRequire}" dist/`,
15
+ typescript: "tsc --build",
16
+ jsonImports: "node ./lib/generate-json-imports/cldr.js",
17
+ },
18
+ typescript: "tsc --build",
19
+ copy: {
20
+ "used-modules": `node "${copyUsedModules}" ./used-modules.txt dist/`,
21
+ cldr: `copy-and-watch "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/*" dist/generated/assets/cldr/`,
22
+ overlay: `copy-and-watch "overlay/**/*.js" dist/`,
23
+ },
24
+ };
25
+
26
+ module.exports = {
27
+ scripts,
28
+ };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-localization",
3
- "version": "0.0.0-b053ad005",
3
+ "version": "0.0.0-b132dd7b9",
4
4
  "description": "Localization for UI5 Web Components",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
7
+ "type": "module",
7
8
  "keywords": [
8
9
  "openui5",
9
10
  "sapui5",
@@ -24,16 +25,23 @@
24
25
  "lint": "nps lint",
25
26
  "start": "nps start",
26
27
  "build": "nps build",
27
- "hash": "nps hash",
28
- "prepublishOnly": "npm run clean && npm run build"
28
+ "generate": "nps generate",
29
+ "prepublishOnly": "tsc -b"
29
30
  },
30
31
  "devDependencies": {
31
- "@ui5/webcomponents-tools": "0.0.0-b053ad005",
32
- "chromedriver": "95.0.0",
32
+ "@babel/core": "^7.23.7",
33
+ "@babel/generator": "^7.23.6",
34
+ "@babel/parser": "^7.23.6",
35
+ "@openui5/sap.ui.core": "1.120.17",
36
+ "@ui5/webcomponents-tools": "0.0.0-b132dd7b9",
37
+ "babel-plugin-amd-to-esm": "^2.0.3",
38
+ "chromedriver": "^135.0.0",
39
+ "estree-walk": "^2.2.0",
33
40
  "mkdirp": "^1.0.4",
34
41
  "resolve": "^1.20.0"
35
42
  },
36
43
  "dependencies": {
37
- "@ui5/webcomponents-base": "0.0.0-b053ad005"
44
+ "@types/openui5": "^1.113.0",
45
+ "@ui5/webcomponents-base": "0.0.0-b132dd7b9"
38
46
  }
39
47
  }
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": "@ui5/webcomponents-tools/tsconfig.json",
3
+ "include": [
4
+ "src/**/*"
5
+ ],
6
+ "compilerOptions": {
7
+ "outDir": "dist",
8
+ "composite": true,
9
+ "rootDir": "src",
10
+ "module": "NodeNext",
11
+ "moduleResolution": "NodeNext",
12
+ "tsBuildInfoFile": "dist/.tsbuildinfo",
13
+ "paths": {
14
+ "@ui5/webcomponents-base/dist/*": [
15
+ "../base/src/*"
16
+ ],
17
+ },
18
+ },
19
+ "references": [
20
+ {
21
+ "path": "../base"
22
+ }
23
+ ]
24
+ }
package/used-modules.txt CHANGED
@@ -1,25 +1,51 @@
1
1
  # Needed files from OpenUI5 - the commented ones are currently overlaid, therefore should not be copied
2
2
 
3
- sap/base/Log.js
3
+ # ./ui5loader-autoconfig.js
4
+ # sap/base/Log.js
4
5
  sap/base/assert.js
6
+ # sap/base/config.js
7
+ sap/base/config/MemoryConfigurationProvider.js
8
+ sap/base/Event.js
9
+ sap/base/Eventing.js
10
+ sap/ui/base/DataType.js
11
+ sap/base/i18n/LanguageTag.js
12
+ sap/base/i18n/date/CalendarWeekNumbering.js
13
+ sap/base/i18n/date/TimezoneUtils.js
14
+ sap/base/i18n/date/CalendarType.js
15
+ sap/base/i18n/Localization.js
5
16
  sap/base/strings/formatMessage.js
17
+ sap/base/strings/camelize.js
6
18
  sap/base/util/ObjectPath.js
19
+ sap/base/util/resolveReference.js
7
20
  sap/base/util/array/uniqueSort.js
8
21
  sap/base/util/deepEqual.js
9
22
  sap/base/util/isPlainObject.js
23
+ sap/base/util/isEmptyObject.js
10
24
  sap/base/util/now.js
25
+ sap/base/util/uid.js
11
26
  sap/base/util/_merge.js
12
27
  sap/base/util/extend.js
28
+ sap/base/util/deepClone.js
29
+ sap/base/util/Version.js
13
30
  sap/ui/base/Interface.js
14
31
  sap/ui/base/Metadata.js
15
32
  sap/ui/base/Object.js
16
33
  sap/ui/core/CalendarType.js
34
+ sap/ui/core/Configuration.js
35
+ sap/ui/core/Supportability.js
17
36
  sap/ui/core/Locale.js
18
37
  sap/ui/core/LocaleData.js
38
+ sap/ui/core/Theming.js
39
+ sap/ui/core/date/CalendarWeekNumbering.js
40
+ sap/ui/core/date/_Calendars.js
19
41
  sap/ui/core/date/Buddhist.js
42
+ sap/ui/core/date/CalendarUtils.js
43
+ sap/ui/core/date/CalendarWeekNumbering.js
20
44
  sap/ui/core/date/Gregorian.js
21
45
  sap/ui/core/date/Islamic.js
22
46
  sap/ui/core/date/Japanese.js
23
47
  sap/ui/core/date/Persian.js
48
+ sap/ui/core/date/UI5Date.js
24
49
  sap/ui/core/date/UniversalDate.js
25
- sap/ui/core/format/DateFormat.js
50
+ sap/ui/core/format/TimezoneUtil.js
51
+ sap/ui/core/format/DateFormat.js
@@ -1,2 +0,0 @@
1
- // Currently the base package provides CLDR assets only
2
- import "./generated/json-imports/LocaleData-static.js";
@@ -1,51 +0,0 @@
1
- import UniversalDate from "../sap/ui/core/date/UniversalDate.js";
2
-
3
- const calculateWeekNumber = (confFirstDayOfWeek, oDate, iYear, oLocale, oLocaleData) => {
4
- let iWeekNum = 0;
5
- let iWeekDay = 0;
6
- const iFirstDayOfWeek = Number.isInteger(confFirstDayOfWeek) ? confFirstDayOfWeek : oLocaleData.getFirstDayOfWeek();
7
-
8
- // search Locale for containing "en-US", since sometimes
9
- // when any user settings have been defined, subtag "sapufmt" is added to the locale name
10
- // this is described inside sap.ui.core.Configuration file
11
- if (oLocale && (oLocale.getLanguage() === "en" && oLocale.getRegion() === "US")) {
12
- /*
13
- * in US the week starts with Sunday
14
- * The first week of the year starts with January 1st. But Dec. 31 is still in the last year
15
- * So the week beginning in December and ending in January has 2 week numbers
16
- */
17
- const oJanFirst = new UniversalDate(oDate.getTime());
18
- oJanFirst.setUTCFullYear(iYear, 0, 1);
19
- iWeekDay = oJanFirst.getUTCDay();
20
-
21
- // get the date for the same weekday like jan 1.
22
- const oCheckDate = new UniversalDate(oDate.getTime());
23
- oCheckDate.setUTCDate(oCheckDate.getUTCDate() - oCheckDate.getUTCDay() + iWeekDay);
24
-
25
- iWeekNum = Math.round((oCheckDate.getTime() - oJanFirst.getTime()) / 86400000 / 7) + 1;
26
- } else {
27
- // normally the first week of the year is the one where the first Thursday of the year is
28
- // find Thursday of this week
29
- // if the checked day is before the 1. day of the week use a day of the previous week to check
30
- const oThursday = new UniversalDate(oDate.getTime());
31
- oThursday.setUTCDate(oThursday.getUTCDate() - iFirstDayOfWeek);
32
- iWeekDay = oThursday.getUTCDay();
33
- oThursday.setUTCDate(oThursday.getUTCDate() - iWeekDay + 4);
34
-
35
- const oFirstDayOfYear = new UniversalDate(oThursday.getTime());
36
- oFirstDayOfYear.setUTCMonth(0, 1);
37
- iWeekDay = oFirstDayOfYear.getUTCDay();
38
- let iAddDays = 0;
39
- if (iWeekDay > 4) {
40
- iAddDays = 7; // first day of year is after Thursday, so first Thursday is in the next week
41
- }
42
- const oFirstThursday = new UniversalDate(oFirstDayOfYear.getTime());
43
- oFirstThursday.setUTCDate(1 - iWeekDay + 4 + iAddDays);
44
-
45
- iWeekNum = Math.round((oThursday.getTime() - oFirstThursday.getTime()) / 86400000 / 7) + 1;
46
- }
47
-
48
- return iWeekNum;
49
- };
50
-
51
- export default calculateWeekNumber;
@@ -1,89 +0,0 @@
1
- import { registerLocaleDataLoader } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
2
-
3
- import ar from "../assets/cldr/ar.json";
4
- import ar_EG from "../assets/cldr/ar_EG.json";
5
- import ar_SA from "../assets/cldr/ar_SA.json";
6
- import bg from "../assets/cldr/bg.json";
7
- import ca from "../assets/cldr/ca.json";
8
- import cs from "../assets/cldr/cs.json";
9
- import da from "../assets/cldr/da.json";
10
- import de from "../assets/cldr/de.json";
11
- import de_AT from "../assets/cldr/de_AT.json";
12
- import de_CH from "../assets/cldr/de_CH.json";
13
- import el from "../assets/cldr/el.json";
14
- import el_CY from "../assets/cldr/el_CY.json";
15
- import en from "../assets/cldr/en.json";
16
- import en_AU from "../assets/cldr/en_AU.json";
17
- import en_GB from "../assets/cldr/en_GB.json";
18
- import en_HK from "../assets/cldr/en_HK.json";
19
- import en_IE from "../assets/cldr/en_IE.json";
20
- import en_IN from "../assets/cldr/en_IN.json";
21
- import en_NZ from "../assets/cldr/en_NZ.json";
22
- import en_PG from "../assets/cldr/en_PG.json";
23
- import en_SG from "../assets/cldr/en_SG.json";
24
- import en_ZA from "../assets/cldr/en_ZA.json";
25
- import es from "../assets/cldr/es.json";
26
- import es_AR from "../assets/cldr/es_AR.json";
27
- import es_BO from "../assets/cldr/es_BO.json";
28
- import es_CL from "../assets/cldr/es_CL.json";
29
- import es_CO from "../assets/cldr/es_CO.json";
30
- import es_MX from "../assets/cldr/es_MX.json";
31
- import es_PE from "../assets/cldr/es_PE.json";
32
- import es_UY from "../assets/cldr/es_UY.json";
33
- import es_VE from "../assets/cldr/es_VE.json";
34
- import et from "../assets/cldr/et.json";
35
- import fa from "../assets/cldr/fa.json";
36
- import fi from "../assets/cldr/fi.json";
37
- import fr from "../assets/cldr/fr.json";
38
- import fr_BE from "../assets/cldr/fr_BE.json";
39
- import fr_CA from "../assets/cldr/fr_CA.json";
40
- import fr_CH from "../assets/cldr/fr_CH.json";
41
- import fr_LU from "../assets/cldr/fr_LU.json";
42
- import he from "../assets/cldr/he.json";
43
- import hi from "../assets/cldr/hi.json";
44
- import hr from "../assets/cldr/hr.json";
45
- import hu from "../assets/cldr/hu.json";
46
- import id from "../assets/cldr/id.json";
47
- import it from "../assets/cldr/it.json";
48
- import it_CH from "../assets/cldr/it_CH.json";
49
- import ja from "../assets/cldr/ja.json";
50
- import kk from "../assets/cldr/kk.json";
51
- import ko from "../assets/cldr/ko.json";
52
- import lt from "../assets/cldr/lt.json";
53
- import lv from "../assets/cldr/lv.json";
54
- import ms from "../assets/cldr/ms.json";
55
- import nb from "../assets/cldr/nb.json";
56
- import nl from "../assets/cldr/nl.json";
57
- import nl_BE from "../assets/cldr/nl_BE.json";
58
- import pl from "../assets/cldr/pl.json";
59
- import pt from "../assets/cldr/pt.json";
60
- import pt_PT from "../assets/cldr/pt_PT.json";
61
- import ro from "../assets/cldr/ro.json";
62
- import ru from "../assets/cldr/ru.json";
63
- import ru_UA from "../assets/cldr/ru_UA.json";
64
- import sk from "../assets/cldr/sk.json";
65
- import sl from "../assets/cldr/sl.json";
66
- import sr from "../assets/cldr/sr.json";
67
- import sv from "../assets/cldr/sv.json";
68
- import th from "../assets/cldr/th.json";
69
- import tr from "../assets/cldr/tr.json";
70
- import uk from "../assets/cldr/uk.json";
71
- import vi from "../assets/cldr/vi.json";
72
- import zh_CN from "../assets/cldr/zh_CN.json";
73
- import zh_HK from "../assets/cldr/zh_HK.json";
74
- import zh_SG from "../assets/cldr/zh_SG.json";
75
- import zh_TW from "../assets/cldr/zh_TW.json";
76
-
77
- const cldrData = {
78
- ar,ar_EG,ar_SA,bg,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
79
- };
80
-
81
- const fetchCldrJson = async (localeId) => {
82
- if (typeof cldrData[localeId] === "object") {
83
- // inlined from build
84
- throw new Error("[LocaleData] Inlined JSON not supported with static imports of assets. Use dynamic imports of assets or configure JSON imports as URLs")
85
- }
86
- return (await fetch(cldrData[localeId])).json();
87
- }
88
-
89
- Object.keys(cldrData).forEach(localeId => registerLocaleDataLoader(localeId, fetchCldrJson));
@@ -1,5 +0,0 @@
1
- export default {
2
- browser: {
3
- phantomJS: false
4
- }
5
- };
package/hash.txt DELETED
@@ -1 +0,0 @@
1
- 65ggwN6ZkFOPO38ZE2UOXXibHi8=
@@ -1,40 +0,0 @@
1
- const resolve = require("resolve");
2
- const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js");
3
- const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js");
4
- const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js");
5
- const replaceGlobalCore = resolve.sync("@ui5/webcomponents-tools/lib/replace-global-core/index.js");
6
- const esmAbsToRel = resolve.sync("@ui5/webcomponents-tools/lib/esm-abs-to-rel/index.js");
7
- const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date."`;
8
-
9
- const scripts = {
10
- clean: "rimraf dist",
11
- lint: "eslint . --config config/.eslintrc.js",
12
- build: {
13
- "default": `${UP_TO_DATE} || nps build.all hash`,
14
- all: "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 copy.src",
15
- "replace-amd": "replace-in-file sap.ui.define define dist/**/*.js",
16
- "replace-export-true": `replace-in-file ", /* bExport= */ true" "" dist/**/*.js`,
17
- "replace-export-false": `replace-in-file ", /* bExport= */ false" "" dist/**/*.js`,
18
- "amd-to-es6": "amdtoes6 --src=dist --replace --glob=**/*.js",
19
- "replace-global-core-usage": `node "${replaceGlobalCore}" dist/`,
20
- "esm-abs-to-rel": `node "${esmAbsToRel}" dist/`,
21
- jsonImports: "node ./lib/generate-json-imports/cldr.js"
22
- },
23
- copy: {
24
- "used-modules": `node "${copyUsedModules}" ./used-modules.txt dist/`,
25
- cldr: `copy-and-watch "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/*.json" dist/generated/assets/cldr/`,
26
- overlay: `copy-and-watch "overlay/**/*.js" dist/`,
27
- src: `copy-and-watch "src/**/*.js" dist/`,
28
- },
29
- watch: {
30
- default: 'nps watch.src',
31
- src: `nps "copy.src --watch --skip-initial-copy"`,
32
- },
33
- start: "nps watch",
34
- hash: `node ${generateHash} dist/ hash.txt`
35
- };
36
-
37
-
38
- module.exports = {
39
- scripts,
40
- };
@@ -1,2 +0,0 @@
1
- // Currently the base package provides CLDR assets only
2
- import "./generated/json-imports/LocaleData-static.js";
package/src/Assets.js DELETED
@@ -1,2 +0,0 @@
1
- // Currently the base package provides CLDR assets only
2
- import "./generated/json-imports/LocaleData.js";
package/src/DateFormat.js DELETED
@@ -1,3 +0,0 @@
1
- import DateFormat from "./sap/ui/core/format/DateFormat.js";
2
-
3
- export default DateFormat;
package/src/LocaleData.js DELETED
@@ -1,3 +0,0 @@
1
- import LocaleData from "./sap/ui/core/LocaleData.js";
2
-
3
- export default LocaleData;
@@ -1,223 +0,0 @@
1
- import UniversalDate from "../sap/ui/core/date/UniversalDate.js";
2
-
3
- class CalendarDate {
4
- constructor() {
5
- let aArgs = arguments, // eslint-disable-line
6
- oJSDate,
7
- oNow,
8
- sCalendarType;
9
-
10
- switch (aArgs.length) {
11
- case 0: // defaults to the current date
12
- oNow = new Date();
13
- return this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate());
14
-
15
- case 1: // CalendarDate
16
- case 2: // CalendarDate, sCalendarType
17
- if (!(aArgs[0] instanceof CalendarDate)) {
18
- throw new Error("Invalid arguments: the first argument must be of type sap.ui.unified.calendar.CalendarDate.");
19
- }
20
- sCalendarType = aArgs[1] ? aArgs[1] : aArgs[0]._oUDate.sCalendarType;
21
- // Use source.valueOf() (returns the same point of time regardless calendar type) instead of
22
- // source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date
23
- oJSDate = new Date(aArgs[0].valueOf());
24
-
25
- // Make this date really local. Now getters are safe.
26
- oJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());
27
- oJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());
28
-
29
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
30
- break;
31
-
32
- case 3: // year, month, date
33
- case 4: // year, month, date, sCalendarType
34
- checkNumericLike(aArgs[0], `Invalid year: ${aArgs[0]}`);
35
- checkNumericLike(aArgs[1], `Invalid month: ${aArgs[1]}`);
36
- checkNumericLike(aArgs[2], `Invalid date: ${aArgs[2]}`);
37
-
38
- oJSDate = new Date(0, 0, 1);
39
- oJSDate.setFullYear(aArgs[0], aArgs[1], aArgs[2]); // 2 digits year is not supported. If so, it is considered as full year as well.
40
-
41
- if (aArgs[3]) {
42
- sCalendarType = aArgs[3];
43
- }
44
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
45
- break;
46
-
47
- default:
48
- throw new Error(`${"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType"
49
- + "or 2) year, month, date, (optional) calendarType"}${aArgs}`);
50
- }
51
- }
52
-
53
- getYear() {
54
- return this._oUDate.getUTCFullYear();
55
- }
56
-
57
- setYear(year) {
58
- checkNumericLike(year, `Invalid year: ${year}`);
59
- this._oUDate.setUTCFullYear(year);
60
- return this;
61
- }
62
-
63
- getMonth() {
64
- return this._oUDate.getUTCMonth();
65
- }
66
-
67
- /**
68
- * Sets the given month as ordinal month of the year.
69
- * @param {int} month An integer between 0 and 11, representing the months January through December( or their
70
- * equivalent month names for the given calendar).
71
- * If the specified value is is outside of the expected range, this method attempts to update the date information
72
- * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
73
- * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
74
- * 0 will result in the previous month's last day.
75
- * -1 will result in the day before the previous month's last day.
76
- * 32 will result in:
77
- * - first day of the next month if the current month has 31 days.
78
- * - second day of the next month if the current month has 30 days.
79
- * Other value will result in adding or subtracting days according to the given value.
80
- * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
81
- */
82
- setMonth(month, date) {
83
- checkNumericLike(month, `Invalid month: ${month}`);
84
- if (date || date === 0) {
85
- checkNumericLike(date, `Invalid date: ${date}`);
86
- this._oUDate.setUTCMonth(month, date);
87
- } else {
88
- this._oUDate.setUTCMonth(month);
89
- }
90
- return this;
91
- }
92
-
93
- getDate() {
94
- return this._oUDate.getUTCDate();
95
- }
96
-
97
- setDate(date) {
98
- checkNumericLike(date, `Invalid date: ${date}`);
99
- this._oUDate.setUTCDate(date);
100
- return this;
101
- }
102
-
103
- getDay() {
104
- return this._oUDate.getUTCDay();
105
- }
106
-
107
- getCalendarType() {
108
- return this._oUDate.sCalendarType;
109
- }
110
-
111
- isBefore(oCalendarDate) {
112
- checkCalendarDate(oCalendarDate);
113
- return this.valueOf() < oCalendarDate.valueOf();
114
- }
115
-
116
- isAfter(oCalendarDate) {
117
- checkCalendarDate(oCalendarDate);
118
- return this.valueOf() > oCalendarDate.valueOf();
119
- }
120
-
121
- isSameOrBefore(oCalendarDate) {
122
- checkCalendarDate(oCalendarDate);
123
- return this.valueOf() <= oCalendarDate.valueOf();
124
- }
125
-
126
- isSameOrAfter(oCalendarDate) {
127
- checkCalendarDate(oCalendarDate);
128
- return this.valueOf() >= oCalendarDate.valueOf();
129
- }
130
-
131
- isSame(oCalendarDate) {
132
- checkCalendarDate(oCalendarDate);
133
- return this.valueOf() === oCalendarDate.valueOf();
134
- }
135
-
136
- toLocalJSDate() {
137
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
138
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
139
- const oLocalDate = new Date(this._oUDate.getTime());
140
-
141
- // Make this date really local. Now getters are safe.
142
- oLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());
143
- oLocalDate.setHours(0, 0, 0, 0);
144
-
145
- return oLocalDate;
146
- }
147
-
148
- toUTCJSDate() {
149
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
150
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
151
- const oUTCDate = new Date(this._oUDate.getTime());
152
- oUTCDate.setUTCHours(0, 0, 0, 0);
153
-
154
- return oUTCDate;
155
- }
156
-
157
- toString() {
158
- return `${this._oUDate.sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;
159
- }
160
-
161
- valueOf() {
162
- return this._oUDate.getTime();
163
- }
164
-
165
- static fromLocalJSDate(oJSDate, sCalendarType) {
166
- // Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests
167
- // because Date object in the test is different than the Date object in the application (due to the iframe).
168
- // We can use jQuery.type or this method:
169
- function isValidDate(date) {
170
- return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date); // eslint-disable-line
171
- }
172
- if (!isValidDate(oJSDate)) {
173
- throw new Error(`Date parameter must be a JavaScript Date object: [${oJSDate}].`);
174
- }
175
- return new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);
176
- }
177
-
178
- static fromTimestamp(iTimestamp, sCalendarType) {
179
- const oCalDate = new CalendarDate(0, 0, 1);
180
- oCalDate._oUDate = UniversalDate.getInstance(new Date(iTimestamp), sCalendarType);
181
- return oCalDate;
182
- }
183
- }
184
-
185
- function createUniversalUTCDate(oDate, sCalendarType) {
186
- if (sCalendarType) {
187
- return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
188
- }
189
- return new UniversalDate(createUTCDate(oDate).getTime());
190
- }
191
-
192
- /**
193
- * Creates a JavaScript UTC Date corresponding to the given JavaScript Date.
194
- * @param {Date} oDate JavaScript date object. Time related information is cut.
195
- * @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
196
- */
197
- function createUTCDate(oDate) {
198
- const oUTCDate = new Date(Date.UTC(0, 0, 1));
199
-
200
- oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());
201
-
202
- return oUTCDate;
203
- }
204
-
205
- function checkCalendarDate(oCalendarDate) {
206
- if (!(oCalendarDate instanceof CalendarDate)) {
207
- throw new Error(`Invalid calendar date: [${oCalendarDate}]. Expected: sap.ui.unified.calendar.CalendarDate`);
208
- }
209
- }
210
-
211
- /**
212
- * Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not.
213
- * @param {any} value The value of any type to check. If null or undefined, this method throws an error.
214
- * @param {string} message The message to be used if an error is to be thrown
215
- * @throws will throw an error if the value is null or undefined or is not like a number
216
- */
217
- function checkNumericLike(value, message) {
218
- if (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line
219
- throw message;
220
- }
221
- }
222
-
223
- export default CalendarDate;
@@ -1,39 +0,0 @@
1
- import CalendarDate from "./CalendarDate.js";
2
-
3
- const cache = new Map();
4
-
5
- const getMinCalendarDate = primaryCalendarType => {
6
- const key = `min ${primaryCalendarType}`;
7
-
8
- if (!cache.has(key)) {
9
- const minDate = new CalendarDate(1, 0, 1, primaryCalendarType);
10
- minDate.setYear(1);
11
- minDate.setMonth(0);
12
- minDate.setDate(1);
13
- cache.set(key, minDate);
14
- }
15
-
16
- return cache.get(key);
17
- };
18
-
19
- const getMaxCalendarDate = primaryCalendarType => {
20
- const key = `max ${primaryCalendarType}`;
21
-
22
- if (!cache.has(key)) {
23
- const maxDate = new CalendarDate(1, 0, 1, primaryCalendarType);
24
- maxDate.setYear(9999);
25
- maxDate.setMonth(11);
26
- const tempDate = new CalendarDate(maxDate, primaryCalendarType);
27
- tempDate.setDate(1);
28
- tempDate.setMonth(tempDate.getMonth() + 1, 0);
29
- maxDate.setDate(tempDate.getDate());// 31st for Gregorian Calendar
30
- cache.set(key, maxDate);
31
- }
32
-
33
- return cache.get(key);
34
- };
35
-
36
- export {
37
- getMinCalendarDate,
38
- getMaxCalendarDate,
39
- };