@ui5/webcomponents-localization 2.20.1 → 2.20.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.
- package/CHANGELOG.md +8 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +36 -24
- package/dist/generated/assets/cldr/ar.json +624 -354
- package/dist/generated/assets/cldr/ar_EG.json +624 -354
- package/dist/generated/assets/cldr/ar_SA.json +625 -355
- package/dist/generated/assets/cldr/bg.json +339 -215
- package/dist/generated/assets/cldr/ca.json +633 -509
- package/dist/generated/assets/cldr/cnr.json +960 -653
- package/dist/generated/assets/cldr/cs.json +343 -531
- package/dist/generated/assets/cldr/cy.json +684 -1050
- package/dist/generated/assets/cldr/da.json +354 -231
- package/dist/generated/assets/cldr/de.json +458 -330
- package/dist/generated/assets/cldr/de_AT.json +459 -331
- package/dist/generated/assets/cldr/de_CH.json +522 -386
- package/dist/generated/assets/cldr/el.json +317 -152
- package/dist/generated/assets/cldr/el_CY.json +317 -152
- package/dist/generated/assets/cldr/en.json +606 -253
- package/dist/generated/assets/cldr/en_AU.json +830 -376
- package/dist/generated/assets/cldr/en_GB.json +696 -251
- package/dist/generated/assets/cldr/en_HK.json +544 -203
- package/dist/generated/assets/cldr/en_IE.json +533 -192
- package/dist/generated/assets/cldr/en_IN.json +820 -296
- package/dist/generated/assets/cldr/en_NZ.json +534 -193
- package/dist/generated/assets/cldr/en_PG.json +509 -168
- package/dist/generated/assets/cldr/en_SG.json +526 -185
- package/dist/generated/assets/cldr/en_ZA.json +529 -186
- package/dist/generated/assets/cldr/es.json +355 -230
- package/dist/generated/assets/cldr/es_AR.json +444 -288
- package/dist/generated/assets/cldr/es_BO.json +419 -264
- package/dist/generated/assets/cldr/es_CL.json +455 -300
- package/dist/generated/assets/cldr/es_CO.json +412 -257
- package/dist/generated/assets/cldr/es_MX.json +515 -352
- package/dist/generated/assets/cldr/es_PE.json +397 -234
- package/dist/generated/assets/cldr/es_UY.json +424 -269
- package/dist/generated/assets/cldr/es_VE.json +398 -243
- package/dist/generated/assets/cldr/et.json +390 -233
- package/dist/generated/assets/cldr/fa.json +510 -271
- package/dist/generated/assets/cldr/fi.json +497 -251
- package/dist/generated/assets/cldr/fr.json +339 -106
- package/dist/generated/assets/cldr/fr_BE.json +341 -108
- package/dist/generated/assets/cldr/fr_CA.json +652 -397
- package/dist/generated/assets/cldr/fr_CH.json +342 -109
- package/dist/generated/assets/cldr/fr_LU.json +339 -106
- package/dist/generated/assets/cldr/he.json +726 -904
- package/dist/generated/assets/cldr/hi.json +529 -288
- package/dist/generated/assets/cldr/hr.json +392 -383
- package/dist/generated/assets/cldr/hu.json +459 -335
- package/dist/generated/assets/cldr/id.json +379 -128
- package/dist/generated/assets/cldr/it.json +420 -301
- package/dist/generated/assets/cldr/it_CH.json +426 -307
- package/dist/generated/assets/cldr/ja.json +332 -74
- package/dist/generated/assets/cldr/kk.json +540 -240
- package/dist/generated/assets/cldr/ko.json +371 -115
- package/dist/generated/assets/cldr/lt.json +428 -545
- package/dist/generated/assets/cldr/lv.json +415 -413
- package/dist/generated/assets/cldr/mk.json +691 -559
- package/dist/generated/assets/cldr/ms.json +395 -136
- package/dist/generated/assets/cldr/nb.json +355 -234
- package/dist/generated/assets/cldr/nl.json +357 -251
- package/dist/generated/assets/cldr/nl_BE.json +428 -322
- package/dist/generated/assets/cldr/pl.json +333 -459
- package/dist/generated/assets/cldr/pt.json +419 -298
- package/dist/generated/assets/cldr/pt_PT.json +362 -231
- package/dist/generated/assets/cldr/ro.json +369 -397
- package/dist/generated/assets/cldr/ru.json +599 -368
- package/dist/generated/assets/cldr/ru_UA.json +598 -367
- package/dist/generated/assets/cldr/sk.json +343 -517
- package/dist/generated/assets/cldr/sl.json +477 -640
- package/dist/generated/assets/cldr/sr.json +478 -531
- package/dist/generated/assets/cldr/sr_Latn.json +631 -684
- package/dist/generated/assets/cldr/sv.json +395 -258
- package/dist/generated/assets/cldr/th.json +452 -199
- package/dist/generated/assets/cldr/tr.json +391 -238
- package/dist/generated/assets/cldr/uk.json +696 -342
- package/dist/generated/assets/cldr/vi.json +836 -487
- package/dist/generated/assets/cldr/zh_CN.json +358 -104
- package/dist/generated/assets/cldr/zh_HK.json +366 -113
- package/dist/generated/assets/cldr/zh_SG.json +371 -118
- package/dist/generated/assets/cldr/zh_TW.json +480 -238
- package/dist/sap/base/Event.js +2 -2
- package/dist/sap/base/Eventing.js +4 -3
- package/dist/sap/base/assert.js +1 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +1 -1
- package/dist/sap/base/future.js +12 -0
- package/dist/sap/base/i18n/Formatting.d.ts +5 -0
- package/dist/sap/base/i18n/Formatting.js +7 -0
- package/dist/sap/base/i18n/Formatting.js.map +1 -1
- package/dist/sap/base/i18n/LanguageTag.js +18 -12
- package/dist/sap/base/i18n/Localization.d.ts +3 -0
- package/dist/sap/base/i18n/Localization.js +5 -0
- package/dist/sap/base/i18n/Localization.js.map +1 -1
- package/dist/sap/base/i18n/ResourceBundle.js +20 -0
- package/dist/sap/base/i18n/date/CalendarType.js +9 -8
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +9 -8
- package/dist/sap/base/i18n/date/TimezoneUtils.js +170 -18
- package/dist/sap/base/i18n/date/_EnumHelper.js +37 -0
- package/dist/sap/base/strings/camelize.js +1 -1
- package/dist/sap/base/strings/formatMessage.js +6 -1
- package/dist/sap/base/util/Properties.js +12 -0
- package/dist/sap/base/util/Version.js +19 -13
- package/dist/sap/base/util/_merge.js +1 -1
- package/dist/sap/base/util/array/uniqueSort.js +1 -1
- package/dist/sap/base/util/deepClone.js +2 -2
- package/dist/sap/base/util/deepEqual.js +1 -1
- package/dist/sap/base/util/deepExtend.js +60 -0
- package/dist/sap/base/util/extend.js +1 -1
- package/dist/sap/base/util/fetch.js +8 -0
- package/dist/sap/base/util/isEmptyObject.js +1 -1
- package/dist/sap/base/util/isPlainObject.js +1 -1
- package/dist/sap/base/util/merge.js +57 -0
- package/dist/sap/base/util/mixedFetch.js +3 -0
- package/dist/sap/base/util/now.js +7 -13
- package/dist/sap/base/util/uid.js +1 -1
- package/dist/sap/ui/Device.js +27 -0
- package/dist/sap/ui/Global.js +1 -0
- package/dist/sap/ui/VersionInfo.js +14 -0
- package/dist/sap/ui/base/DataType.js +63 -12
- package/dist/sap/ui/base/DesignTime.js +11 -0
- package/dist/sap/ui/base/EventProvider.js +21 -0
- package/dist/sap/ui/base/Metadata.js +45 -10
- package/dist/sap/ui/base/Object.js +2 -2
- package/dist/sap/ui/base/OwnStatics.js +6 -0
- package/dist/sap/ui/base/SyncPromise.js +98 -0
- package/dist/sap/ui/core/AnimationMode.js +42 -0
- package/dist/sap/ui/core/CalendarType.js +2 -2
- package/dist/sap/ui/core/ControlBehavior.js +11 -0
- package/dist/sap/ui/core/Lib.js +41 -0
- package/dist/sap/ui/core/Locale.js +9 -9
- package/dist/sap/ui/core/LocaleData.js +498 -333
- package/dist/sap/ui/core/Theming.js +25 -525
- package/dist/sap/ui/core/_UrlResolver.js +11 -0
- package/dist/sap/ui/core/date/Buddhist.js +2 -2
- package/dist/sap/ui/core/date/CalendarUtils.js +14 -12
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +2 -2
- package/dist/sap/ui/core/date/Gregorian.js +2 -2
- package/dist/sap/ui/core/date/Islamic.js +2 -2
- package/dist/sap/ui/core/date/Japanese.js +2 -2
- package/dist/sap/ui/core/date/Persian.js +2 -2
- package/dist/sap/ui/core/date/UI5Date.js +80 -32
- package/dist/sap/ui/core/date/UniversalDate.js +83 -101
- package/dist/sap/ui/core/format/DateFormat.js +70 -73
- package/dist/sap/ui/core/format/FormatUtils.js +30 -0
- package/dist/sap/ui/core/format/NumberFormat.js +917 -588
- package/dist/sap/ui/core/format/TimezoneUtil.js +80 -11
- package/dist/sap/ui/core/getCompatibilityVersion.js +7 -0
- package/dist/sap/ui/core/theming/ThemeHelper.js +14 -0
- package/dist/sap/ui/security/Security.js +12 -0
- package/dist/sap/ui/util/XMLHelper.js +11 -0
- package/dist/sap/ui/util/_URL.js +1 -0
- package/dist/ui5loader-autoconfig.js +1 -0
- package/package.json +5 -5
- package/used-modules.txt +5 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
// Provides class sap.ui.core.date.Islamic
|
|
7
7
|
import UniversalDate from "./UniversalDate.js";
|
|
8
|
-
import CalendarType from "../CalendarType.js";
|
|
9
8
|
import Log from "../../../base/Log.js";
|
|
10
9
|
import Formatting from "../../../base/i18n/Formatting.js";
|
|
10
|
+
import CalendarType from "../../../base/i18n/date/CalendarType.js";
|
|
11
11
|
import _Calendars from "./_Calendars.js";
|
|
12
12
|
/**
|
|
13
13
|
* The Islamic date class
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
// Provides class sap.ui.core.date.Japanese
|
|
7
7
|
import UniversalDate from "./UniversalDate.js";
|
|
8
|
-
import CalendarType from "../CalendarType.js";
|
|
9
8
|
import _Calendars from "./_Calendars.js";
|
|
9
|
+
import CalendarType from "../../../base/i18n/date/CalendarType.js";
|
|
10
10
|
/**
|
|
11
11
|
* The Japanese date class
|
|
12
12
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
// Provides class sap.ui.core.date.Persian
|
|
7
7
|
import UniversalDate from "./UniversalDate.js";
|
|
8
|
-
import CalendarType from "../CalendarType.js";
|
|
9
8
|
import _Calendars from "./_Calendars.js";
|
|
9
|
+
import CalendarType from "../../../base/i18n/date/CalendarType.js";
|
|
10
10
|
/**
|
|
11
11
|
* The Persian date class
|
|
12
12
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* OpenUI5
|
|
3
|
-
* (c) Copyright
|
|
3
|
+
* (c) Copyright 2026 SAP SE or an SAP affiliate company.
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import Log from "../../../base/Log.js";
|
|
7
|
+
import Localization from "../../../base/i18n/Localization.js";
|
|
8
|
+
import TimezoneUtils from "../../../base/i18n/date/TimezoneUtils.js";
|
|
8
9
|
var aAllParts = ["year", "month", "day", "hour", "minute", "second", "fractionalSecond"],
|
|
9
10
|
// "2023", "2023-01", "2023-01-20", "+002023-01-20" are parsed by JavaScript Date as UTC
|
|
10
11
|
// timestamps, whereas "798", "2023-1", "2023-01-5" are parsed as local dates.
|
|
@@ -22,6 +23,9 @@ var aAllParts = ["year", "month", "day", "hour", "minute", "second", "fractional
|
|
|
22
23
|
Fri: 5,
|
|
23
24
|
Sat: 6
|
|
24
25
|
};
|
|
26
|
+
// Regular expression for local date string parts around the switch to Daylight Saving Time; the date part has to
|
|
27
|
+
// exist, time part parts may be optional; e.g. "2023-03-31T02:00" or "2023-3-31 2:00"
|
|
28
|
+
const rLocalDate = /^(\d{1,4})-(\d{1,2})-(\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?)?$/;
|
|
25
29
|
|
|
26
30
|
/**
|
|
27
31
|
* Pads the start of the absolute given value with zeros up to the given length. If the given
|
|
@@ -51,20 +55,21 @@ function addLeadingZeros(iValue, iLength) {
|
|
|
51
55
|
* @class A date implementation considering the configured time zone
|
|
52
56
|
*
|
|
53
57
|
* A subclass of JavaScript <code>Date</code> that considers the configured time zone, see
|
|
54
|
-
* {@link sap.
|
|
55
|
-
* that use the local browser time zone, like <code>getDate</code>,
|
|
58
|
+
* {@link module:sap/base/i18n/Localization.getTimezone Localization.getTimezone}. All JavaScript
|
|
59
|
+
* <code>Date</code> functions that use the local browser time zone, like <code>getDate</code>,
|
|
56
60
|
* <code>setDate</code>, and <code>toString</code>, are overwritten and use the
|
|
57
61
|
* configured time zone to compute the values.
|
|
58
62
|
*
|
|
59
63
|
* Use {@link module:sap/ui/core/date/UI5Date.getInstance} to create new date instances.
|
|
60
64
|
*
|
|
61
65
|
* <b>Note:</b> Adjusting the time zone in a running application can lead to unexpected data
|
|
62
|
-
* inconsistencies. For more information, see
|
|
66
|
+
* inconsistencies. For more information, see
|
|
67
|
+
* {@link module:sap/base/i18n/Localization.setTimezone Localization.setTimezone}.
|
|
63
68
|
*
|
|
64
69
|
* @hideconstructor
|
|
65
70
|
* @public
|
|
66
71
|
* @since 1.111.0
|
|
67
|
-
* @version 1.
|
|
72
|
+
* @version 1.146.0
|
|
68
73
|
*/
|
|
69
74
|
function UI5Date(vDateParts, sTimezoneID) {
|
|
70
75
|
var oDateInstance = UI5Date._createDateInstance(vDateParts);
|
|
@@ -86,9 +91,45 @@ function UI5Date(vDateParts, sTimezoneID) {
|
|
|
86
91
|
return;
|
|
87
92
|
}
|
|
88
93
|
if (vDateParts.length > 1 || vDateParts.length === 1 && typeof vDateParts[0] === "string" && !rIsUTCString.test(vDateParts[0])) {
|
|
89
|
-
this._setParts(aAllParts,
|
|
90
94
|
// JavaScript Date parsed the arguments already in local browser time zone
|
|
91
|
-
[oDateInstance.getFullYear(), oDateInstance.getMonth(), oDateInstance.getDate(), oDateInstance.getHours(), oDateInstance.getMinutes(), oDateInstance.getSeconds(), oDateInstance.getMilliseconds()]
|
|
95
|
+
const aLocalDateParts = [oDateInstance.getFullYear(), oDateInstance.getMonth(), oDateInstance.getDate(), oDateInstance.getHours(), oDateInstance.getMinutes(), oDateInstance.getSeconds(), oDateInstance.getMilliseconds()];
|
|
96
|
+
// If the given local timestamp does not exist in the current browser time zone (switch to Daylight Saving
|
|
97
|
+
// Time) the values in aLocalDateParts don't match the input and have to be corrected
|
|
98
|
+
const iLocalTimezoneOffset = oDateInstance.getTimezoneOffset();
|
|
99
|
+
// the maximum time shift is 2 hours, so check whether 2 hours ago is in another time zone
|
|
100
|
+
const iTimezoneOffset2hAgo = new Date(oDateInstance.getTime() - 7200000).getTimezoneOffset();
|
|
101
|
+
// only the switch to the Daylight Saving Time needs to be fixed (e.g. from GMT+1 with the offset -60 to
|
|
102
|
+
// GMT+2 with the offset -120, or from GMT-5 with the offset 300 to GMT-4 with the offset 240);
|
|
103
|
+
// in the other case aLocalDateParts contain already the expected date/time parts
|
|
104
|
+
if (iLocalTimezoneOffset < iTimezoneOffset2hAgo) {
|
|
105
|
+
// year, seconds and milliseconds don't change when switching to Daylight Saving Time; update the other
|
|
106
|
+
// parts
|
|
107
|
+
if (vDateParts.length > 1) {
|
|
108
|
+
// timestamp near switch to Daylight Saving Time -> take the original values for month, day, hours,
|
|
109
|
+
// minutes (other parts are not modified by Daylight Saving Time switch)
|
|
110
|
+
aLocalDateParts[1] = vDateParts[1] || 0;
|
|
111
|
+
aLocalDateParts[2] = vDateParts[2] !== undefined ? vDateParts[2] : 1;
|
|
112
|
+
aLocalDateParts[3] = vDateParts[3] !== undefined ? vDateParts[3] : 0;
|
|
113
|
+
aLocalDateParts[4] = vDateParts[4] !== undefined ? vDateParts[4] : 0;
|
|
114
|
+
} else {
|
|
115
|
+
// vDateParts.length === 1
|
|
116
|
+
// string based local input near the switch to Daylight Saving Time can only be handled in the ISO
|
|
117
|
+
// format
|
|
118
|
+
const aDateParts = rLocalDate.exec(vDateParts[0]);
|
|
119
|
+
if (aDateParts) {
|
|
120
|
+
aLocalDateParts[1] = +aDateParts[2] - 1; // use + operator to get the value as used by Date
|
|
121
|
+
aLocalDateParts[2] = aDateParts[3];
|
|
122
|
+
aLocalDateParts[3] = aDateParts[4] !== undefined ? aDateParts[4] : 0;
|
|
123
|
+
aLocalDateParts[4] = aDateParts[5] !== undefined ? aDateParts[5] : 0;
|
|
124
|
+
} else {
|
|
125
|
+
// other string based local input near the switch to Daylight Saving Time cannot be handled
|
|
126
|
+
// without re-implementing parse logic of JavaScript Date -> recommend to use the constructor
|
|
127
|
+
// with more than 1 argument or to use the ISO format
|
|
128
|
+
Log.warning("UI5Date for '" + vDateParts[0] + "' cannot be ensured to be correct as it is near" + " the change from standard time to daylight saving time in the current browser locale;" + " use the constructor with more than 1 arguments or use the ISO format instead", oDateInstance, "sap.ui.core.date.UI5Date");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
this._setParts(aAllParts, aLocalDateParts);
|
|
92
133
|
}
|
|
93
134
|
}
|
|
94
135
|
UI5Date.prototype = Object.create(Date.prototype, {
|
|
@@ -114,7 +155,7 @@ UI5Date.prototype._getPart = function (sPart) {
|
|
|
114
155
|
if (isNaN(this.oDate)) {
|
|
115
156
|
return NaN;
|
|
116
157
|
}
|
|
117
|
-
this.oDateParts = this.oDateParts ||
|
|
158
|
+
this.oDateParts = this.oDateParts || TimezoneUtils._getParts(this.oDate, this.sTimezoneID);
|
|
118
159
|
if (sPart === "weekday") {
|
|
119
160
|
return mWeekdayToDay[this.oDateParts.weekday];
|
|
120
161
|
}
|
|
@@ -188,16 +229,16 @@ UI5Date.prototype._setParts = function (aParts, aValues) {
|
|
|
188
229
|
second: "0"
|
|
189
230
|
};
|
|
190
231
|
} else {
|
|
191
|
-
oCurrentDateParts =
|
|
232
|
+
oCurrentDateParts = TimezoneUtils._getParts(this.oDate, this.sTimezoneID);
|
|
192
233
|
}
|
|
193
234
|
oDateParts = Object.assign({}, oCurrentDateParts, oDateParts);
|
|
194
235
|
|
|
195
236
|
// NaN may happen if no year is given if current date is invalid
|
|
196
|
-
oNewDateAsUTCTimestamp =
|
|
237
|
+
oNewDateAsUTCTimestamp = TimezoneUtils._getDateFromParts(oDateParts);
|
|
197
238
|
if (isNaN(oNewDateAsUTCTimestamp)) {
|
|
198
239
|
return this.setTime(NaN);
|
|
199
240
|
}
|
|
200
|
-
iNewTimestamp = oNewDateAsUTCTimestamp.getTime() +
|
|
241
|
+
iNewTimestamp = oNewDateAsUTCTimestamp.getTime() + TimezoneUtils.calculateOffset(oNewDateAsUTCTimestamp, this.sTimezoneID) * 1000;
|
|
201
242
|
return this.setTime(iNewTimestamp);
|
|
202
243
|
};
|
|
203
244
|
|
|
@@ -332,7 +373,7 @@ UI5Date.prototype.getSeconds = function () {
|
|
|
332
373
|
* @public
|
|
333
374
|
*/
|
|
334
375
|
UI5Date.prototype.getTimezoneOffset = function () {
|
|
335
|
-
return
|
|
376
|
+
return TimezoneUtils.calculateOffset(this.oDate, this.sTimezoneID) / 60;
|
|
336
377
|
};
|
|
337
378
|
|
|
338
379
|
/**
|
|
@@ -781,13 +822,15 @@ UI5Date.prototype.toDateString = function () {
|
|
|
781
822
|
* object interpreted by default in the configured time zone, see
|
|
782
823
|
* <code>Date.prototype.toLocaleDateString</code>.
|
|
783
824
|
*
|
|
784
|
-
* @param {string} [sLocale
|
|
785
|
-
* The locale used for formatting; the
|
|
825
|
+
* @param {string} [sLocale]
|
|
826
|
+
* The locale used for formatting; by default, the string representation of
|
|
827
|
+
* {@link module:sap/base/i18n/Localization.getLanguageTag Localization.getLanguageTag}
|
|
786
828
|
* @param {object} [oOptions]
|
|
787
829
|
* The options object used for formatting, corresponding to the options parameter of the
|
|
788
830
|
* <code>Intl.DateTimeFormat</code> constructor
|
|
789
|
-
* @param {string} [oOptions.timeZone
|
|
790
|
-
* The IANA time zone ID;
|
|
831
|
+
* @param {string} [oOptions.timeZone]
|
|
832
|
+
* The IANA time zone ID; by default
|
|
833
|
+
* {@link module:sap/base/i18n/Localization.getTimezone Localization.getTimezone}
|
|
791
834
|
* @returns {string}
|
|
792
835
|
* The language-dependent representation of the date part of this date object
|
|
793
836
|
*
|
|
@@ -800,13 +843,15 @@ UI5Date.prototype.toDateString = function () {
|
|
|
800
843
|
* Returns a string with a language-dependent representation of this date object interpreted by
|
|
801
844
|
* default in the configured time zone, see <code>Date.prototype.toLocaleString</code>.
|
|
802
845
|
*
|
|
803
|
-
* @param {string} [sLocale
|
|
804
|
-
* The locale used for formatting; the
|
|
846
|
+
* @param {string} [sLocale]
|
|
847
|
+
* The locale used for formatting; by default, the string representation of
|
|
848
|
+
* {@link module:sap/base/i18n/Localization.getLanguageTag Localization.getLanguageTag}
|
|
805
849
|
* @param {object} [oOptions]
|
|
806
850
|
* The options object used for formatting, corresponding to the options parameter of the
|
|
807
851
|
* <code>Intl.DateTimeFormat</code> constructor
|
|
808
|
-
* @param {string} [oOptions.timeZone
|
|
809
|
-
* The IANA time zone ID;
|
|
852
|
+
* @param {string} [oOptions.timeZone]
|
|
853
|
+
* The IANA time zone ID; by default
|
|
854
|
+
* {@link module:sap/base/i18n/Localization.getTimezone Localization.getTimezone}
|
|
810
855
|
* @returns {string}
|
|
811
856
|
* The language-dependent representation of this date object
|
|
812
857
|
*
|
|
@@ -820,13 +865,15 @@ UI5Date.prototype.toDateString = function () {
|
|
|
820
865
|
* object interpreted by default in the configured time zone, see
|
|
821
866
|
* <code>Date.prototype.toLocaleTimeString</code>.
|
|
822
867
|
*
|
|
823
|
-
* @param {string} [sLocale
|
|
824
|
-
* The locale used for formatting; the
|
|
868
|
+
* @param {string} [sLocale]
|
|
869
|
+
* The locale used for formatting; by default, the string representation of
|
|
870
|
+
* {@link module:sap/base/i18n/Localization.getLanguageTag Localization.getLanguageTag}
|
|
825
871
|
* @param {object} [oOptions]
|
|
826
872
|
* The options object used for formatting, corresponding to the options parameter of the
|
|
827
873
|
* <code>Intl.DateTimeFormat</code> constructor
|
|
828
|
-
* @param {string} [oOptions.timeZone
|
|
829
|
-
* The IANA time zone ID;
|
|
874
|
+
* @param {string} [oOptions.timeZone]
|
|
875
|
+
* The IANA time zone ID; by default
|
|
876
|
+
* {@link module:sap/base/i18n/Localization.getTimezone Localization.getTimezone}
|
|
830
877
|
* @returns {string}
|
|
831
878
|
* The language-dependent representation of the time part of this date object
|
|
832
879
|
*
|
|
@@ -902,7 +949,7 @@ UI5Date.prototype.toTimeString = function () {
|
|
|
902
949
|
});
|
|
903
950
|
["toLocaleDateString", "toLocaleString", "toLocaleTimeString"].forEach(function (sMethod) {
|
|
904
951
|
UI5Date.prototype[sMethod] = function (sLocale, oOptions) {
|
|
905
|
-
return this.oDate[sMethod](sLocale ||
|
|
952
|
+
return this.oDate[sMethod](sLocale || Localization.getLanguageTag().toString(), Object.assign({
|
|
906
953
|
timeZone: this.sTimezoneID
|
|
907
954
|
}, oOptions));
|
|
908
955
|
};
|
|
@@ -943,7 +990,8 @@ UI5Date._createDateInstance = function (vParts) {
|
|
|
943
990
|
* parameters are the same as the ones supported by the JavaScript Date constructor.
|
|
944
991
|
*
|
|
945
992
|
* <b>Note:</b> Adjusting the time zone in a running application can lead to unexpected data
|
|
946
|
-
* inconsistencies. For more information, see
|
|
993
|
+
* inconsistencies. For more information, see
|
|
994
|
+
* {@link module:sap/base/i18n/Localization.setTimezone Localization.setTimezone}.
|
|
947
995
|
*
|
|
948
996
|
* @param {int|string|Date|module:sap/ui/core/date/UI5Date|null} [vYearOrValue]
|
|
949
997
|
* Same meaning as in the JavaScript Date constructor
|
|
@@ -958,11 +1006,11 @@ UI5Date._createDateInstance = function (vParts) {
|
|
|
958
1006
|
* The date instance that considers the configured time zone in all local getters and setters.
|
|
959
1007
|
*
|
|
960
1008
|
* @public
|
|
961
|
-
* @see sap.
|
|
1009
|
+
* @see module:sap/base/i18n/Localization.getTimezone
|
|
962
1010
|
*/
|
|
963
1011
|
UI5Date.getInstance = function () {
|
|
964
|
-
var sTimezone =
|
|
965
|
-
if (sTimezone !==
|
|
1012
|
+
var sTimezone = Localization.getTimezone();
|
|
1013
|
+
if (sTimezone !== TimezoneUtils.getLocalTimezone()) {
|
|
966
1014
|
return new UI5Date(arguments, sTimezone);
|
|
967
1015
|
}
|
|
968
1016
|
// time zones are equal -> use JavaScript Date as it is
|
|
@@ -984,7 +1032,7 @@ UI5Date.checkDate = function (oDate) {
|
|
|
984
1032
|
if (isNaN(oDate.getTime())) {
|
|
985
1033
|
throw new Error("The given Date is not valid");
|
|
986
1034
|
}
|
|
987
|
-
if (!(oDate instanceof UI5Date) &&
|
|
1035
|
+
if (!(oDate instanceof UI5Date) && Localization.getTimezone() !== TimezoneUtils.getLocalTimezone()) {
|
|
988
1036
|
throw new Error("Configured time zone requires the parameter 'oDate' to be an instance of" + " sap.ui.core.date.UI5Date");
|
|
989
1037
|
}
|
|
990
1038
|
};
|