@ui5/webcomponents-localization 0.0.0-3790e6927 → 0.0.0-3e3654870
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/CHANGELOG.md +194 -0
- package/README.md +1 -0
- package/dist/dates/modifyDateBy.d.ts +2 -1
- package/dist/dates/modifyDateBy.js +34 -19
- package/dist/dates/modifyDateBy.js.map +1 -1
- package/dist/sap/base/i18n/LanguageTag.js +35 -0
- package/dist/sap/base/i18n/Localization.d.ts +4 -0
- package/dist/sap/base/i18n/Localization.js +12 -0
- package/dist/sap/base/i18n/Localization.js.map +1 -0
- package/dist/sap/base/i18n/date/CalendarType.js +8 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +30 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +89 -0
- package/dist/sap/ui/base/Metadata.js +20 -9
- package/dist/sap/ui/core/CalendarType.js +2 -8
- package/dist/sap/ui/core/Configuration.d.ts +1 -0
- package/dist/sap/ui/core/Configuration.js +2 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -1
- package/dist/sap/ui/core/Core.d.ts +1 -0
- package/dist/sap/ui/core/Locale.js +28 -125
- package/dist/sap/ui/core/LocaleData.js +36 -18
- package/dist/sap/ui/core/date/CalendarUtils.js +7 -18
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +2 -7
- package/dist/sap/ui/core/date/UniversalDate.js +5 -16
- package/dist/sap/ui/core/format/DateFormat.js +79 -37
- package/dist/sap/ui/core/format/TimezoneUtil.js +2 -89
- package/package.json +5 -5
- package/used-modules.txt +4 -0
@@ -1,89 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var aSupportedTimezoneIDs;
|
4
|
-
var oIntlDateTimeFormatCache = {
|
5
|
-
_oCache: new Map(),
|
6
|
-
_iCacheLimit: 10,
|
7
|
-
get: function (sTimezone) {
|
8
|
-
var cacheEntry = this._oCache.get(sTimezone);
|
9
|
-
if (cacheEntry) {
|
10
|
-
return cacheEntry;
|
11
|
-
}
|
12
|
-
var oOptions = {
|
13
|
-
hourCycle: "h23",
|
14
|
-
hour: "2-digit",
|
15
|
-
minute: "2-digit",
|
16
|
-
second: "2-digit",
|
17
|
-
fractionalSecondDigits: 3,
|
18
|
-
day: "2-digit",
|
19
|
-
month: "2-digit",
|
20
|
-
year: "numeric",
|
21
|
-
timeZone: sTimezone,
|
22
|
-
timeZoneName: "short",
|
23
|
-
era: "narrow",
|
24
|
-
weekday: "short"
|
25
|
-
};
|
26
|
-
var oInstance = new Intl.DateTimeFormat("en-US", oOptions);
|
27
|
-
if (this._oCache.size === this._iCacheLimit) {
|
28
|
-
this._oCache = new Map();
|
29
|
-
}
|
30
|
-
this._oCache.set(sTimezone, oInstance);
|
31
|
-
return oInstance;
|
32
|
-
}
|
33
|
-
};
|
34
|
-
TimezoneUtil.isValidTimezone = function (sTimezone) {
|
35
|
-
if (!sTimezone) {
|
36
|
-
return false;
|
37
|
-
}
|
38
|
-
if (Intl.supportedValuesOf) {
|
39
|
-
try {
|
40
|
-
aSupportedTimezoneIDs = aSupportedTimezoneIDs || Intl.supportedValuesOf("timeZone");
|
41
|
-
if (aSupportedTimezoneIDs.includes(sTimezone)) {
|
42
|
-
return true;
|
43
|
-
}
|
44
|
-
} catch (oError) {
|
45
|
-
aSupportedTimezoneIDs = [];
|
46
|
-
}
|
47
|
-
}
|
48
|
-
try {
|
49
|
-
oIntlDateTimeFormatCache.get(sTimezone);
|
50
|
-
return true;
|
51
|
-
} catch (oError) {
|
52
|
-
return false;
|
53
|
-
}
|
54
|
-
};
|
55
|
-
TimezoneUtil.convertToTimezone = function (oDate, sTargetTimezone) {
|
56
|
-
var oFormatParts = this._getParts(oDate, sTargetTimezone);
|
57
|
-
return TimezoneUtil._getDateFromParts(oFormatParts);
|
58
|
-
};
|
59
|
-
TimezoneUtil._getParts = function (oDate, sTargetTimezone) {
|
60
|
-
var sKey, oPart, oDateParts = Object.create(null), oIntlDate = oIntlDateTimeFormatCache.get(sTargetTimezone), oParts = oIntlDate.formatToParts(new Date(oDate.getTime()));
|
61
|
-
for (sKey in oParts) {
|
62
|
-
oPart = oParts[sKey];
|
63
|
-
if (oPart.type !== "literal") {
|
64
|
-
oDateParts[oPart.type] = oPart.value;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return oDateParts;
|
68
|
-
};
|
69
|
-
TimezoneUtil._getDateFromParts = function (oParts) {
|
70
|
-
var oDate = new Date(0), iUTCYear = parseInt(oParts.year);
|
71
|
-
if (oParts.era === "B") {
|
72
|
-
iUTCYear = iUTCYear * -1 + 1;
|
73
|
-
}
|
74
|
-
oDate.setUTCFullYear(iUTCYear, parseInt(oParts.month) - 1, parseInt(oParts.day));
|
75
|
-
oDate.setUTCHours(parseInt(oParts.hour), parseInt(oParts.minute), parseInt(oParts.second), parseInt(oParts.fractionalSecond || 0));
|
76
|
-
return oDate;
|
77
|
-
};
|
78
|
-
TimezoneUtil.calculateOffset = function (oDate, sTimezoneSource) {
|
79
|
-
var oFirstGuess = this.convertToTimezone(oDate, sTimezoneSource), iInitialOffset = oDate.getTime() - oFirstGuess.getTime(), oDateSource = new Date(oDate.getTime() + iInitialOffset), oDateTarget = this.convertToTimezone(oDateSource, sTimezoneSource);
|
80
|
-
return (oDateSource.getTime() - oDateTarget.getTime()) / 1000;
|
81
|
-
};
|
82
|
-
TimezoneUtil.getLocalTimezone = function () {
|
83
|
-
if (sLocalTimezone) {
|
84
|
-
return sLocalTimezone;
|
85
|
-
}
|
86
|
-
sLocalTimezone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
87
|
-
return sLocalTimezone;
|
88
|
-
};
|
89
|
-
export default TimezoneUtil;
|
1
|
+
import TimezoneUtils from '../../../base/i18n/date/TimezoneUtils.js';
|
2
|
+
export default TimezoneUtils;
|
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-3e3654870",
|
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
|
"prepublishOnly": "npm run clean && npm run build"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
|
-
"@openui5/sap.ui.core": "1.
|
32
|
-
"@ui5/webcomponents-tools": "0.0.0-
|
33
|
-
"chromedriver": "
|
31
|
+
"@openui5/sap.ui.core": "1.116.0",
|
32
|
+
"@ui5/webcomponents-tools": "0.0.0-3e3654870",
|
33
|
+
"chromedriver": "117.0.3",
|
34
34
|
"mkdirp": "^1.0.4",
|
35
35
|
"resolve": "^1.20.0"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
38
|
"@types/openui5": "^1.113.0",
|
39
|
-
"@ui5/webcomponents-base": "0.0.0-
|
39
|
+
"@ui5/webcomponents-base": "0.0.0-3e3654870"
|
40
40
|
}
|
41
41
|
}
|
package/used-modules.txt
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
sap/base/Log.js
|
4
4
|
sap/base/assert.js
|
5
|
+
sap/base/i18n/LanguageTag.js
|
6
|
+
sap/base/i18n/date/CalendarWeekNumbering.js
|
7
|
+
sap/base/i18n/date/TimezoneUtils.js
|
8
|
+
sap/base/i18n/date/CalendarType.js
|
5
9
|
sap/base/strings/formatMessage.js
|
6
10
|
sap/base/util/ObjectPath.js
|
7
11
|
sap/base/util/array/uniqueSort.js
|