@ui5/webcomponents-localization 0.0.0-0a35d6b3d → 0.0.0-0dd36ca4b

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 (139) hide show
  1. package/CHANGELOG.md +469 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/generated/assets/cldr/ar.json +102 -62
  4. package/dist/generated/assets/cldr/ar_EG.json +102 -62
  5. package/dist/generated/assets/cldr/ar_SA.json +102 -62
  6. package/dist/generated/assets/cldr/bg.json +364 -325
  7. package/dist/generated/assets/cldr/ca.json +491 -453
  8. package/dist/generated/assets/cldr/cnr.json +4667 -0
  9. package/dist/generated/assets/cldr/cs.json +431 -324
  10. package/dist/generated/assets/cldr/cy.json +608 -340
  11. package/dist/generated/assets/cldr/da.json +290 -227
  12. package/dist/generated/assets/cldr/de.json +348 -241
  13. package/dist/generated/assets/cldr/de_AT.json +348 -241
  14. package/dist/generated/assets/cldr/de_CH.json +347 -240
  15. package/dist/generated/assets/cldr/el.json +128 -100
  16. package/dist/generated/assets/cldr/el_CY.json +128 -100
  17. package/dist/generated/assets/cldr/en.json +538 -512
  18. package/dist/generated/assets/cldr/en_AU.json +583 -520
  19. package/dist/generated/assets/cldr/en_GB.json +485 -441
  20. package/dist/generated/assets/cldr/en_HK.json +519 -474
  21. package/dist/generated/assets/cldr/en_IE.json +485 -440
  22. package/dist/generated/assets/cldr/en_IN.json +465 -420
  23. package/dist/generated/assets/cldr/en_NZ.json +505 -460
  24. package/dist/generated/assets/cldr/en_PG.json +505 -460
  25. package/dist/generated/assets/cldr/en_SG.json +505 -460
  26. package/dist/generated/assets/cldr/en_ZA.json +485 -440
  27. package/dist/generated/assets/cldr/es.json +709 -456
  28. package/dist/generated/assets/cldr/es_AR.json +687 -434
  29. package/dist/generated/assets/cldr/es_BO.json +721 -468
  30. package/dist/generated/assets/cldr/es_CL.json +567 -422
  31. package/dist/generated/assets/cldr/es_CO.json +485 -339
  32. package/dist/generated/assets/cldr/es_MX.json +734 -481
  33. package/dist/generated/assets/cldr/es_PE.json +409 -372
  34. package/dist/generated/assets/cldr/es_UY.json +433 -396
  35. package/dist/generated/assets/cldr/es_VE.json +453 -416
  36. package/dist/generated/assets/cldr/et.json +340 -307
  37. package/dist/generated/assets/cldr/fa.json +96 -34
  38. package/dist/generated/assets/cldr/fi.json +359 -308
  39. package/dist/generated/assets/cldr/fr.json +347 -321
  40. package/dist/generated/assets/cldr/fr_BE.json +347 -321
  41. package/dist/generated/assets/cldr/fr_CA.json +458 -432
  42. package/dist/generated/assets/cldr/fr_CH.json +290 -264
  43. package/dist/generated/assets/cldr/fr_LU.json +347 -321
  44. package/dist/generated/assets/cldr/he.json +241 -130
  45. package/dist/generated/assets/cldr/hi.json +103 -53
  46. package/dist/generated/assets/cldr/hr.json +467 -410
  47. package/dist/generated/assets/cldr/hu.json +246 -195
  48. package/dist/generated/assets/cldr/id.json +478 -406
  49. package/dist/generated/assets/cldr/it.json +418 -362
  50. package/dist/generated/assets/cldr/it_CH.json +418 -362
  51. package/dist/generated/assets/cldr/ja.json +58 -18
  52. package/dist/generated/assets/cldr/kk.json +562 -398
  53. package/dist/generated/assets/cldr/ko.json +36 -15
  54. package/dist/generated/assets/cldr/lt.json +320 -231
  55. package/dist/generated/assets/cldr/lv.json +184 -120
  56. package/dist/generated/assets/cldr/mk.json +4408 -0
  57. package/dist/generated/assets/cldr/ms.json +460 -388
  58. package/dist/generated/assets/cldr/nb.json +160 -92
  59. package/dist/generated/assets/cldr/nl.json +621 -373
  60. package/dist/generated/assets/cldr/nl_BE.json +621 -373
  61. package/dist/generated/assets/cldr/pl.json +590 -279
  62. package/dist/generated/assets/cldr/pt.json +696 -334
  63. package/dist/generated/assets/cldr/pt_PT.json +730 -454
  64. package/dist/generated/assets/cldr/ro.json +409 -339
  65. package/dist/generated/assets/cldr/ru.json +317 -279
  66. package/dist/generated/assets/cldr/ru_UA.json +312 -274
  67. package/dist/generated/assets/cldr/sk.json +454 -413
  68. package/dist/generated/assets/cldr/sl.json +118 -80
  69. package/dist/generated/assets/cldr/sr.json +294 -142
  70. package/dist/generated/assets/cldr/sr_Latn.json +972 -824
  71. package/dist/generated/assets/cldr/sv.json +382 -338
  72. package/dist/generated/assets/cldr/th.json +56 -36
  73. package/dist/generated/assets/cldr/tr.json +371 -320
  74. package/dist/generated/assets/cldr/uk.json +340 -290
  75. package/dist/generated/assets/cldr/vi.json +352 -328
  76. package/dist/generated/assets/cldr/zh_CN.json +34 -10
  77. package/dist/generated/assets/cldr/zh_HK.json +33 -9
  78. package/dist/generated/assets/cldr/zh_SG.json +33 -9
  79. package/dist/generated/assets/cldr/zh_TW.json +52 -28
  80. package/dist/generated/json-imports/LocaleData-static.js +3 -1
  81. package/dist/generated/json-imports/LocaleData-static.js.map +1 -1
  82. package/dist/generated/json-imports/LocaleData.js +4 -2
  83. package/dist/generated/json-imports/LocaleData.js.map +1 -1
  84. package/dist/sap/base/Event.js +59 -0
  85. package/dist/sap/base/Eventing.js +146 -0
  86. package/dist/sap/base/Log.js +2 -239
  87. package/dist/sap/base/assert.js +28 -1
  88. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  89. package/dist/sap/base/config.js +17 -0
  90. package/dist/sap/base/i18n/Formatting.js +1130 -0
  91. package/dist/sap/base/i18n/LanguageTag.js +168 -30
  92. package/dist/sap/base/i18n/date/CalendarType.js +36 -1
  93. package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +76 -1
  94. package/dist/sap/base/i18n/date/TimezoneUtils.js +242 -12
  95. package/dist/sap/base/strings/camelize.js +30 -0
  96. package/dist/sap/base/strings/formatMessage.js +88 -15
  97. package/dist/sap/base/util/ObjectPath.d.ts +4 -0
  98. package/dist/sap/base/util/ObjectPath.js +4 -33
  99. package/dist/sap/base/util/ObjectPath.js.map +1 -0
  100. package/dist/sap/base/util/Version.js +157 -0
  101. package/dist/sap/base/util/_merge.js +83 -26
  102. package/dist/sap/base/util/array/uniqueSort.js +37 -15
  103. package/dist/sap/base/util/deepClone.js +102 -0
  104. package/dist/sap/base/util/deepEqual.js +75 -51
  105. package/dist/sap/base/util/extend.js +58 -7
  106. package/dist/sap/base/util/isEmptyObject.js +34 -0
  107. package/dist/sap/base/util/isPlainObject.js +35 -1
  108. package/dist/sap/base/util/now.js +24 -3
  109. package/dist/sap/base/util/resolveReference.js +3 -0
  110. package/dist/sap/base/util/uid.js +27 -0
  111. package/dist/sap/ui/base/DataType.js +657 -0
  112. package/dist/sap/ui/base/Interface.js +47 -1
  113. package/dist/sap/ui/base/Metadata.js +433 -180
  114. package/dist/sap/ui/base/Object.js +284 -48
  115. package/dist/sap/ui/core/CalendarType.js +23 -1
  116. package/dist/sap/ui/core/Locale.js +189 -57
  117. package/dist/sap/ui/core/LocaleData.js +2670 -1380
  118. package/dist/sap/ui/core/Supportability.js +5 -0
  119. package/dist/sap/ui/core/Theming.js +539 -0
  120. package/dist/sap/ui/core/date/Buddhist.js +162 -87
  121. package/dist/sap/ui/core/date/CalendarUtils.js +61 -21
  122. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +29 -1
  123. package/dist/sap/ui/core/date/Gregorian.js +25 -10
  124. package/dist/sap/ui/core/date/Islamic.js +298 -185
  125. package/dist/sap/ui/core/date/Japanese.js +210 -115
  126. package/dist/sap/ui/core/date/Persian.js +324 -195
  127. package/dist/sap/ui/core/date/UI5Date.js +923 -237
  128. package/dist/sap/ui/core/date/UniversalDate.js +1238 -245
  129. package/dist/sap/ui/core/date/_Calendars.js +10 -1
  130. package/dist/sap/ui/core/format/DateFormat.js +3163 -2145
  131. package/dist/sap/ui/core/format/TimezoneUtil.js +23 -1
  132. package/package-scripts.cjs +6 -10
  133. package/package.json +11 -6
  134. package/tsconfig.json +2 -1
  135. package/used-modules.txt +20 -1
  136. package/dist/Assets-static.d.ts +0 -1
  137. package/dist/Assets-static.js +0 -3
  138. package/dist/Assets-static.js.map +0 -1
  139. package/dist/sap/ui/Device.js +0 -5
