@ui5/webcomponents-localization 0.0.0-f24ff9019 → 0.0.0-f42e7c18c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -1
- package/CHANGELOG.md +875 -0
- package/README.md +3 -6
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-fetch.d.ts +1 -0
- package/dist/Assets-fetch.js +3 -0
- package/dist/Assets-fetch.js.map +1 -0
- package/dist/CalendarUtils.d.ts +3 -0
- package/dist/CalendarUtils.js +6 -0
- package/dist/CalendarUtils.js.map +1 -0
- package/dist/DateFormat.d.ts +0 -1
- package/dist/LocaleData.d.ts +0 -1
- package/dist/dates/CalendarDate.d.ts +0 -1
- package/dist/dates/CalendarDate.js.map +1 -1
- package/dist/dates/ExtremeDates.d.ts +1 -1
- package/dist/dates/ExtremeDates.js.map +1 -1
- package/dist/dates/UI5Date.d.ts +0 -1
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -1
- package/dist/dates/getRoundedTimestamp.js.map +1 -1
- package/dist/dates/modifyDateBy.js.map +1 -1
- package/dist/dates/transformDateToSecondaryType.js.map +1 -1
- package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
- package/dist/generated/assets/cldr/ar.json +7085 -5531
- package/dist/generated/assets/cldr/ar_EG.json +7085 -5531
- package/dist/generated/assets/cldr/ar_SA.json +7084 -5530
- package/dist/generated/assets/cldr/bg.json +5979 -4452
- package/dist/generated/assets/cldr/ca.json +6081 -4440
- package/dist/generated/assets/cldr/cnr.json +6169 -0
- package/dist/generated/assets/cldr/cs.json +6707 -4960
- package/dist/generated/assets/cldr/cy.json +6930 -5211
- package/dist/generated/assets/cldr/da.json +5925 -4308
- package/dist/generated/assets/cldr/de.json +6046 -4313
- package/dist/generated/assets/cldr/de_AT.json +6047 -4314
- package/dist/generated/assets/cldr/de_CH.json +6045 -4312
- package/dist/generated/assets/cldr/el.json +5830 -4281
- package/dist/generated/assets/cldr/el_CY.json +5830 -4281
- package/dist/generated/assets/cldr/en.json +6042 -4316
- package/dist/generated/assets/cldr/en_AU.json +6082 -4319
- package/dist/generated/assets/cldr/en_GB.json +6073 -4329
- package/dist/generated/assets/cldr/en_HK.json +6082 -4337
- package/dist/generated/assets/cldr/en_IE.json +6073 -4328
- package/dist/generated/assets/cldr/en_IN.json +6078 -4333
- package/dist/generated/assets/cldr/en_NZ.json +6073 -4328
- package/dist/generated/assets/cldr/en_PG.json +6074 -4329
- package/dist/generated/assets/cldr/en_SG.json +6078 -4333
- package/dist/generated/assets/cldr/en_ZA.json +6074 -4329
- package/dist/generated/assets/cldr/es.json +6101 -4331
- package/dist/generated/assets/cldr/es_AR.json +6104 -4334
- package/dist/generated/assets/cldr/es_BO.json +6103 -4333
- package/dist/generated/assets/cldr/es_CL.json +5996 -4334
- package/dist/generated/assets/cldr/es_CO.json +5996 -4333
- package/dist/generated/assets/cldr/es_MX.json +6105 -4335
- package/dist/generated/assets/cldr/es_PE.json +5887 -4333
- package/dist/generated/assets/cldr/es_UY.json +5889 -4335
- package/dist/generated/assets/cldr/es_VE.json +5888 -4334
- package/dist/generated/assets/cldr/et.json +6025 -4340
- package/dist/generated/assets/cldr/fa.json +5948 -4367
- package/dist/generated/assets/cldr/fi.json +6193 -4463
- package/dist/generated/assets/cldr/fr.json +5995 -4357
- package/dist/generated/assets/cldr/fr_BE.json +5995 -4357
- package/dist/generated/assets/cldr/fr_CA.json +5989 -4351
- package/dist/generated/assets/cldr/fr_CH.json +6013 -4375
- package/dist/generated/assets/cldr/fr_LU.json +5995 -4357
- package/dist/generated/assets/cldr/he.json +6539 -4869
- package/dist/generated/assets/cldr/hi.json +5857 -4295
- package/dist/generated/assets/cldr/hr.json +6194 -4583
- package/dist/generated/assets/cldr/hu.json +5943 -4364
- package/dist/generated/assets/cldr/id.json +5728 -4060
- package/dist/generated/assets/cldr/it.json +5984 -4299
- package/dist/generated/assets/cldr/it_CH.json +5984 -4299
- package/dist/generated/assets/cldr/ja.json +5887 -4211
- package/dist/generated/assets/cldr/kk.json +5937 -4339
- package/dist/generated/assets/cldr/ko.json +5768 -4189
- package/dist/generated/assets/cldr/lt.json +6576 -4850
- package/dist/generated/assets/cldr/lv.json +6112 -4587
- package/dist/generated/assets/cldr/mk.json +6045 -0
- package/dist/generated/assets/cldr/ms.json +5562 -4021
- package/dist/generated/assets/cldr/nb.json +6033 -4335
- package/dist/generated/assets/cldr/nl.json +6200 -4294
- package/dist/generated/assets/cldr/nl_BE.json +6200 -4294
- package/dist/generated/assets/cldr/pl.json +6587 -4667
- package/dist/generated/assets/cldr/pt.json +6113 -4235
- package/dist/generated/assets/cldr/pt_PT.json +6178 -4372
- package/dist/generated/assets/cldr/ro.json +6198 -4563
- package/dist/generated/assets/cldr/ru.json +6501 -4909
- package/dist/generated/assets/cldr/ru_UA.json +6501 -4909
- package/dist/generated/assets/cldr/sk.json +6430 -4939
- package/dist/generated/assets/cldr/sl.json +6442 -4910
- package/dist/generated/assets/cldr/sr.json +6239 -4585
- package/dist/generated/assets/cldr/sr_Latn.json +6224 -4574
- package/dist/generated/assets/cldr/sv.json +6074 -4362
- package/dist/generated/assets/cldr/th.json +5873 -4214
- package/dist/generated/assets/cldr/tr.json +6092 -4400
- package/dist/generated/assets/cldr/uk.json +6452 -4858
- package/dist/generated/assets/cldr/vi.json +5667 -4070
- package/dist/generated/assets/cldr/zh_CN.json +5715 -4100
- package/dist/generated/assets/cldr/zh_HK.json +5724 -4108
- package/dist/generated/assets/cldr/zh_SG.json +5724 -4108
- package/dist/generated/assets/cldr/zh_TW.json +5791 -4131
- package/dist/generated/json-imports/LocaleData-fetch.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-fetch.js +93 -0
- package/dist/generated/json-imports/LocaleData-fetch.js.map +1 -0
- package/dist/generated/json-imports/LocaleData.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData.js +89 -89
- package/dist/generated/json-imports/LocaleData.js.map +1 -0
- package/dist/getCachedLocaleDataInstance.js.map +1 -1
- package/dist/locale/getLocaleData.js.map +1 -1
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +2 -239
- package/dist/sap/base/assert.js +28 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/config.js +17 -0
- package/dist/sap/base/i18n/Formatting.d.ts +8 -0
- package/dist/sap/base/i18n/Formatting.js +11 -0
- package/dist/sap/base/i18n/Formatting.js.map +1 -0
- package/dist/sap/base/i18n/LanguageTag.js +168 -30
- package/dist/sap/base/i18n/date/CalendarType.js +36 -1
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +76 -1
- package/dist/sap/base/i18n/date/TimezoneUtils.js +242 -12
- package/dist/sap/base/strings/camelize.js +30 -0
- package/dist/sap/base/strings/formatMessage.js +88 -15
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -1
- package/dist/sap/base/util/ObjectPath.d.ts +4 -0
- package/dist/sap/base/util/ObjectPath.js +4 -33
- package/dist/sap/base/util/ObjectPath.js.map +1 -0
- package/dist/sap/base/util/Version.js +157 -0
- package/dist/sap/base/util/_merge.js +83 -26
- package/dist/sap/base/util/array/uniqueSort.js +37 -15
- package/dist/sap/base/util/deepClone.js +102 -0
- package/dist/sap/base/util/deepEqual.js +75 -51
- package/dist/sap/base/util/extend.js +58 -7
- package/dist/sap/base/util/isEmptyObject.js +34 -0
- package/dist/sap/base/util/isPlainObject.js +35 -1
- package/dist/sap/base/util/now.js +24 -3
- package/dist/sap/base/util/resolveReference.js +3 -0
- package/dist/sap/base/util/uid.js +27 -0
- package/dist/sap/ui/base/DataType.js +657 -0
- package/dist/sap/ui/base/Interface.js +47 -1
- package/dist/sap/ui/base/Metadata.js +433 -180
- package/dist/sap/ui/base/Object.js +284 -48
- package/dist/sap/ui/core/CalendarType.js +23 -1
- package/dist/sap/ui/core/Configuration.d.ts +1 -2
- package/dist/sap/ui/core/Core.d.ts +2 -4
- package/dist/sap/ui/core/FormatSettings.d.ts +1 -2
- package/dist/sap/ui/core/FormatSettings.js +0 -2
- package/dist/sap/ui/core/FormatSettings.js.map +1 -1
- package/dist/sap/ui/core/Locale.js +189 -57
- package/dist/sap/ui/core/LocaleData.js +2670 -1380
- package/dist/sap/ui/core/Supportability.js +5 -0
- package/dist/sap/ui/core/Theming.js +539 -0
- package/dist/sap/ui/core/date/Buddhist.js +162 -87
- package/dist/sap/ui/core/date/CalendarUtils.js +61 -21
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +29 -1
- package/dist/sap/ui/core/date/Gregorian.js +25 -10
- package/dist/sap/ui/core/date/Islamic.js +298 -185
- package/dist/sap/ui/core/date/Japanese.js +210 -115
- package/dist/sap/ui/core/date/Persian.js +324 -195
- package/dist/sap/ui/core/date/UI5Date.js +923 -237
- package/dist/sap/ui/core/date/UniversalDate.js +1238 -245
- package/dist/sap/ui/core/date/_Calendars.js +10 -1
- package/dist/sap/ui/core/format/DateFormat.js +3163 -2145
- package/dist/sap/ui/core/format/TimezoneUtil.js +23 -1
- package/package-scripts.cjs +12 -21
- package/package.json +12 -6
- package/tsconfig.json +20 -10
- package/used-modules.txt +19 -1
- package/dist/Assets-static.d.ts +0 -1
- package/dist/Assets-static.js +0 -3
- package/dist/Assets-static.js.map +0 -1
- package/dist/dates/calculateWeekNumber.d.ts +0 -5
- package/dist/dates/calculateWeekNumber.js +0 -45
- package/dist/dates/calculateWeekNumber.js.map +0 -1
- package/dist/generated/json-imports/LocaleData-static.js +0 -90
- package/dist/sap/ui/Device.js +0 -5
@@ -1,2 +1,24 @@
|
|
1
|
-
|
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
|
+
*/
|
2
24
|
export default TimezoneUtils;
|
package/package-scripts.cjs
CHANGED
@@ -1,35 +1,26 @@
|
|
1
1
|
const resolve = require("resolve");
|
2
|
+
|
2
3
|
const copyUsedModules = resolve.sync("@ui5/webcomponents-tools/lib/copy-list/index.js");
|
3
|
-
const
|
4
|
-
const
|
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");
|
5
6
|
|
6
7
|
const scripts = {
|
7
|
-
clean: "rimraf dist",
|
8
|
+
clean: "rimraf src/generated && rimraf dist",
|
8
9
|
lint: "eslint .",
|
10
|
+
generate: "nps clean copy.used-modules copy.cldr copy.overlay build.amd-to-es6 build.jsonImports",
|
9
11
|
build: {
|
10
|
-
"default": "nps
|
11
|
-
"
|
12
|
-
"
|
13
|
-
|
14
|
-
|
15
|
-
"replace-global-core-usage": `node "${replaceGlobalCore}" dist/`,
|
16
|
-
"esm-abs-to-rel": `node "${esmAbsToRel}" dist/`,
|
17
|
-
typescript: "tsc",
|
18
|
-
jsonImports: "node ./lib/generate-json-imports/cldr.js"
|
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",
|
19
17
|
},
|
20
|
-
typescript: "tsc",
|
18
|
+
typescript: "tsc --build",
|
21
19
|
copy: {
|
22
20
|
"used-modules": `node "${copyUsedModules}" ./used-modules.txt dist/`,
|
23
|
-
cldr: `
|
21
|
+
cldr: `copy-and-watch "../../node_modules/@openui5/sap.ui.core/src/sap/ui/core/cldr/*" dist/generated/assets/cldr/`,
|
24
22
|
overlay: `copy-and-watch "overlay/**/*.js" dist/`,
|
25
|
-
src: `copy-and-watch "src/**/*.js" dist/`,
|
26
|
-
},
|
27
|
-
watch: {
|
28
|
-
default: 'concurrently "nps watch.src" "nps watch.typescript" ',
|
29
|
-
typescript: "tsc --watch",
|
30
|
-
src: `nps "copy.src --watch --skip-initial-copy"`,
|
31
23
|
},
|
32
|
-
start: "nps watch",
|
33
24
|
};
|
34
25
|
|
35
26
|
module.exports = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-localization",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-f42e7c18c",
|
4
4
|
"description": "Localization for UI5 Web Components",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -25,17 +25,23 @@
|
|
25
25
|
"lint": "nps lint",
|
26
26
|
"start": "nps start",
|
27
27
|
"build": "nps build",
|
28
|
-
"
|
28
|
+
"generate": "nps generate",
|
29
|
+
"prepublishOnly": "tsc -b"
|
29
30
|
},
|
30
31
|
"devDependencies": {
|
31
|
-
"@
|
32
|
-
"@
|
33
|
-
"
|
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-f42e7c18c",
|
37
|
+
"babel-plugin-amd-to-esm": "^2.0.3",
|
38
|
+
"chromedriver": "^131.0.0",
|
39
|
+
"estree-walk": "^2.2.0",
|
34
40
|
"mkdirp": "^1.0.4",
|
35
41
|
"resolve": "^1.20.0"
|
36
42
|
},
|
37
43
|
"dependencies": {
|
38
44
|
"@types/openui5": "^1.113.0",
|
39
|
-
"@ui5/webcomponents-base": "0.0.0-
|
45
|
+
"@ui5/webcomponents-base": "0.0.0-f42e7c18c"
|
40
46
|
}
|
41
47
|
}
|
package/tsconfig.json
CHANGED
@@ -1,14 +1,24 @@
|
|
1
1
|
{
|
2
|
-
"
|
2
|
+
"extends": "@ui5/webcomponents-tools/tsconfig.json",
|
3
|
+
"include": [
|
4
|
+
"src/**/*"
|
5
|
+
],
|
3
6
|
"compilerOptions": {
|
4
|
-
"target": "ES2021",
|
5
|
-
// Generate d.ts files
|
6
|
-
"declaration": true,
|
7
7
|
"outDir": "dist",
|
8
|
-
"
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
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
|
+
},
|
13
18
|
},
|
14
|
-
|
19
|
+
"references": [
|
20
|
+
{
|
21
|
+
"path": "../base"
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
package/used-modules.txt
CHANGED
@@ -1,25 +1,43 @@
|
|
1
1
|
# Needed files from OpenUI5 - the commented ones are currently overlaid, therefore should not be copied
|
2
2
|
|
3
|
-
|
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
|
5
11
|
sap/base/i18n/LanguageTag.js
|
6
12
|
sap/base/i18n/date/CalendarWeekNumbering.js
|
7
13
|
sap/base/i18n/date/TimezoneUtils.js
|
8
14
|
sap/base/i18n/date/CalendarType.js
|
15
|
+
sap/base/i18n/Localization.js
|
9
16
|
sap/base/strings/formatMessage.js
|
17
|
+
sap/base/strings/camelize.js
|
10
18
|
sap/base/util/ObjectPath.js
|
19
|
+
sap/base/util/resolveReference.js
|
11
20
|
sap/base/util/array/uniqueSort.js
|
12
21
|
sap/base/util/deepEqual.js
|
13
22
|
sap/base/util/isPlainObject.js
|
23
|
+
sap/base/util/isEmptyObject.js
|
14
24
|
sap/base/util/now.js
|
25
|
+
sap/base/util/uid.js
|
15
26
|
sap/base/util/_merge.js
|
16
27
|
sap/base/util/extend.js
|
28
|
+
sap/base/util/deepClone.js
|
29
|
+
sap/base/util/Version.js
|
17
30
|
sap/ui/base/Interface.js
|
18
31
|
sap/ui/base/Metadata.js
|
19
32
|
sap/ui/base/Object.js
|
20
33
|
sap/ui/core/CalendarType.js
|
34
|
+
sap/ui/core/Configuration.js
|
35
|
+
sap/ui/core/Supportability.js
|
21
36
|
sap/ui/core/Locale.js
|
22
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
|
23
41
|
sap/ui/core/date/Buddhist.js
|
24
42
|
sap/ui/core/date/CalendarUtils.js
|
25
43
|
sap/ui/core/date/CalendarWeekNumbering.js
|
package/dist/Assets-static.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
import "./generated/json-imports/LocaleData-static.js";
|
package/dist/Assets-static.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Assets-static.js","sourceRoot":"","sources":["../src/Assets-static.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,+CAA+C,CAAC","sourcesContent":["// Currently the base package provides CLDR assets only\nimport \"./generated/json-imports/LocaleData-static.js\";\n"]}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type Locale from "@ui5/webcomponents-base/dist/locale/Locale.js";
|
2
|
-
import type LocaleData from "../LocaleData.js";
|
3
|
-
import type UI5Date from "./UI5Date.js";
|
4
|
-
declare const calculateWeekNumber: (confFirstDayOfWeek: number | undefined, oDate: Date | UI5Date, iYear: number, oLocale: Locale, oLocaleData: LocaleData) => number;
|
5
|
-
export default calculateWeekNumber;
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import UniversalDate from "./UniversalDate.js";
|
2
|
-
const calculateWeekNumber = (confFirstDayOfWeek, oDate, iYear, oLocale, oLocaleData) => {
|
3
|
-
let iWeekNum = 0;
|
4
|
-
let iWeekDay = 0;
|
5
|
-
const iFirstDayOfWeek = Number.isInteger(confFirstDayOfWeek) ? confFirstDayOfWeek : oLocaleData.getFirstDayOfWeek();
|
6
|
-
// search Locale for containing "en-US", since sometimes
|
7
|
-
// when any user settings have been defined, subtag "sapufmt" is added to the locale name
|
8
|
-
// this is described inside sap.ui.core.Configuration file
|
9
|
-
if (oLocale && (oLocale.getLanguage() === "en" && oLocale.getRegion() === "US")) {
|
10
|
-
/*
|
11
|
-
* in US the week starts with Sunday
|
12
|
-
* The first week of the year starts with January 1st. But Dec. 31 is still in the last year
|
13
|
-
* So the week beginning in December and ending in January has 2 week numbers
|
14
|
-
*/
|
15
|
-
const oJanFirst = new UniversalDate(oDate.getTime());
|
16
|
-
oJanFirst.setUTCFullYear(iYear, 0, 1);
|
17
|
-
iWeekDay = oJanFirst.getUTCDay();
|
18
|
-
// get the date for the same weekday like jan 1.
|
19
|
-
const oCheckDate = new UniversalDate(oDate.getTime());
|
20
|
-
oCheckDate.setUTCDate(oCheckDate.getUTCDate() - oCheckDate.getUTCDay() + iWeekDay);
|
21
|
-
iWeekNum = Math.round((oCheckDate.getTime() - oJanFirst.getTime()) / 86400000 / 7) + 1;
|
22
|
-
}
|
23
|
-
else {
|
24
|
-
// normally the first week of the year is the one where the first Thursday of the year is
|
25
|
-
// find Thursday of this week
|
26
|
-
// if the checked day is before the 1. day of the week use a day of the previous week to check
|
27
|
-
const oThursday = new UniversalDate(oDate.getTime());
|
28
|
-
oThursday.setUTCDate(oThursday.getUTCDate() - iFirstDayOfWeek);
|
29
|
-
iWeekDay = oThursday.getUTCDay();
|
30
|
-
oThursday.setUTCDate(oThursday.getUTCDate() - iWeekDay + 4);
|
31
|
-
const oFirstDayOfYear = new UniversalDate(oThursday.getTime());
|
32
|
-
oFirstDayOfYear.setUTCMonth(0, 1);
|
33
|
-
iWeekDay = oFirstDayOfYear.getUTCDay();
|
34
|
-
let iAddDays = 0;
|
35
|
-
if (iWeekDay > 4) {
|
36
|
-
iAddDays = 7; // first day of year is after Thursday, so first Thursday is in the next week
|
37
|
-
}
|
38
|
-
const oFirstThursday = new UniversalDate(oFirstDayOfYear.getTime());
|
39
|
-
oFirstThursday.setUTCDate(1 - iWeekDay + 4 + iAddDays);
|
40
|
-
iWeekNum = Math.round((oThursday.getTime() - oFirstThursday.getTime()) / 86400000 / 7) + 1;
|
41
|
-
}
|
42
|
-
return iWeekNum;
|
43
|
-
};
|
44
|
-
export default calculateWeekNumber;
|
45
|
-
//# sourceMappingURL=calculateWeekNumber.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"calculateWeekNumber.js","sourceRoot":"","sources":["../../src/dates/calculateWeekNumber.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAI/C,MAAM,mBAAmB,GAAG,CAAC,kBAAsC,EAAE,KAAqB,EAAE,KAAa,EAAE,OAAe,EAAE,WAAuB,EAAE,EAAE;IACtJ,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC;IAErH,wDAAwD;IACxD,yFAAyF;IACzF,0DAA0D;IAC1D,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,KAAK,IAAI,CAAC,EAAE;QAChF;;;;cAIG;QACH,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACtC,QAAQ,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;QAEjC,gDAAgD;QAChD,MAAM,UAAU,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACtD,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC,SAAS,EAAE,GAAG,QAAQ,CAAC,CAAC;QAEnF,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;KACvF;SAAM;QACN,yFAAyF;QACzF,6BAA6B;QAC7B,8FAA8F;QAC9F,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,eAAe,CAAC,CAAC;QAC/D,QAAQ,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;QACjC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC;QAE5D,MAAM,eAAe,GAAG,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,QAAQ,GAAG,eAAe,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,QAAQ,GAAG,CAAC,EAAE;YACjB,QAAQ,GAAG,CAAC,CAAC,CAAC,6EAA6E;SAC3F;QACD,MAAM,cAAc,GAAG,IAAI,aAAa,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpE,cAAc,CAAC,UAAU,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;QAEvD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;KAC3F;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import type Locale from \"@ui5/webcomponents-base/dist/locale/Locale.js\";\nimport UniversalDate from \"./UniversalDate.js\";\nimport type LocaleData from \"../LocaleData.js\";\nimport type UI5Date from \"./UI5Date.js\";\n\nconst calculateWeekNumber = (confFirstDayOfWeek: number | undefined, oDate: Date | UI5Date, iYear: number, oLocale: Locale, oLocaleData: LocaleData) => {\n\tlet iWeekNum = 0;\n\tlet iWeekDay = 0;\n\tconst iFirstDayOfWeek = Number.isInteger(confFirstDayOfWeek) ? confFirstDayOfWeek! : oLocaleData.getFirstDayOfWeek();\n\n\t// search Locale for containing \"en-US\", since sometimes\n\t// when any user settings have been defined, subtag \"sapufmt\" is added to the locale name\n\t// this is described inside sap.ui.core.Configuration file\n\tif (oLocale && (oLocale.getLanguage() === \"en\" && oLocale.getRegion() === \"US\")) {\n\t\t/*\n\t\t\t* in US the week starts with Sunday\n\t\t\t* The first week of the year starts with January 1st. But Dec. 31 is still in the last year\n\t\t\t* So the week beginning in December and ending in January has 2 week numbers\n\t\t\t*/\n\t\tconst oJanFirst = new UniversalDate(oDate.getTime());\n\t\toJanFirst.setUTCFullYear(iYear, 0, 1);\n\t\tiWeekDay = oJanFirst.getUTCDay();\n\n\t\t// get the date for the same weekday like jan 1.\n\t\tconst oCheckDate = new UniversalDate(oDate.getTime());\n\t\toCheckDate.setUTCDate(oCheckDate.getUTCDate() - oCheckDate.getUTCDay() + iWeekDay);\n\n\t\tiWeekNum = Math.round((oCheckDate.getTime() - oJanFirst.getTime()) / 86400000 / 7) + 1;\n\t} else {\n\t\t// normally the first week of the year is the one where the first Thursday of the year is\n\t\t// find Thursday of this week\n\t\t// if the checked day is before the 1. day of the week use a day of the previous week to check\n\t\tconst oThursday = new UniversalDate(oDate.getTime());\n\t\toThursday.setUTCDate(oThursday.getUTCDate() - iFirstDayOfWeek);\n\t\tiWeekDay = oThursday.getUTCDay();\n\t\toThursday.setUTCDate(oThursday.getUTCDate() - iWeekDay + 4);\n\n\t\tconst oFirstDayOfYear = new UniversalDate(oThursday.getTime());\n\t\toFirstDayOfYear.setUTCMonth(0, 1);\n\t\tiWeekDay = oFirstDayOfYear.getUTCDay();\n\t\tlet iAddDays = 0;\n\t\tif (iWeekDay > 4) {\n\t\t\tiAddDays = 7; // first day of year is after Thursday, so first Thursday is in the next week\n\t\t}\n\t\tconst oFirstThursday = new UniversalDate(oFirstDayOfYear.getTime());\n\t\toFirstThursday.setUTCDate(1 - iWeekDay + 4 + iAddDays);\n\n\t\tiWeekNum = Math.round((oThursday.getTime() - oFirstThursday.getTime()) / 86400000 / 7) + 1;\n\t}\n\n\treturn iWeekNum;\n};\n\nexport default calculateWeekNumber;\n"]}
|
@@ -1,90 +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 sr_Latn from "../assets/cldr/sr_Latn.json";
|
68
|
-
import sv from "../assets/cldr/sv.json";
|
69
|
-
import th from "../assets/cldr/th.json";
|
70
|
-
import tr from "../assets/cldr/tr.json";
|
71
|
-
import uk from "../assets/cldr/uk.json";
|
72
|
-
import vi from "../assets/cldr/vi.json";
|
73
|
-
import zh_CN from "../assets/cldr/zh_CN.json";
|
74
|
-
import zh_HK from "../assets/cldr/zh_HK.json";
|
75
|
-
import zh_SG from "../assets/cldr/zh_SG.json";
|
76
|
-
import zh_TW from "../assets/cldr/zh_TW.json";
|
77
|
-
|
78
|
-
const cldrData = {
|
79
|
-
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,sr_Latn,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW
|
80
|
-
};
|
81
|
-
|
82
|
-
const fetchCldrJson = async (localeId) => {
|
83
|
-
if (typeof cldrData[localeId] === "object") {
|
84
|
-
// inlined from build
|
85
|
-
throw new Error("[LocaleData] Inlined JSON not supported with static imports of assets. Use dynamic imports of assets or configure JSON imports as URLs")
|
86
|
-
}
|
87
|
-
return (await fetch(cldrData[localeId])).json();
|
88
|
-
}
|
89
|
-
|
90
|
-
Object.keys(cldrData).forEach(localeId => registerLocaleDataLoader(localeId, fetchCldrJson));
|