@ui5/webcomponents-localization 2.26.0-rc.0 → 2.26.0-rc.1
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/ar.json +21 -0
- package/dist/generated/assets/cldr/ar_EG.json +21 -0
- package/dist/generated/assets/cldr/ar_SA.json +21 -0
- package/dist/generated/assets/cldr/bg.json +21 -0
- package/dist/generated/assets/cldr/ca.json +21 -0
- package/dist/generated/assets/cldr/cnr.json +21 -0
- package/dist/generated/assets/cldr/cs.json +21 -0
- package/dist/generated/assets/cldr/cy.json +21 -0
- package/dist/generated/assets/cldr/da.json +21 -0
- package/dist/generated/assets/cldr/de.json +21 -0
- package/dist/generated/assets/cldr/de_AT.json +21 -0
- package/dist/generated/assets/cldr/de_CH.json +21 -0
- package/dist/generated/assets/cldr/el.json +21 -0
- package/dist/generated/assets/cldr/el_CY.json +21 -0
- package/dist/generated/assets/cldr/en.json +21 -0
- package/dist/generated/assets/cldr/en_AU.json +21 -0
- package/dist/generated/assets/cldr/en_GB.json +21 -0
- package/dist/generated/assets/cldr/en_HK.json +21 -0
- package/dist/generated/assets/cldr/en_IE.json +21 -0
- package/dist/generated/assets/cldr/en_IN.json +21 -0
- package/dist/generated/assets/cldr/en_NZ.json +21 -0
- package/dist/generated/assets/cldr/en_PG.json +21 -0
- package/dist/generated/assets/cldr/en_SG.json +21 -0
- package/dist/generated/assets/cldr/en_ZA.json +21 -0
- package/dist/generated/assets/cldr/es.json +21 -0
- package/dist/generated/assets/cldr/es_AR.json +21 -0
- package/dist/generated/assets/cldr/es_BO.json +21 -0
- package/dist/generated/assets/cldr/es_CL.json +21 -0
- package/dist/generated/assets/cldr/es_CO.json +21 -0
- package/dist/generated/assets/cldr/es_MX.json +21 -0
- package/dist/generated/assets/cldr/es_PE.json +21 -0
- package/dist/generated/assets/cldr/es_UY.json +21 -0
- package/dist/generated/assets/cldr/es_VE.json +21 -0
- package/dist/generated/assets/cldr/et.json +21 -0
- package/dist/generated/assets/cldr/fa.json +21 -0
- package/dist/generated/assets/cldr/fi.json +21 -0
- package/dist/generated/assets/cldr/fr.json +21 -0
- package/dist/generated/assets/cldr/fr_BE.json +21 -0
- package/dist/generated/assets/cldr/fr_CA.json +21 -0
- package/dist/generated/assets/cldr/fr_CH.json +21 -0
- package/dist/generated/assets/cldr/fr_LU.json +21 -0
- package/dist/generated/assets/cldr/he.json +21 -0
- package/dist/generated/assets/cldr/hi.json +21 -0
- package/dist/generated/assets/cldr/hr.json +21 -0
- package/dist/generated/assets/cldr/hu.json +21 -0
- package/dist/generated/assets/cldr/id.json +21 -0
- package/dist/generated/assets/cldr/it.json +21 -0
- package/dist/generated/assets/cldr/it_CH.json +21 -0
- package/dist/generated/assets/cldr/ja.json +21 -0
- package/dist/generated/assets/cldr/kk.json +21 -0
- package/dist/generated/assets/cldr/ko.json +21 -0
- package/dist/generated/assets/cldr/lt.json +21 -0
- package/dist/generated/assets/cldr/lv.json +21 -0
- package/dist/generated/assets/cldr/mk.json +21 -0
- package/dist/generated/assets/cldr/ms.json +21 -0
- package/dist/generated/assets/cldr/nb.json +21 -0
- package/dist/generated/assets/cldr/nl.json +21 -0
- package/dist/generated/assets/cldr/nl_BE.json +21 -0
- package/dist/generated/assets/cldr/pl.json +21 -0
- package/dist/generated/assets/cldr/pt.json +21 -0
- package/dist/generated/assets/cldr/pt_PT.json +21 -0
- package/dist/generated/assets/cldr/ro.json +21 -0
- package/dist/generated/assets/cldr/ru.json +21 -0
- package/dist/generated/assets/cldr/ru_UA.json +21 -0
- package/dist/generated/assets/cldr/sk.json +21 -0
- package/dist/generated/assets/cldr/sl.json +21 -0
- package/dist/generated/assets/cldr/sr.json +21 -0
- package/dist/generated/assets/cldr/sr_Latn.json +21 -0
- package/dist/generated/assets/cldr/sv.json +21 -0
- package/dist/generated/assets/cldr/th.json +21 -0
- package/dist/generated/assets/cldr/tr.json +21 -0
- package/dist/generated/assets/cldr/uk.json +21 -0
- package/dist/generated/assets/cldr/vi.json +21 -0
- package/dist/generated/assets/cldr/zh_CN.json +21 -0
- package/dist/generated/assets/cldr/zh_HK.json +21 -0
- package/dist/generated/assets/cldr/zh_SG.json +21 -0
- package/dist/generated/assets/cldr/zh_TW.json +21 -0
- package/dist/sap/base/Event.js +1 -1
- package/dist/sap/base/Eventing.js +1 -1
- package/dist/sap/base/i18n/LanguageTag.js +1 -1
- package/dist/sap/base/i18n/date/TimezoneUtils.js +1 -1
- package/dist/sap/base/util/Version.js +1 -1
- package/dist/sap/base/util/deepEqual.js +2 -2
- package/dist/sap/ui/base/Metadata.js +1 -1
- package/dist/sap/ui/base/Object.js +1 -1
- package/dist/sap/ui/core/Locale.js +1 -1
- package/dist/sap/ui/core/LocaleData.js +23 -1
- package/dist/sap/ui/core/date/UI5Date.js +1 -1
- package/dist/sap/ui/core/format/DateFormat.js +101 -14
- package/dist/sap/ui/core/format/FormatUtils.js +1 -1
- package/dist/sap/ui/core/format/NumberFormat.js +403 -344
- package/dist/sap/ui/core/format/TimezoneUtil.js +1 -1
- package/package.json +6 -6
|
@@ -6014,5 +6014,26 @@
|
|
|
6014
6014
|
"sap-calendarWeek": {
|
|
6015
6015
|
"narrow": "Tuần theo lịch {0}",
|
|
6016
6016
|
"wide": "Tuần theo lịch {0}"
|
|
6017
|
+
},
|
|
6018
|
+
"sap-datePlaceholder": "ví dụ: {0}",
|
|
6019
|
+
"sap-fileSize": {
|
|
6020
|
+
"Byte": "{0} Byte",
|
|
6021
|
+
"Bytes": "{0} Byte",
|
|
6022
|
+
"Kilobyte": "{0} KB",
|
|
6023
|
+
"Megabyte": "{0} MB",
|
|
6024
|
+
"Gigabyte": "{0} GB",
|
|
6025
|
+
"Terabyte": "{0} TB",
|
|
6026
|
+
"Petabyte": "{0} PB",
|
|
6027
|
+
"Exabyte": "{0} EB",
|
|
6028
|
+
"Zettabyte": "{0} ZB",
|
|
6029
|
+
"Yottabyte": "{0} YB",
|
|
6030
|
+
"Kibibyte": "{0} KiB",
|
|
6031
|
+
"Mebibyte": "{0} MiB",
|
|
6032
|
+
"Gibibyte": "{0} GiB",
|
|
6033
|
+
"Tebibyte": "{0} TiB",
|
|
6034
|
+
"Pebibyte": "{0} PiB",
|
|
6035
|
+
"Exbibyte": "{0} EiB",
|
|
6036
|
+
"Zebibyte": "{0} ZiB",
|
|
6037
|
+
"Yobibyte": "{0} YiB"
|
|
6017
6038
|
}
|
|
6018
6039
|
}
|
|
@@ -5967,5 +5967,26 @@
|
|
|
5967
5967
|
"sap-calendarWeek": {
|
|
5968
5968
|
"narrow": "日历周 {0}",
|
|
5969
5969
|
"wide": "日历周 {0}"
|
|
5970
|
+
},
|
|
5971
|
+
"sap-datePlaceholder": "例如 {0}",
|
|
5972
|
+
"sap-fileSize": {
|
|
5973
|
+
"Byte": "{0} 字节",
|
|
5974
|
+
"Bytes": "{0} 字节",
|
|
5975
|
+
"Kilobyte": "{0} KB",
|
|
5976
|
+
"Megabyte": "{0} MB",
|
|
5977
|
+
"Gigabyte": "{0} GB",
|
|
5978
|
+
"Terabyte": "{0} TB",
|
|
5979
|
+
"Petabyte": "{0} PB",
|
|
5980
|
+
"Exabyte": "{0} EB",
|
|
5981
|
+
"Zettabyte": "{0} ZB",
|
|
5982
|
+
"Yottabyte": "{0} YB",
|
|
5983
|
+
"Kibibyte": "{0} KiB",
|
|
5984
|
+
"Mebibyte": "{0} MiB",
|
|
5985
|
+
"Gibibyte": "{0} GiB",
|
|
5986
|
+
"Tebibyte": "{0} TiB",
|
|
5987
|
+
"Pebibyte": "{0} PiB",
|
|
5988
|
+
"Exbibyte": "{0} EiB",
|
|
5989
|
+
"Zebibyte": "{0} ZiB",
|
|
5990
|
+
"Yobibyte": "{0} YiB"
|
|
5970
5991
|
}
|
|
5971
5992
|
}
|
|
@@ -5975,5 +5975,26 @@
|
|
|
5975
5975
|
"sap-calendarWeek": {
|
|
5976
5976
|
"narrow": "曆週 {0}",
|
|
5977
5977
|
"wide": "曆週 {0}"
|
|
5978
|
+
},
|
|
5979
|
+
"sap-datePlaceholder": "例如 {0}",
|
|
5980
|
+
"sap-fileSize": {
|
|
5981
|
+
"Byte": "{0} 位元組",
|
|
5982
|
+
"Bytes": "{0} 位元組",
|
|
5983
|
+
"Kilobyte": "{0} KB",
|
|
5984
|
+
"Megabyte": "{0} MB",
|
|
5985
|
+
"Gigabyte": "{0} GB",
|
|
5986
|
+
"Terabyte": "{0} TB",
|
|
5987
|
+
"Petabyte": "{0} PB",
|
|
5988
|
+
"Exabyte": "{0} EB",
|
|
5989
|
+
"Zettabyte": "{0} ZB",
|
|
5990
|
+
"Yottabyte": "{0} YB",
|
|
5991
|
+
"Kibibyte": "{0} KiB",
|
|
5992
|
+
"Mebibyte": "{0} MiB",
|
|
5993
|
+
"Gibibyte": "{0} GiB",
|
|
5994
|
+
"Tebibyte": "{0} TiB",
|
|
5995
|
+
"Pebibyte": "{0} PiB",
|
|
5996
|
+
"Exbibyte": "{0} EiB",
|
|
5997
|
+
"Zebibyte": "{0} ZiB",
|
|
5998
|
+
"Yobibyte": "{0} YiB"
|
|
5978
5999
|
}
|
|
5979
6000
|
}
|
|
@@ -5975,5 +5975,26 @@
|
|
|
5975
5975
|
"sap-calendarWeek": {
|
|
5976
5976
|
"narrow": "CW {0}",
|
|
5977
5977
|
"wide": "Calendar Week {0}"
|
|
5978
|
+
},
|
|
5979
|
+
"sap-datePlaceholder": "e.g. {0}",
|
|
5980
|
+
"sap-fileSize": {
|
|
5981
|
+
"Byte": "{0} Byte",
|
|
5982
|
+
"Bytes": "{0} Bytes",
|
|
5983
|
+
"Kilobyte": "{0} KB",
|
|
5984
|
+
"Megabyte": "{0} MB",
|
|
5985
|
+
"Gigabyte": "{0} GB",
|
|
5986
|
+
"Terabyte": "{0} TB",
|
|
5987
|
+
"Petabyte": "{0} PB",
|
|
5988
|
+
"Exabyte": "{0} EB",
|
|
5989
|
+
"Zettabyte": "{0} ZB",
|
|
5990
|
+
"Yottabyte": "{0} YB",
|
|
5991
|
+
"Kibibyte": "{0} KiB",
|
|
5992
|
+
"Mebibyte": "{0} MiB",
|
|
5993
|
+
"Gibibyte": "{0} GiB",
|
|
5994
|
+
"Tebibyte": "{0} TiB",
|
|
5995
|
+
"Pebibyte": "{0} PiB",
|
|
5996
|
+
"Exbibyte": "{0} EiB",
|
|
5997
|
+
"Zebibyte": "{0} ZiB",
|
|
5998
|
+
"Yobibyte": "{0} YiB"
|
|
5978
5999
|
}
|
|
5979
6000
|
}
|
|
@@ -6031,5 +6031,26 @@
|
|
|
6031
6031
|
"sap-calendarWeek": {
|
|
6032
6032
|
"narrow": "曆週 {0}",
|
|
6033
6033
|
"wide": "曆週 {0}"
|
|
6034
|
+
},
|
|
6035
|
+
"sap-datePlaceholder": "例如 {0}",
|
|
6036
|
+
"sap-fileSize": {
|
|
6037
|
+
"Byte": "{0} 位元組",
|
|
6038
|
+
"Bytes": "{0} 位元組",
|
|
6039
|
+
"Kilobyte": "{0} KB",
|
|
6040
|
+
"Megabyte": "{0} MB",
|
|
6041
|
+
"Gigabyte": "{0} GB",
|
|
6042
|
+
"Terabyte": "{0} TB",
|
|
6043
|
+
"Petabyte": "{0} PB",
|
|
6044
|
+
"Exabyte": "{0} EB",
|
|
6045
|
+
"Zettabyte": "{0} ZB",
|
|
6046
|
+
"Yottabyte": "{0} YB",
|
|
6047
|
+
"Kibibyte": "{0} KiB",
|
|
6048
|
+
"Mebibyte": "{0} MiB",
|
|
6049
|
+
"Gibibyte": "{0} GiB",
|
|
6050
|
+
"Tebibyte": "{0} TiB",
|
|
6051
|
+
"Pebibyte": "{0} PiB",
|
|
6052
|
+
"Exbibyte": "{0} EiB",
|
|
6053
|
+
"Zebibyte": "{0} ZiB",
|
|
6054
|
+
"Yobibyte": "{0} YiB"
|
|
6034
6055
|
}
|
|
6035
6056
|
}
|
package/dist/sap/base/Event.js
CHANGED
|
@@ -9,7 +9,7 @@ const EVENT_PARAMETERS_SYMBOL = Symbol("parameters");
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @author SAP SE
|
|
12
|
-
* @version 1.
|
|
12
|
+
* @version 1.151.0
|
|
13
13
|
*
|
|
14
14
|
* Creates an event with the given <code>sType</code>,
|
|
15
15
|
* linked to the provided <code>oTarget</code> and enriched with the <code>oParameters</code>.
|
|
@@ -31,7 +31,7 @@ var rLanguageTag = /^((?:[A-Z]{2,3}(?:-[A-Z]{3}){0,3})|[A-Z]{4}|[A-Z]{5,8})(?:-(
|
|
|
31
31
|
* @param {string} sLanguageTag the language tag identifier, in format en-US or en_US.
|
|
32
32
|
*
|
|
33
33
|
* @author SAP SE
|
|
34
|
-
* @version 1.
|
|
34
|
+
* @version 1.151.0
|
|
35
35
|
* @public
|
|
36
36
|
* @alias module:sap/base/i18n/LanguageTag
|
|
37
37
|
*/
|
|
@@ -137,7 +137,7 @@ function Version(vMajor, iMinor, iPatch, sSuffix) {
|
|
|
137
137
|
* @public
|
|
138
138
|
*/
|
|
139
139
|
this.compareTo = function (vOtherMajor, iOtherMinor, iOtherPatch, sOtherSuffix) {
|
|
140
|
-
var vOther = Version.apply(
|
|
140
|
+
var vOther = Version.apply(null, arguments); // cast to Version
|
|
141
141
|
/*eslint-disable no-nested-ternary */
|
|
142
142
|
return vMajor - vOther.getMajor() || iMinor - vOther.getMinor() || iPatch - vOther.getPatch() || (sSuffix < vOther.getSuffix() ? -1 : sSuffix === vOther.getSuffix() ? 0 : 1);
|
|
143
143
|
/*eslint-enable no-nested-ternary */
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/*global Node */
|
|
7
7
|
//@evo-todo check isEqualNode dependency: not yet available...
|
|
8
|
-
//@evo-todo dependency to global name 'Node' contradicts sap/base package
|
|
9
8
|
import Log from "../Log.js";
|
|
10
9
|
/**
|
|
11
10
|
* Compares the two given values for equality, especially by comparing the content.
|
|
@@ -65,7 +64,8 @@ var fnEqual = function (a, b, maxDepth, contains, depth) {
|
|
|
65
64
|
if (!contains && Object.keys(a).length !== Object.keys(b).length) {
|
|
66
65
|
return false;
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
// 'Node' is a browser-only global; the typeof guard avoids a ReferenceError in non-browser environments.
|
|
68
|
+
if (typeof Node !== "undefined" && a instanceof Node) {
|
|
69
69
|
return a.isEqualNode(b);
|
|
70
70
|
}
|
|
71
71
|
if (a instanceof Date) {
|
|
@@ -21,7 +21,7 @@ import Log from "../../base/Log.js";
|
|
|
21
21
|
* @class Base class for all SAPUI5 Objects.
|
|
22
22
|
* @abstract
|
|
23
23
|
* @author Malte Wedel
|
|
24
|
-
* @version 1.
|
|
24
|
+
* @version 1.151.0
|
|
25
25
|
* @public
|
|
26
26
|
* @alias sap.ui.base.Object
|
|
27
27
|
* @throws {Error} When an instance of the class or its subclasses is created without the <code>new</code> operator.
|
|
@@ -72,7 +72,7 @@ let mLocaleIdToData = {};
|
|
|
72
72
|
* {@link https://cldr.unicode.org/ Unicode CLDR}.
|
|
73
73
|
* @hideconstructor
|
|
74
74
|
* @public
|
|
75
|
-
* @version 1.
|
|
75
|
+
* @version 1.151.0
|
|
76
76
|
*/
|
|
77
77
|
var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.core.LocaleData.prototype */{
|
|
78
78
|
constructor: function (oLocale, bAsync) {
|
|
@@ -1907,6 +1907,28 @@ var LocaleData = BaseObject.extend("sap.ui.core.LocaleData", /** @lends sap.ui.c
|
|
|
1907
1907
|
const sText = this._get("sap-calendarWeek")[sStyle];
|
|
1908
1908
|
return iWeekNumber ? sText.replace("{0}", iWeekNumber) : sText;
|
|
1909
1909
|
},
|
|
1910
|
+
/**
|
|
1911
|
+
* Gets the locale-specific date input placeholder pattern.
|
|
1912
|
+
*
|
|
1913
|
+
* @returns {string} The placeholder pattern, for example "e.g. {0}" or "z.B. {0}"
|
|
1914
|
+
*
|
|
1915
|
+
* @private
|
|
1916
|
+
*/
|
|
1917
|
+
getDatePlaceholder: function () {
|
|
1918
|
+
return this._get("sap-datePlaceholder");
|
|
1919
|
+
},
|
|
1920
|
+
/**
|
|
1921
|
+
* Gets the locale-specific file size format pattern for the given unit.
|
|
1922
|
+
*
|
|
1923
|
+
* @param {string} sUnit
|
|
1924
|
+
* The file size unit key
|
|
1925
|
+
* @returns {string} The format pattern
|
|
1926
|
+
*
|
|
1927
|
+
* @private
|
|
1928
|
+
*/
|
|
1929
|
+
getFileSizePattern: function (sUnit) {
|
|
1930
|
+
return this._get("sap-fileSize", sUnit);
|
|
1931
|
+
},
|
|
1910
1932
|
/**
|
|
1911
1933
|
* Whether 1 January is the first day of the first calendar week.
|
|
1912
1934
|
* This is the definition of the calendar week in the US.
|
|
@@ -13,7 +13,6 @@ import TimezoneUtils from "../../../base/i18n/date/TimezoneUtils.js";
|
|
|
13
13
|
import formatMessage from "../../../base/strings/formatMessage.js";
|
|
14
14
|
import deepEqual from "../../../base/util/deepEqual.js";
|
|
15
15
|
import extend from "../../../base/util/extend.js";
|
|
16
|
-
import Library from "../Lib.js";
|
|
17
16
|
import Locale from "../Locale.js";
|
|
18
17
|
import LocaleData from "../LocaleData.js";
|
|
19
18
|
import Supportability from "../Supportability.js";
|
|
@@ -3268,40 +3267,128 @@ DateFormat.prototype.getAllowedCharacters = function (aFormatArray) {
|
|
|
3268
3267
|
|
|
3269
3268
|
/**
|
|
3270
3269
|
* Returns a language-dependent placeholder text according to this instance's format options, for example
|
|
3271
|
-
* "e.g. 12/31/2023".
|
|
3270
|
+
* "e.g. 12/31/2023". If <code>oMinimum</code> and/or <code>oMaximum</code> are given, a valid sample date
|
|
3271
|
+
* within the given range is used; see {@link #getSampleValue} for the exact algorithm.
|
|
3272
3272
|
*
|
|
3273
|
+
* @param {module:sap/ui/core/date/UI5Date} [oMinimum] The minimum date
|
|
3274
|
+
* @param {module:sap/ui/core/date/UI5Date} [oMaximum] The maximum date
|
|
3273
3275
|
* @returns {string} The language-dependent placeholder text
|
|
3274
3276
|
*
|
|
3275
3277
|
* @private
|
|
3276
3278
|
* @ui5-restricted sap.m
|
|
3277
3279
|
*/
|
|
3278
|
-
DateFormat.prototype.getPlaceholderText = function () {
|
|
3279
|
-
|
|
3280
|
-
return
|
|
3280
|
+
DateFormat.prototype.getPlaceholderText = function (oMinimum, oMaximum) {
|
|
3281
|
+
const sPlaceholder = this.oLocaleData.getDatePlaceholder();
|
|
3282
|
+
return sPlaceholder.replace("{0}", this.format.apply(this, this.getSampleValue(oMinimum, oMaximum)));
|
|
3281
3283
|
};
|
|
3282
3284
|
|
|
3283
3285
|
/**
|
|
3284
|
-
* Returns a sample date value.
|
|
3286
|
+
* Returns a sample date value. If <code>oMinimum</code> and/or <code>oMaximum</code> are given, the returned
|
|
3287
|
+
* value lies within the valid range. The end date is chosen by the following rules in order:
|
|
3288
|
+
* <ol>
|
|
3289
|
+
* <li>If the default sample year (current year) is within [min year, max year], use Dec 31 of the current
|
|
3290
|
+
* year.</li>
|
|
3291
|
+
* <li>If <code>oMinimum</code> and <code>oMaximum</code> span different years, or only one bound is given,
|
|
3292
|
+
* use the Dec 31 year-end closest to <code>oMaximum</code> (or closest to <code>oMinimum</code> if only
|
|
3293
|
+
* the minimum is given).</li>
|
|
3294
|
+
* <li>If they span different months in the same year, use the highest month-end within the range.</li>
|
|
3295
|
+
* <li>Otherwise use <code>oMaximum</code> directly.</li>
|
|
3296
|
+
* </ol>
|
|
3297
|
+
* For interval formats, the start date is nine days before the end date, clamped to <code>oMinimum</code>.
|
|
3285
3298
|
*
|
|
3286
|
-
* @
|
|
3299
|
+
* @param {module:sap/ui/core/date/UI5Date} [oMinimum] The minimum date
|
|
3300
|
+
* @param {module:sap/ui/core/date/UI5Date} [oMaximum] The maximum date
|
|
3301
|
+
* @returns {Array}
|
|
3287
3302
|
* A sample date value as an array of parameter values as expected by {@link #format}
|
|
3288
3303
|
*
|
|
3289
3304
|
* @private
|
|
3290
3305
|
*/
|
|
3291
|
-
DateFormat.prototype.getSampleValue = function () {
|
|
3292
|
-
var
|
|
3293
|
-
iFullYear = UI5Date.getInstance().getFullYear(),
|
|
3306
|
+
DateFormat.prototype.getSampleValue = function (oMinimum, oMaximum) {
|
|
3307
|
+
var iFullYear = UI5Date.getInstance().getFullYear(),
|
|
3294
3308
|
bUTC = this.oFormatOptions.UTC;
|
|
3295
3309
|
function getDate(iYear, iMonth, iDay, iHours, iMinutes, iSeconds, iMilliseconds) {
|
|
3296
3310
|
return bUTC ? UI5Date.getInstance(Date.UTC(iYear, iMonth, iDay, iHours, iMinutes, iSeconds, iMilliseconds)) : UI5Date.getInstance(iYear, iMonth, iDay, iHours, iMinutes, iSeconds, iMilliseconds);
|
|
3297
3311
|
}
|
|
3298
|
-
|
|
3312
|
+
const periodEnd = (iYear, iMonth, iDay) => {
|
|
3313
|
+
return this.type === mDateFormatTypes.DATE ? getDate(iYear, iMonth, iDay, 0, 0, 0, 0) : getDate(iYear, iMonth, iDay, 23, 59, 58, 123);
|
|
3314
|
+
};
|
|
3315
|
+
function yearEnd(iYear) {
|
|
3316
|
+
return periodEnd(iYear, 11, 31);
|
|
3317
|
+
}
|
|
3318
|
+
const oDefault = yearEnd(iFullYear);
|
|
3319
|
+
const bDefaultInRange = (!oMinimum || oDefault >= oMinimum) && (!oMaximum || oDefault <= oMaximum);
|
|
3320
|
+
let oEnd;
|
|
3321
|
+
if (bDefaultInRange) {
|
|
3322
|
+
// R1: use default
|
|
3323
|
+
oEnd = oDefault;
|
|
3324
|
+
} else if (oMinimum == null || oMaximum == null || oMinimum.getFullYear() !== oMaximum.getFullYear()) {
|
|
3325
|
+
// R2: different years or only one bound
|
|
3326
|
+
if (oMaximum) {
|
|
3327
|
+
const oYearEnd = yearEnd(oMaximum.getFullYear());
|
|
3328
|
+
oEnd = oYearEnd <= oMaximum ? oYearEnd : yearEnd(oMaximum.getFullYear() - 1);
|
|
3329
|
+
} else {
|
|
3330
|
+
const oYearEnd = yearEnd(oMinimum.getFullYear());
|
|
3331
|
+
oEnd = oYearEnd >= oMinimum ? oYearEnd : yearEnd(oMinimum.getFullYear() + 1);
|
|
3332
|
+
}
|
|
3333
|
+
} else if (oMinimum.getMonth() !== oMaximum.getMonth()) {
|
|
3334
|
+
// R3: same year, different months
|
|
3335
|
+
const iYear = oMaximum.getFullYear();
|
|
3336
|
+
const iMaxMonth = oMaximum.getMonth();
|
|
3337
|
+
const oMaxMonthEnd = periodEnd(iYear, iMaxMonth + 1, 0);
|
|
3338
|
+
oEnd = oMaxMonthEnd <= oMaximum ? oMaxMonthEnd : periodEnd(iYear, iMaxMonth, 0);
|
|
3339
|
+
} else {
|
|
3340
|
+
// R4: same year and month
|
|
3341
|
+
oEnd = oMaximum;
|
|
3342
|
+
}
|
|
3299
3343
|
if (this.type === mDateFormatTypes.DATETIME_WITH_TIMEZONE) {
|
|
3300
|
-
return [
|
|
3344
|
+
return [oEnd, Localization.getTimezone()];
|
|
3301
3345
|
}
|
|
3302
3346
|
if (this.oFormatOptions.interval) {
|
|
3303
|
-
|
|
3347
|
+
const iEndYear = bUTC ? oEnd.getUTCFullYear() : oEnd.getFullYear();
|
|
3348
|
+
const iEndMonth = bUTC ? oEnd.getUTCMonth() : oEnd.getMonth();
|
|
3349
|
+
const iEndDay = bUTC ? oEnd.getUTCDate() : oEnd.getDate();
|
|
3350
|
+
const oStart = getDate(iEndYear, iEndMonth, iEndDay - 9, 9, 12, 34, 567);
|
|
3351
|
+
return [[oMinimum && oStart < oMinimum ? oMinimum : oStart, oEnd]];
|
|
3304
3352
|
}
|
|
3305
|
-
return [
|
|
3353
|
+
return [oEnd];
|
|
3354
|
+
};
|
|
3355
|
+
|
|
3356
|
+
/**
|
|
3357
|
+
* Returns the effective date to use for placeholder text generation.
|
|
3358
|
+
*
|
|
3359
|
+
* @param {any} [oConstraintValue]
|
|
3360
|
+
* The constraint value in model representation: a <code>UI5Date</code>, a formatted string, or a timestamp number
|
|
3361
|
+
* @param {module:sap/ui/core/date/UI5Date} [oDate]
|
|
3362
|
+
* The explicit date parameter; takes precedence over the constraint
|
|
3363
|
+
* @param {sap.ui.core.format.DateFormat} [oInputFormat]
|
|
3364
|
+
* The input format used to parse string constraint values
|
|
3365
|
+
* @returns {module:sap/ui/core/date/UI5Date|undefined}
|
|
3366
|
+
* The resolved date, or <code>undefined</code> if neither parameter nor constraint is given
|
|
3367
|
+
* @throws {Error}
|
|
3368
|
+
* If <code>oDate</code> is given but does not match the constraint value
|
|
3369
|
+
*
|
|
3370
|
+
* @private
|
|
3371
|
+
*/
|
|
3372
|
+
DateFormat.resolveDate = function (oConstraintValue, oDate, oInputFormat) {
|
|
3373
|
+
if (oDate === undefined && oConstraintValue === undefined) {
|
|
3374
|
+
return undefined;
|
|
3375
|
+
}
|
|
3376
|
+
let oConstraintDate;
|
|
3377
|
+
if (oConstraintValue !== undefined) {
|
|
3378
|
+
if (typeof oConstraintValue === "number") {
|
|
3379
|
+
oConstraintDate = UI5Date.getInstance(oConstraintValue);
|
|
3380
|
+
} else if (oInputFormat) {
|
|
3381
|
+
oConstraintDate = oInputFormat.parse(oConstraintValue);
|
|
3382
|
+
} else {
|
|
3383
|
+
oConstraintDate = oConstraintValue;
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
if (oDate === undefined || oDate === null) {
|
|
3387
|
+
return oConstraintDate;
|
|
3388
|
+
}
|
|
3389
|
+
if (oConstraintDate && oDate.getTime() !== oConstraintDate.getTime()) {
|
|
3390
|
+
throw new Error(`The date ${oDate} does not match the constraint ${oConstraintDate}`);
|
|
3391
|
+
}
|
|
3392
|
+
return oDate;
|
|
3306
3393
|
};
|
|
3307
3394
|
export default DateFormat;
|