@@ -1,162 +1,257 @@
1
- import UniversalDate from './UniversalDate.js';
2
- import CalendarType from '../CalendarType.js';
3
- import _Calendars from './_Calendars.js';
4
- var Japanese = UniversalDate.extend('sap.ui.core.date.Japanese', {
5
- constructor: function () {
6
- var aArgs = arguments;
7
- if (aArgs.length > 1) {
8
- aArgs = toGregorianArguments(aArgs);
9
- }
10
- this.oDate = this.createDate(Date, aArgs);
11
- this.sCalendarType = CalendarType.Japanese;
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
+ // Provides class sap.ui.core.date.Japanese
7
+ import UniversalDate from "./UniversalDate.js";
8
+ import CalendarType from "../CalendarType.js";
9
+ import _Calendars from "./_Calendars.js";
10
+ /**
11
+ * The Japanese date class
12
+ *
13
+ * @class
14
+ * The Japanese date adds support for era, by returning the CLDR era type in the getEra method and calculating
15
+ * the year dependent on the current era.
16
+ *
17
+ * For the constructor and the UTC method, for the year parameter the following rules apply:
18
+ * - A year less than 100 will be treated as year of the current emperor era
19
+ * - A year equal or more than 100 will be treated as a gregorian year
20
+ * - An array with two entries will be treated as era and emperor year
21
+ *
22
+ * @private
23
+ * @alias sap.ui.core.date.Japanese
24
+ * @extends sap.ui.core.date.UniversalDate
25
+ */
26
+ var Japanese = UniversalDate.extend("sap.ui.core.date.Japanese", /** @lends sap.ui.core.date.Japanese.prototype */{
27
+ constructor: function () {
28
+ var aArgs = arguments;
29
+ if (aArgs.length > 1) {
30
+ aArgs = toGregorianArguments(aArgs);
12
31
  }
32
+ this.oDate = this.createDate(Date, aArgs);
33
+ this.sCalendarType = CalendarType.Japanese;
34
+ }
13
35
  });
14
36
  Japanese.UTC = function () {
15
- var aArgs = toGregorianArguments(arguments);
16
- return Date.UTC.apply(Date, aArgs);
37
+ var aArgs = toGregorianArguments(arguments);
38
+ return Date.UTC.apply(Date, aArgs);
17
39
  };
18
40
  Japanese.now = function () {
19
- return Date.now();
41
+ return Date.now();
20
42
  };
43
+
44
+ /**
45
+ * Find the matching japanese date for the given gregorian date
46
+ *
47
+ * @param {object} oGregorian
48
+ * @return {object}
49
+ */
21
50
  function toJapanese(oGregorian) {
22
- var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day), iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year;
23
- return {
24
- era: iEra,
25
- year: oGregorian.year - iEraStartYear + 1,
26
- month: oGregorian.month,
27
- day: oGregorian.day
28
- };
51
+ var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day),
52
+ iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year;
53
+ return {
54
+ era: iEra,
55
+ year: oGregorian.year - iEraStartYear + 1,
56
+ month: oGregorian.month,
57
+ day: oGregorian.day
58
+ };
29
59
  }
60
+
61
+ /**
62
+ * Calculate Gregorian year from Japanese era and year
63
+ *
64
+ * @param {object} oJapanese
65
+ * @return {int}
66
+ */
30
67
  function toGregorian(oJapanese) {
31
- var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year;
32
- return {
33
- year: iEraStartYear + oJapanese.year - 1,
34
- month: oJapanese.month,
35
- day: oJapanese.day
36
- };
68
+ var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year;
69
+ return {
70
+ year: iEraStartYear + oJapanese.year - 1,
71
+ month: oJapanese.month,
72
+ day: oJapanese.day
73
+ };
37
74
  }
75
+
76
+ /**
77
+ * Convert arguments array from Japanese date to Gregorian data.
78
+ *
79
+ * @param {int[]|any[]} aArgs Array with year (or [era, year]), month and day (optional) according to Japanese calendar
80
+ * @returns {int[]} Array with year, month and day according to the Gregorian calendar
81
+ */
38
82
  function toGregorianArguments(aArgs) {
39
- var oJapanese, oGregorian, iEra, vYear = aArgs[0];
40
- if (typeof vYear == 'number') {
41
- if (vYear >= 100) {
42
- return aArgs;
43
- } else {
44
- iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
45
- vYear = [
46
- iEra,
47
- vYear
48
- ];
49
- }
50
- } else if (!Array.isArray(vYear)) {
51
- vYear = [];
83
+ var oJapanese,
84
+ oGregorian,
85
+ iEra,
86
+ vYear = aArgs[0];
87
+ if (typeof vYear == "number") {
88
+ if (vYear >= 100) {
89
+ // Year greater than 100 will be treated as gregorian year
90
+ return aArgs;
91
+ } else {
92
+ // Year less than 100 is emperor year in the current era
93
+ iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
94
+ vYear = [iEra, vYear];
52
95
  }
53
- oJapanese = {
54
- era: vYear[0],
55
- year: vYear[1],
56
- month: aArgs[1],
57
- day: aArgs[2] !== undefined ? aArgs[2] : 1
58
- };
59
- oGregorian = toGregorian(oJapanese);
60
- aArgs[0] = oGregorian.year;
61
- return aArgs;
96
+ } else if (!Array.isArray(vYear)) {
97
+ // Invalid year
98
+ vYear = [];
99
+ }
100
+ oJapanese = {
101
+ era: vYear[0],
102
+ year: vYear[1],
103
+ month: aArgs[1],
104
+ day: aArgs[2] !== undefined ? aArgs[2] : 1
105
+ };
106
+ oGregorian = toGregorian(oJapanese);
107
+ aArgs[0] = oGregorian.year;
108
+ return aArgs;
62
109
  }
110
+
111
+ /**
112
+ * Get the japanese era/year from this.oDate
113
+ *
114
+ * @return {object}
115
+ */
63
116
  Japanese.prototype._getJapanese = function () {
64
- var oGregorian = {
65
- year: this.oDate.getFullYear(),
66
- month: this.oDate.getMonth(),
67
- day: this.oDate.getDate()
68
- };
69
- return toJapanese(oGregorian);
117
+ var oGregorian = {
118
+ year: this.oDate.getFullYear(),
119
+ month: this.oDate.getMonth(),
120
+ day: this.oDate.getDate()
121
+ };
122
+ return toJapanese(oGregorian);
70
123
  };
124
+
125
+ /**
126
+ * Set the japanese era/year to this.oDate
127
+ */
71
128
  Japanese.prototype._setJapanese = function (oJapanese) {
72
- var oGregorian = toGregorian(oJapanese);
73
- return this.oDate.setFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
129
+ var oGregorian = toGregorian(oJapanese);
130
+ return this.oDate.setFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
74
131
  };
132
+
133
+ /**
134
+ * Get the japanese era/year from this.oDate in UTC
135
+ *
136
+ * @return {object}
137
+ */
75
138
  Japanese.prototype._getUTCJapanese = function () {
76
- var oGregorian = {
77
- year: this.oDate.getUTCFullYear(),
78
- month: this.oDate.getUTCMonth(),
79
- day: this.oDate.getUTCDate()
80
- };
81
- return toJapanese(oGregorian);
139
+ var oGregorian = {
140
+ year: this.oDate.getUTCFullYear(),
141
+ month: this.oDate.getUTCMonth(),
142
+ day: this.oDate.getUTCDate()
143
+ };
144
+ return toJapanese(oGregorian);
82
145
  };
146
+
147
+ /**
148
+ * Set the japanese era/year to this.oDate in UTC
149
+ */
83
150
  Japanese.prototype._setUTCJapanese = function (oJapanese) {
84
- var oGregorian = toGregorian(oJapanese);
85
- return this.oDate.setUTCFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
151
+ var oGregorian = toGregorian(oJapanese);
152
+ return this.oDate.setUTCFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
86
153
  };
154
+
155
+ /*
156
+ * Override relevant getters/setters
157
+ */
87
158
  Japanese.prototype.getYear = function () {
88
- return this._getJapanese().year;
159
+ return this._getJapanese().year;
89
160
  };
90
161
  Japanese.prototype.getFullYear = function () {
91
- return this._getJapanese().year;
162
+ return this._getJapanese().year;
92
163
  };
93
164
  Japanese.prototype.getEra = function () {
94
- return this._getJapanese().era;
165
+ return this._getJapanese().era;
95
166
  };
96
167
  Japanese.prototype.getUTCFullYear = function () {
97
- return this._getUTCJapanese().year;
168
+ return this._getUTCJapanese().year;
98
169
  };
99
170
  Japanese.prototype.getUTCEra = function () {
100
- return this._getUTCJapanese().era;
171
+ return this._getUTCJapanese().era;
101
172
  };
102
173
  Japanese.prototype.setYear = function (iYear) {
103
- var oJapanese = this._getJapanese();
104
- oJapanese.year = iYear;
105
- return this._setJapanese(oJapanese);
174
+ var oJapanese = this._getJapanese();
175
+ oJapanese.year = iYear;
176
+ return this._setJapanese(oJapanese);
106
177
  };
107
178
  Japanese.prototype.setFullYear = function (iYear, iMonth, iDay) {
108
- var oJapanese = this._getJapanese();
109
- oJapanese.year = iYear;
110
- if (iMonth !== undefined) {
111
- oJapanese.month = iMonth;
112
- }
113
- if (iDay !== undefined) {
114
- oJapanese.day = iDay;
115
- }
116
- return this._setJapanese(oJapanese);
179
+ var oJapanese = this._getJapanese();
180
+ oJapanese.year = iYear;
181
+ if (iMonth !== undefined) {
182
+ oJapanese.month = iMonth;
183
+ }
184
+ if (iDay !== undefined) {
185
+ oJapanese.day = iDay;
186
+ }
187
+ return this._setJapanese(oJapanese);
117
188
  };
118
189
  Japanese.prototype.setEra = function (iEra, iYear, iMonth, iDay) {
119
- var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra), oJapanese = toJapanese(oEraStartDate);
120
- if (iYear !== undefined) {
121
- oJapanese.year = iYear;
122
- }
123
- if (iMonth !== undefined) {
124
- oJapanese.month = iMonth;
125
- }
126
- if (iDay !== undefined) {
127
- oJapanese.day = iDay;
128
- }
129
- return this._setJapanese(oJapanese);
190
+ var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra),
191
+ oJapanese = toJapanese(oEraStartDate);
192
+ if (iYear !== undefined) {
193
+ oJapanese.year = iYear;
194
+ }
195
+ if (iMonth !== undefined) {
196
+ oJapanese.month = iMonth;
197
+ }
198
+ if (iDay !== undefined) {
199
+ oJapanese.day = iDay;
200
+ }
201
+ return this._setJapanese(oJapanese);
130
202
  };
131
203
  Japanese.prototype.setUTCFullYear = function (iYear, iMonth, iDay) {
132
- var oJapanese = this._getUTCJapanese();
133
- oJapanese.year = iYear;
134
- if (iMonth !== undefined) {
135
- oJapanese.month = iMonth;
136
- }
137
- if (iDay !== undefined) {
138
- oJapanese.day = iDay;
139
- }
140
- return this._setUTCJapanese(oJapanese);
204
+ var oJapanese = this._getUTCJapanese();
205
+ oJapanese.year = iYear;
206
+ if (iMonth !== undefined) {
207
+ oJapanese.month = iMonth;
208
+ }
209
+ if (iDay !== undefined) {
210
+ oJapanese.day = iDay;
211
+ }
212
+ return this._setUTCJapanese(oJapanese);
141
213
  };
142
214
  Japanese.prototype.setUTCEra = function (iEra, iYear, iMonth, iDay) {
143
- var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra), oJapanese = toJapanese(oEraStartDate);
144
- if (iYear !== undefined) {
145
- oJapanese.year = iYear;
146
- }
147
- if (iMonth !== undefined) {
148
- oJapanese.month = iMonth;
149
- }
150
- if (iDay !== undefined) {
151
- oJapanese.day = iDay;
152
- }
153
- return this._setUTCJapanese(oJapanese);
215
+ var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra),
216
+ oJapanese = toJapanese(oEraStartDate);
217
+ if (iYear !== undefined) {
218
+ oJapanese.year = iYear;
219
+ }
220
+ if (iMonth !== undefined) {
221
+ oJapanese.month = iMonth;
222
+ }
223
+ if (iDay !== undefined) {
224
+ oJapanese.day = iDay;
225
+ }
226
+ return this._setUTCJapanese(oJapanese);
154
227
  };
228
+
229
+ /**
230
+ * Note: The resulting year is the Gregorian year
231
+ *
232
+ * @override
233
+ * @see sap.ui.core.date.UniversalDate#getWeek
234
+ */
155
235
  Japanese.prototype.getWeek = function (oLocale, vCalendarWeekNumbering) {
156
- return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getFullYear(), this.getMonth(), this.getDate(), oLocale, vCalendarWeekNumbering);
236
+ // Use the Gregorian year (from this.oDate), because the Japanese emperor year lacks the
237
+ // information of the era which makes the year not unique.
238
+ // Using the Gregorian year is valid, because Japanese#constructor is able to calculate the
239
+ // era and Japanese emperor year from the Gregorian year.
240
+ return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getFullYear(), this.getMonth(), this.getDate(), oLocale, vCalendarWeekNumbering);
157
241
  };
242
+
243
+ /**
244
+ * Note: The resulting year is the Gregorian year
245
+ *
246
+ * @override
247
+ * @see sap.ui.core.date.UniversalDate#getUTCWeek
248
+ */
158
249
  Japanese.prototype.getUTCWeek = function (oLocale, vCalendarWeekNumbering) {
159
- return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), oLocale, vCalendarWeekNumbering);
250
+ // Use the Gregorian year (from this.oDate), because the Japanese emperor year lacks the
251
+ // information of the era which makes the year not unique.
252
+ // Using the Gregorian year is valid, because Japanese#constructor is able to calculate the
253
+ // era and Japanese emperor year from the Gregorian year.
254
+ return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), oLocale, vCalendarWeekNumbering);
160
255
  };
161
256
  _Calendars.set(CalendarType.Japanese, Japanese);
162
257
  export default Japanese;