@ui5/webcomponents-localization 0.0.0-e818f286e → 0.0.0-ebd9a4db3
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/.npsrc.json +3 -0
- package/CHANGELOG.md +1613 -0
- package/README.md +3 -5
- 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/Assets.d.ts +1 -0
- package/dist/Assets.js +1 -0
- package/dist/Assets.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 +5 -0
- package/dist/DateFormat.js +6 -2
- package/dist/DateFormat.js.map +1 -0
- package/dist/LocaleData.d.ts +5 -0
- package/dist/LocaleData.js +6 -2
- package/dist/LocaleData.js.map +1 -0
- package/dist/dates/CalendarDate.d.ts +42 -0
- package/dist/dates/CalendarDate.js +171 -207
- package/dist/dates/CalendarDate.js.map +1 -0
- package/dist/dates/ExtremeDates.d.ts +5 -0
- package/dist/dates/ExtremeDates.js +25 -35
- package/dist/dates/ExtremeDates.js.map +1 -0
- package/dist/dates/UI5Date.d.ts +5 -0
- package/dist/dates/UI5Date.js +7 -0
- package/dist/dates/UI5Date.js.map +1 -0
- package/dist/dates/UniversalDate.d.ts +47 -0
- package/dist/dates/UniversalDate.js +5 -0
- package/dist/dates/UniversalDate.js.map +1 -0
- package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js +15 -18
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
- package/dist/dates/getDaysInMonth.d.ts +3 -0
- package/dist/dates/getDaysInMonth.js +7 -8
- package/dist/dates/getDaysInMonth.js.map +1 -0
- package/dist/dates/getRoundedTimestamp.d.ts +7 -0
- package/dist/dates/getRoundedTimestamp.js +10 -9
- package/dist/dates/getRoundedTimestamp.js.map +1 -0
- package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
- package/dist/dates/getTodayUTCTimestamp.js +3 -3
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
- package/dist/dates/modifyDateBy.d.ts +14 -0
- package/dist/dates/modifyDateBy.js +42 -29
- package/dist/dates/modifyDateBy.js.map +1 -0
- package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
- package/dist/dates/transformDateToSecondaryType.js +13 -15
- package/dist/dates/transformDateToSecondaryType.js.map +1 -0
- package/dist/features/calendar/Buddhist.js +1 -0
- package/dist/features/calendar/Buddhist.js.map +1 -0
- package/dist/features/calendar/Gregorian.js +1 -0
- package/dist/features/calendar/Gregorian.js.map +1 -0
- package/dist/features/calendar/Islamic.js +1 -0
- package/dist/features/calendar/Islamic.js.map +1 -0
- package/dist/features/calendar/Japanese.js +1 -0
- package/dist/features/calendar/Japanese.js.map +1 -0
- package/dist/features/calendar/Persian.js +1 -0
- package/dist/features/calendar/Persian.js.map +1 -0
- package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
- package/dist/generated/assets/cldr/ar.json +1690 -511
- package/dist/generated/assets/cldr/ar_EG.json +1690 -511
- package/dist/generated/assets/cldr/ar_SA.json +1785 -607
- package/dist/generated/assets/cldr/bg.json +1663 -663
- package/dist/generated/assets/cldr/ca.json +1635 -550
- package/dist/generated/assets/cldr/cnr.json +6169 -0
- package/dist/generated/assets/cldr/cs.json +1618 -409
- package/dist/generated/assets/cldr/cy.json +1686 -640
- package/dist/generated/assets/cldr/da.json +1579 -542
- package/dist/generated/assets/cldr/de.json +1504 -374
- package/dist/generated/assets/cldr/de_AT.json +1494 -364
- package/dist/generated/assets/cldr/de_CH.json +1513 -383
- package/dist/generated/assets/cldr/el.json +1220 -273
- package/dist/generated/assets/cldr/el_CY.json +1220 -273
- package/dist/generated/assets/cldr/en.json +1619 -548
- package/dist/generated/assets/cldr/en_AU.json +1756 -636
- package/dist/generated/assets/cldr/en_GB.json +1630 -528
- package/dist/generated/assets/cldr/en_HK.json +1713 -608
- package/dist/generated/assets/cldr/en_IE.json +1678 -576
- package/dist/generated/assets/cldr/en_IN.json +1661 -555
- package/dist/generated/assets/cldr/en_NZ.json +1697 -595
- package/dist/generated/assets/cldr/en_PG.json +1698 -596
- package/dist/generated/assets/cldr/en_SG.json +1687 -582
- package/dist/generated/assets/cldr/en_ZA.json +1675 -573
- package/dist/generated/assets/cldr/es.json +1893 -704
- package/dist/generated/assets/cldr/es_AR.json +1835 -645
- package/dist/generated/assets/cldr/es_BO.json +1880 -690
- package/dist/generated/assets/cldr/es_CL.json +1721 -639
- package/dist/generated/assets/cldr/es_CO.json +1637 -554
- package/dist/generated/assets/cldr/es_MX.json +2050 -860
- package/dist/generated/assets/cldr/es_PE.json +1565 -591
- package/dist/generated/assets/cldr/es_UY.json +1593 -619
- package/dist/generated/assets/cldr/es_VE.json +1611 -637
- package/dist/generated/assets/cldr/et.json +1426 -368
- package/dist/generated/assets/cldr/fa.json +1548 -483
- package/dist/generated/assets/cldr/fi.json +1528 -343
- package/dist/generated/assets/cldr/fr.json +1435 -419
- package/dist/generated/assets/cldr/fr_BE.json +1432 -416
- package/dist/generated/assets/cldr/fr_CA.json +1571 -555
- package/dist/generated/assets/cldr/fr_CH.json +1385 -369
- package/dist/generated/assets/cldr/fr_LU.json +1435 -419
- package/dist/generated/assets/cldr/he.json +1697 -536
- package/dist/generated/assets/cldr/hi.json +1221 -193
- package/dist/generated/assets/cldr/hr.json +1760 -485
- package/dist/generated/assets/cldr/hu.json +1390 -303
- package/dist/generated/assets/cldr/id.json +1640 -570
- package/dist/generated/assets/cldr/it.json +1489 -455
- package/dist/generated/assets/cldr/it_CH.json +1489 -455
- package/dist/generated/assets/cldr/ja.json +1143 -86
- package/dist/generated/assets/cldr/kk.json +1782 -570
- package/dist/generated/assets/cldr/ko.json +1192 -162
- package/dist/generated/assets/cldr/lt.json +1383 -288
- package/dist/generated/assets/cldr/lv.json +1369 -369
- package/dist/generated/assets/cldr/mk.json +6045 -0
- package/dist/generated/assets/cldr/ms.json +1598 -551
- package/dist/generated/assets/cldr/nb.json +1265 -209
- package/dist/generated/assets/cldr/nl.json +1741 -425
- package/dist/generated/assets/cldr/nl_BE.json +1741 -425
- package/dist/generated/assets/cldr/pl.json +1903 -492
- package/dist/generated/assets/cldr/pt.json +1913 -605
- package/dist/generated/assets/cldr/pt_PT.json +1871 -633
- package/dist/generated/assets/cldr/ro.json +1590 -482
- package/dist/generated/assets/cldr/ru.json +1608 -514
- package/dist/generated/assets/cldr/ru_UA.json +1602 -508
- package/dist/generated/assets/cldr/sk.json +1629 -569
- package/dist/generated/assets/cldr/sl.json +1532 -430
- package/dist/generated/assets/cldr/sr.json +1459 -346
- package/dist/generated/assets/cldr/sr_Latn.json +2088 -991
- package/dist/generated/assets/cldr/sv.json +1508 -445
- package/dist/generated/assets/cldr/th.json +1313 -237
- package/dist/generated/assets/cldr/tr.json +1549 -436
- package/dist/generated/assets/cldr/uk.json +1619 -520
- package/dist/generated/assets/cldr/vi.json +1423 -429
- package/dist/generated/assets/cldr/zh_CN.json +1425 -342
- package/dist/generated/assets/cldr/zh_HK.json +1396 -312
- package/dist/generated/assets/cldr/zh_SG.json +1401 -317
- package/dist/generated/assets/cldr/zh_TW.json +1256 -193
- 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.d.ts +4 -0
- package/dist/getCachedLocaleDataInstance.js +6 -9
- package/dist/getCachedLocaleDataInstance.js.map +1 -0
- package/dist/locale/getLocaleData.d.ts +11 -0
- package/dist/locale/getLocaleData.js +13 -17
- package/dist/locale/getLocaleData.js.map +1 -0
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +2 -240
- package/dist/sap/base/assert.js +31 -5
- 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 +173 -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 +43 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +105 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +319 -0
- package/dist/sap/base/strings/camelize.js +30 -0
- package/dist/sap/base/strings/formatMessage.js +88 -15
- package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
- package/dist/sap/base/util/LoaderExtensions.js +9 -12
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
- 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 +435 -171
- package/dist/sap/ui/base/Object.js +284 -48
- package/dist/sap/ui/core/CalendarType.js +24 -8
- package/dist/sap/ui/core/Configuration.d.ts +17 -0
- package/dist/sap/ui/core/Configuration.js +23 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +25 -0
- package/dist/sap/ui/core/Core.js +7 -34
- package/dist/sap/ui/core/Core.js.map +1 -0
- package/dist/sap/ui/core/FormatSettings.d.ts +9 -0
- package/dist/sap/ui/core/FormatSettings.js +12 -0
- package/dist/sap/ui/core/FormatSettings.js.map +1 -0
- package/dist/sap/ui/core/Locale.js +190 -152
- package/dist/sap/ui/core/LocaleData.js +2665 -1228
- 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 -93
- package/dist/sap/ui/core/date/CalendarUtils.js +65 -0
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -0
- 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 +212 -117
- package/dist/sap/ui/core/date/Persian.js +324 -195
- package/dist/sap/ui/core/date/UI5Date.js +991 -0
- package/dist/sap/ui/core/date/UniversalDate.js +1251 -217
- package/dist/sap/ui/core/date/_Calendars.js +10 -1
- package/dist/sap/ui/core/format/DateFormat.js +3139 -1965
- package/dist/sap/ui/core/format/TimezoneUtil.js +24 -83
- package/package-scripts.cjs +28 -0
- package/package.json +14 -6
- package/tsconfig.json +24 -0
- package/used-modules.txt +27 -2
- package/dist/Assets-static.js +0 -2
- package/dist/dates/calculateWeekNumber.js +0 -51
- package/dist/generated/json-imports/LocaleData-static.js +0 -90
- package/dist/sap/ui/Device.js +0 -5
- package/package-scripts.js +0 -35
- package/src/Assets-static.js +0 -2
- package/src/Assets.js +0 -2
- package/src/DateFormat.js +0 -3
- package/src/LocaleData.js +0 -3
- package/src/dates/CalendarDate.js +0 -229
- package/src/dates/ExtremeDates.js +0 -39
- package/src/dates/calculateWeekNumber.js +0 -51
- package/src/dates/convertMonthNumbersToMonthNames.js +0 -33
- package/src/dates/getDaysInMonth.js +0 -11
- package/src/dates/getRoundedTimestamp.js +0 -14
- package/src/dates/getTodayUTCTimestamp.js +0 -9
- package/src/dates/modifyDateBy.js +0 -42
- package/src/dates/transformDateToSecondaryType.js +0 -20
- package/src/getCachedLocaleDataInstance.js +0 -13
- package/src/locale/getLocaleData.js +0 -27
- package/src/sap/base/util/LoaderExtensions.js +0 -17
- package/src/sap/ui/core/Core.js +0 -40
- /package/{config/.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/{src/features/calendar/Buddhist.js → dist/features/calendar/Buddhist.d.ts} +0 -0
- /package/{src/features/calendar/Gregorian.js → dist/features/calendar/Gregorian.d.ts} +0 -0
- /package/{src/features/calendar/Islamic.js → dist/features/calendar/Islamic.d.ts} +0 -0
- /package/{src/features/calendar/Japanese.js → dist/features/calendar/Japanese.d.ts} +0 -0
- /package/{src/features/calendar/Persian.js → dist/features/calendar/Persian.d.ts} +0 -0
@@ -1,219 +1,183 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import UI5Date from "./UI5Date.js";
|
2
|
+
import UniversalDate from "./UniversalDate.js";
|
3
3
|
class CalendarDate {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
}
|
160
|
-
|
161
|
-
valueOf() {
|
162
|
-
return this._oUDate.getTime();
|
163
|
-
}
|
164
|
-
|
165
|
-
static fromLocalJSDate(oJSDate, sCalendarType) {
|
166
|
-
// Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests
|
167
|
-
// because Date object in the test is different than the Date object in the application (due to the iframe).
|
168
|
-
// We can use jQuery.type or this method:
|
169
|
-
function isValidDate(date) {
|
170
|
-
return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date); // eslint-disable-line
|
171
|
-
}
|
172
|
-
if (!isValidDate(oJSDate)) {
|
173
|
-
throw new Error(`Date parameter must be a JavaScript Date object: [${oJSDate}].`);
|
174
|
-
}
|
175
|
-
return new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);
|
176
|
-
}
|
177
|
-
|
178
|
-
static fromTimestamp(iTimestamp, sCalendarType) {
|
179
|
-
const oCalDate = new CalendarDate(0, 0, 1);
|
180
|
-
let oUDate;
|
181
|
-
try {
|
182
|
-
oUDate = UniversalDate.getInstance(new Date(iTimestamp), sCalendarType);
|
183
|
-
} catch (e) {
|
184
|
-
oUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior
|
185
|
-
}
|
186
|
-
oCalDate._oUDate = oUDate;
|
187
|
-
return oCalDate;
|
188
|
-
}
|
4
|
+
constructor(year, month, date, calendarType) {
|
5
|
+
let aArgs = arguments, // eslint-disable-line
|
6
|
+
oJSDate, oNow, sCalendarType;
|
7
|
+
switch (aArgs.length) {
|
8
|
+
case 0: // defaults to the current date
|
9
|
+
oNow = UI5Date.getInstance();
|
10
|
+
return this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate());
|
11
|
+
case 1: // CalendarDate
|
12
|
+
case 2: // CalendarDate, sCalendarType
|
13
|
+
if (!(aArgs[0] instanceof CalendarDate)) {
|
14
|
+
throw new Error("Invalid arguments: the first argument must be of type CalendarDate.");
|
15
|
+
}
|
16
|
+
sCalendarType = aArgs[1] ? aArgs[1] : aArgs[0]._oUDate.sCalendarType;
|
17
|
+
// Use source.valueOf() (returns the same point of time regardless calendar type) instead of
|
18
|
+
// source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date
|
19
|
+
oJSDate = UI5Date.getInstance(aArgs[0].valueOf());
|
20
|
+
// Make this date really local. Now getters are safe.
|
21
|
+
oJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());
|
22
|
+
oJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());
|
23
|
+
this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
|
24
|
+
break;
|
25
|
+
case 3: // year, month, date
|
26
|
+
case 4: // year, month, date, sCalendarType
|
27
|
+
checkNumericLike(aArgs[0], `Invalid year: ${aArgs[0]}`);
|
28
|
+
checkNumericLike(aArgs[1], `Invalid month: ${aArgs[1]}`);
|
29
|
+
checkNumericLike(aArgs[2], `Invalid date: ${aArgs[2]}`);
|
30
|
+
oJSDate = UI5Date.getInstance(0, 0, 1);
|
31
|
+
oJSDate.setFullYear(aArgs[0], aArgs[1], aArgs[2]); // 2 digits year is not supported. If so, it is considered as full year as well.
|
32
|
+
if (aArgs[3]) {
|
33
|
+
sCalendarType = aArgs[3];
|
34
|
+
}
|
35
|
+
this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
|
36
|
+
break;
|
37
|
+
default:
|
38
|
+
throw new Error(`${"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType"
|
39
|
+
+ "or 2) year, month, date, (optional) calendarType"}${aArgs}`);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
getYear() {
|
43
|
+
return this._oUDate.getUTCFullYear();
|
44
|
+
}
|
45
|
+
setYear(year) {
|
46
|
+
checkNumericLike(year, `Invalid year: ${year}`);
|
47
|
+
this._oUDate.setUTCFullYear(year);
|
48
|
+
return this;
|
49
|
+
}
|
50
|
+
getMonth() {
|
51
|
+
return this._oUDate.getUTCMonth();
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Sets the given month as ordinal month of the year.
|
55
|
+
* @param {int} month An integer between 0 and 11, representing the months January through December( or their
|
56
|
+
* equivalent month names for the given calendar).
|
57
|
+
* If the specified value is is outside of the expected range, this method attempts to update the date information
|
58
|
+
* accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
|
59
|
+
* @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
|
60
|
+
* 0 will result in the previous month's last day.
|
61
|
+
* -1 will result in the day before the previous month's last day.
|
62
|
+
* 32 will result in:
|
63
|
+
* - first day of the next month if the current month has 31 days.
|
64
|
+
* - second day of the next month if the current month has 30 days.
|
65
|
+
* Other value will result in adding or subtracting days according to the given value.
|
66
|
+
* @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
|
67
|
+
*/
|
68
|
+
setMonth(month, date) {
|
69
|
+
checkNumericLike(month, `Invalid month: ${month}`);
|
70
|
+
if (date || date === 0) {
|
71
|
+
checkNumericLike(date, `Invalid date: ${date}`);
|
72
|
+
this._oUDate.setUTCMonth(month, date);
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
this._oUDate.setUTCMonth(month);
|
76
|
+
}
|
77
|
+
return this;
|
78
|
+
}
|
79
|
+
getDate() {
|
80
|
+
return this._oUDate.getUTCDate();
|
81
|
+
}
|
82
|
+
setDate(date) {
|
83
|
+
checkNumericLike(date, `Invalid date: ${date}`);
|
84
|
+
this._oUDate.setUTCDate(date);
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
getDay() {
|
88
|
+
return this._oUDate.getUTCDay();
|
89
|
+
}
|
90
|
+
getCalendarType() {
|
91
|
+
return this._oUDate.sCalendarType;
|
92
|
+
}
|
93
|
+
isBefore(oCalendarDate) {
|
94
|
+
checkCalendarDate(oCalendarDate);
|
95
|
+
return this.valueOf() < oCalendarDate.valueOf();
|
96
|
+
}
|
97
|
+
isAfter(oCalendarDate) {
|
98
|
+
checkCalendarDate(oCalendarDate);
|
99
|
+
return this.valueOf() > oCalendarDate.valueOf();
|
100
|
+
}
|
101
|
+
isSameOrBefore(oCalendarDate) {
|
102
|
+
checkCalendarDate(oCalendarDate);
|
103
|
+
return this.valueOf() <= oCalendarDate.valueOf();
|
104
|
+
}
|
105
|
+
isSameOrAfter(oCalendarDate) {
|
106
|
+
checkCalendarDate(oCalendarDate);
|
107
|
+
return this.valueOf() >= oCalendarDate.valueOf();
|
108
|
+
}
|
109
|
+
isSame(oCalendarDate) {
|
110
|
+
checkCalendarDate(oCalendarDate);
|
111
|
+
return this.valueOf() === oCalendarDate.valueOf();
|
112
|
+
}
|
113
|
+
toLocalJSDate() {
|
114
|
+
// Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
|
115
|
+
// this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
|
116
|
+
const oLocalDate = UI5Date.getInstance(this._oUDate.getTime());
|
117
|
+
// Make this date really local. Now getters are safe.
|
118
|
+
oLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());
|
119
|
+
oLocalDate.setHours(0, 0, 0, 0);
|
120
|
+
return oLocalDate;
|
121
|
+
}
|
122
|
+
toUTCJSDate() {
|
123
|
+
// Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
|
124
|
+
// this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
|
125
|
+
const oUTCDate = UI5Date.getInstance(this._oUDate.getTime());
|
126
|
+
oUTCDate.setUTCHours(0, 0, 0, 0);
|
127
|
+
return oUTCDate;
|
128
|
+
}
|
129
|
+
toString() {
|
130
|
+
return `${this._oUDate.sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;
|
131
|
+
}
|
132
|
+
valueOf() {
|
133
|
+
return this._oUDate.getTime();
|
134
|
+
}
|
135
|
+
static fromLocalJSDate(oJSDate, sCalendarType) {
|
136
|
+
// Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests
|
137
|
+
// because Date object in the test is different than the Date object in the application (due to the iframe).
|
138
|
+
// We can use jQuery.type or this method:
|
139
|
+
function isValidDate(date) {
|
140
|
+
return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date); // eslint-disable-line
|
141
|
+
}
|
142
|
+
if (!isValidDate(oJSDate)) {
|
143
|
+
throw new Error(`Date parameter must be a JavaScript Date object: [${oJSDate}].`);
|
144
|
+
}
|
145
|
+
return new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);
|
146
|
+
}
|
147
|
+
static fromTimestamp(iTimestamp, sCalendarType) {
|
148
|
+
const oCalDate = new CalendarDate(0, 0, 1);
|
149
|
+
let oUDate;
|
150
|
+
try {
|
151
|
+
oUDate = UniversalDate.getInstance(UI5Date.getInstance(iTimestamp), sCalendarType);
|
152
|
+
}
|
153
|
+
catch (e) {
|
154
|
+
oUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior
|
155
|
+
}
|
156
|
+
oCalDate._oUDate = oUDate;
|
157
|
+
return oCalDate;
|
158
|
+
}
|
189
159
|
}
|
190
|
-
|
191
160
|
function createUniversalUTCDate(oDate, sCalendarType) {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
161
|
+
if (sCalendarType) {
|
162
|
+
return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
|
163
|
+
}
|
164
|
+
return new UniversalDate(createUTCDate(oDate).getTime());
|
196
165
|
}
|
197
|
-
|
198
166
|
/**
|
199
167
|
* Creates a JavaScript UTC Date corresponding to the given JavaScript Date.
|
200
168
|
* @param {Date} oDate JavaScript date object. Time related information is cut.
|
201
169
|
* @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
|
202
170
|
*/
|
203
171
|
function createUTCDate(oDate) {
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
return oUTCDate;
|
172
|
+
const oUTCDate = new Date(Date.UTC(0, 0, 1)); // no need to replace with UI5Date as we are creating a new UTC date object
|
173
|
+
oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());
|
174
|
+
return oUTCDate;
|
209
175
|
}
|
210
|
-
|
211
176
|
function checkCalendarDate(oCalendarDate) {
|
212
|
-
|
213
|
-
|
214
|
-
|
177
|
+
if (!(oCalendarDate instanceof CalendarDate)) {
|
178
|
+
throw new Error(`Invalid calendar date: [${oCalendarDate}]. Expected: CalendarDate`);
|
179
|
+
}
|
215
180
|
}
|
216
|
-
|
217
181
|
/**
|
218
182
|
* Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not.
|
219
183
|
* @param {any} value The value of any type to check. If null or undefined, this method throws an error.
|
@@ -221,9 +185,9 @@ function checkCalendarDate(oCalendarDate) {
|
|
221
185
|
* @throws will throw an error if the value is null or undefined or is not like a number
|
222
186
|
*/
|
223
187
|
function checkNumericLike(value, message) {
|
224
|
-
|
225
|
-
|
226
|
-
|
188
|
+
if (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line
|
189
|
+
throw message;
|
190
|
+
}
|
227
191
|
}
|
228
|
-
|
229
192
|
export default CalendarDate;
|
193
|
+
//# sourceMappingURL=CalendarDate.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CalendarDate.js","sourceRoot":"","sources":["../../src/dates/CalendarDate.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,YAAY;IAGjB,YAAY,IAA4B,EAAE,KAAuB,EAAE,IAAa,EAAE,YAAqB;QACtG,IAAI,KAAK,GAAG,SAAS,EAAE,sBAAsB;QAC5C,OAAuB,EACvB,IAAoB,EACpB,aAA4B,CAAC;QAE9B,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACvB,KAAK,CAAC,EAAE,+BAA+B;gBACtC,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC7B,OAAQ,IAAI,CAA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AAC,KAAqB;IAC3C,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,2EAA2E;IAEzH,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAEhF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,SAAS,iBAAiB,CAAC,aAA2B;IACrD,IAAI,CAAC,CAAC,aAAa,YAAY,YAAY,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,2BAA2B,aAAkC,2BAA2B,CAAC,CAAC;IAC3G,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,KAAU,EAAE,OAAe;IACpD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,sBAAsB;QACtF,MAAM,OAAO,CAAC;IACf,CAAC;AACF,CAAC;AAED,eAAe,YAAY,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport UI5Date from \"./UI5Date.js\";\nimport UniversalDate from \"./UniversalDate.js\";\n\nclass CalendarDate {\n\t_oUDate!: UI5Date | Date | UniversalDate;\n\n\tconstructor(year?: number | CalendarDate, month?: number | string, date?: number, calendarType?: string) { // eslint-disable-line\n\t\tlet aArgs = arguments, // eslint-disable-line\n\t\t\toJSDate: UI5Date | Date,\n\t\t\toNow: UI5Date | Date,\n\t\t\tsCalendarType!: CalendarType;\n\n\t\tswitch (aArgs.length) {\n\t\tcase 0: // defaults to the current date\n\t\t\toNow = UI5Date.getInstance();\n\t\t\treturn (this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate()) as CalendarDate);\n\n\t\tcase 1: // CalendarDate\n\t\tcase 2: // CalendarDate, sCalendarType\n\t\t\tif (!(aArgs[0] instanceof CalendarDate)) {\n\t\t\t\tthrow new Error(\"Invalid arguments: the first argument must be of type CalendarDate.\");\n\t\t\t}\n\t\t\tsCalendarType = aArgs[1] ? aArgs[1] : (aArgs[0]._oUDate as UniversalDate).sCalendarType;\n\t\t\t// Use source.valueOf() (returns the same point of time regardless calendar type) instead of\n\t\t\t// source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date\n\t\t\toJSDate = UI5Date.getInstance(aArgs[0].valueOf());\n\n\t\t\t// Make this date really local. Now getters are safe.\n\t\t\toJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());\n\t\t\toJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());\n\n\t\t\tthis._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);\n\t\t\tbreak;\n\n\t\tcase 3: // year, month, date\n\t\tcase 4: // year, month, date, sCalendarType\n\t\t\tcheckNumericLike(aArgs[0] as number, `Invalid year: ${aArgs[0] as number}`);\n\t\t\tcheckNumericLike(aArgs[1] as number, `Invalid month: ${aArgs[1] as number}`);\n\t\t\tcheckNumericLike(aArgs[2] as number, `Invalid date: ${aArgs[2] as number}`);\n\n\t\t\toJSDate = UI5Date.getInstance(0, 0, 1);\n\t\t\toJSDate.setFullYear(aArgs[0] as number, aArgs[1] as number, aArgs[2] as number); // 2 digits year is not supported. If so, it is considered as full year as well.\n\n\t\t\tif (aArgs[3]) {\n\t\t\t\tsCalendarType = aArgs[3];\n\t\t\t}\n\t\t\tthis._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tthrow new Error(`${\"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType\"\n\t\t\t\t+ \"or 2) year, month, date, (optional) calendarType\"}${aArgs as unknown as string}`);\n\t\t}\n\t}\n\n\tgetYear() {\n\t\treturn this._oUDate.getUTCFullYear();\n\t}\n\n\tsetYear(year: number) {\n\t\tcheckNumericLike(year, `Invalid year: ${year}`);\n\t\tthis._oUDate.setUTCFullYear(year);\n\t\treturn this;\n\t}\n\n\tgetMonth() {\n\t\treturn this._oUDate.getUTCMonth();\n\t}\n\n\t/**\n\t * Sets the given month as ordinal month of the year.\n\t * @param {int} month An integer between 0 and 11, representing the months January through December( or their\n\t * equivalent month names for the given calendar).\n\t * If the specified value is is outside of the expected range, this method attempts to update the date information\n\t * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.\n\t * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.\n\t * 0 will result in the previous month's last day.\n\t * -1 will result in the day before the previous month's last day.\n\t * 32 will result in:\n\t * - first day of the next month if the current month has 31 days.\n\t * - second day of the next month if the current month has 30 days.\n\t * Other value will result in adding or subtracting days according to the given value.\n\t * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.\n\t */\n\tsetMonth(month: number, date?: number) {\n\t\tcheckNumericLike(month, `Invalid month: ${month}`);\n\t\tif (date || date === 0) {\n\t\t\tcheckNumericLike(date, `Invalid date: ${date}`);\n\t\t\tthis._oUDate.setUTCMonth(month, date);\n\t\t} else {\n\t\t\tthis._oUDate.setUTCMonth(month);\n\t\t}\n\t\treturn this;\n\t}\n\n\tgetDate() {\n\t\treturn this._oUDate.getUTCDate();\n\t}\n\n\tsetDate(date: number) {\n\t\tcheckNumericLike(date, `Invalid date: ${date}`);\n\t\tthis._oUDate.setUTCDate(date);\n\t\treturn this;\n\t}\n\n\tgetDay() {\n\t\treturn this._oUDate.getUTCDay();\n\t}\n\n\tgetCalendarType() {\n\t\treturn (this._oUDate as UniversalDate).sCalendarType;\n\t}\n\n\tisBefore(oCalendarDate: CalendarDate) {\n\t\tcheckCalendarDate(oCalendarDate);\n\t\treturn this.valueOf() < oCalendarDate.valueOf();\n\t}\n\n\tisAfter(oCalendarDate: CalendarDate) {\n\t\tcheckCalendarDate(oCalendarDate);\n\t\treturn this.valueOf() > oCalendarDate.valueOf();\n\t}\n\n\tisSameOrBefore(oCalendarDate: CalendarDate) {\n\t\tcheckCalendarDate(oCalendarDate);\n\t\treturn this.valueOf() <= oCalendarDate.valueOf();\n\t}\n\n\tisSameOrAfter(oCalendarDate: CalendarDate) {\n\t\tcheckCalendarDate(oCalendarDate);\n\t\treturn this.valueOf() >= oCalendarDate.valueOf();\n\t}\n\n\tisSame(oCalendarDate: CalendarDate) {\n\t\tcheckCalendarDate(oCalendarDate);\n\t\treturn this.valueOf() === oCalendarDate.valueOf();\n\t}\n\n\ttoLocalJSDate() {\n\t\t// Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of\n\t\t// this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date\n\t\tconst oLocalDate = UI5Date.getInstance(this._oUDate.getTime());\n\n\t\t// Make this date really local. Now getters are safe.\n\t\toLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());\n\t\toLocalDate.setHours(0, 0, 0, 0);\n\n\t\treturn oLocalDate;\n\t}\n\n\ttoUTCJSDate() {\n\t\t// Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of\n\t\t// this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date\n\t\tconst oUTCDate = UI5Date.getInstance(this._oUDate.getTime());\n\t\toUTCDate.setUTCHours(0, 0, 0, 0);\n\n\t\treturn oUTCDate;\n\t}\n\n\ttoString() {\n\t\treturn `${(this._oUDate as UniversalDate).sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;\n\t}\n\n\tvalueOf() {\n\t\treturn this._oUDate.getTime();\n\t}\n\n\tstatic fromLocalJSDate(oJSDate: Date | UI5Date, sCalendarType?: `${CalendarType}`) {\n\t\t// Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests\n\t\t// because Date object in the test is different than the Date object in the application (due to the iframe).\n\t\t// We can use jQuery.type or this method:\n\t\tfunction isValidDate(date: Date | UI5Date) {\n\t\t\treturn date && Object.prototype.toString.call(date) === \"[object Date]\" && !isNaN(date as unknown as number); // eslint-disable-line\n\t\t}\n\t\tif (!isValidDate(oJSDate)) {\n\t\t\tthrow new Error(`Date parameter must be a JavaScript Date object: [${oJSDate as unknown as string}].`);\n\t\t}\n\t\treturn new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);\n\t}\n\n\tstatic fromTimestamp(iTimestamp: number, sCalendarType?: `${CalendarType}`) {\n\t\tconst oCalDate = new CalendarDate(0, 0, 1);\n\t\tlet oUDate;\n\t\ttry {\n\t\t\toUDate = UniversalDate.getInstance(UI5Date.getInstance(iTimestamp), sCalendarType);\n\t\t} catch (e) {\n\t\t\toUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior\n\t\t}\n\t\toCalDate._oUDate = oUDate;\n\t\treturn oCalDate;\n\t}\n}\n\nfunction createUniversalUTCDate(oDate: UI5Date | Date, sCalendarType: `${CalendarType}`) {\n\tif (sCalendarType) {\n\t\treturn UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);\n\t}\n\treturn new UniversalDate(createUTCDate(oDate).getTime());\n}\n\n/**\n * Creates a JavaScript UTC Date corresponding to the given JavaScript Date.\n * @param {Date} oDate JavaScript date object. Time related information is cut.\n * @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.\n */\nfunction createUTCDate(oDate: UI5Date | Date) {\n\tconst oUTCDate = new Date(Date.UTC(0, 0, 1)); // no need to replace with UI5Date as we are creating a new UTC date object\n\n\toUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());\n\n\treturn oUTCDate;\n}\n\nfunction checkCalendarDate(oCalendarDate: CalendarDate) {\n\tif (!(oCalendarDate instanceof CalendarDate)) {\n\t\tthrow new Error(`Invalid calendar date: [${oCalendarDate as unknown as string}]. Expected: CalendarDate`);\n\t}\n}\n\n/**\n * Verifies the given value is numeric like, i.e. 3, \"3\" and throws an error if it is not.\n * @param {any} value The value of any type to check. If null or undefined, this method throws an error.\n * @param {string} message The message to be used if an error is to be thrown\n * @throws will throw an error if the value is null or undefined or is not like a number\n */\nfunction checkNumericLike(value: any, message: string) {\n\tif (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line\n\t\tthrow message;\n\t}\n}\n\nexport default CalendarDate;\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
2
|
+
import CalendarDate from "./CalendarDate.js";
|
3
|
+
declare const getMinCalendarDate: (primaryCalendarType: `${CalendarType}`) => CalendarDate;
|
4
|
+
declare const getMaxCalendarDate: (primaryCalendarType: `${CalendarType}`) => CalendarDate;
|
5
|
+
export { getMinCalendarDate, getMaxCalendarDate, };
|
@@ -1,39 +1,29 @@
|
|
1
1
|
import CalendarDate from "./CalendarDate.js";
|
2
|
-
|
3
2
|
const cache = new Map();
|
4
|
-
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
15
|
-
|
16
|
-
return cache.get(key);
|
3
|
+
const getMinCalendarDate = (primaryCalendarType) => {
|
4
|
+
const key = `min ${primaryCalendarType}`;
|
5
|
+
if (!cache.has(key)) {
|
6
|
+
const minDate = new CalendarDate(1, 0, 1, primaryCalendarType);
|
7
|
+
minDate.setYear(1);
|
8
|
+
minDate.setMonth(0);
|
9
|
+
minDate.setDate(1);
|
10
|
+
cache.set(key, minDate);
|
11
|
+
}
|
12
|
+
return cache.get(key);
|
17
13
|
};
|
18
|
-
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
return cache.get(key);
|
34
|
-
};
|
35
|
-
|
36
|
-
export {
|
37
|
-
getMinCalendarDate,
|
38
|
-
getMaxCalendarDate,
|
14
|
+
const getMaxCalendarDate = (primaryCalendarType) => {
|
15
|
+
const key = `max ${primaryCalendarType}`;
|
16
|
+
if (!cache.has(key)) {
|
17
|
+
const maxDate = new CalendarDate(1, 0, 1, primaryCalendarType);
|
18
|
+
maxDate.setYear(9999);
|
19
|
+
maxDate.setMonth(11);
|
20
|
+
const tempDate = new CalendarDate(maxDate, primaryCalendarType);
|
21
|
+
tempDate.setDate(1);
|
22
|
+
tempDate.setMonth(tempDate.getMonth() + 1, 0);
|
23
|
+
maxDate.setDate(tempDate.getDate()); // 31st for Gregorian Calendar
|
24
|
+
cache.set(key, maxDate);
|
25
|
+
}
|
26
|
+
return cache.get(key);
|
39
27
|
};
|
28
|
+
export { getMinCalendarDate, getMaxCalendarDate, };
|
29
|
+
//# sourceMappingURL=ExtremeDates.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExtremeDates.js","sourceRoot":"","sources":["../../src/dates/ExtremeDates.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAC;AAE9C,MAAM,kBAAkB,GAAG,CAAC,mBAAsC,EAAE,EAAE;IACrE,MAAM,GAAG,GAAG,OAAO,mBAAmB,EAAE,CAAC;IAEzC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC/D,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,mBAAsC,EAAE,EAAE;IACrE,MAAM,GAAG,GAAG,OAAO,mBAAmB,EAAE,CAAC;IAEzC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC/D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAChE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACpB,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA,8BAA8B;QAClE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,EACN,kBAAkB,EAClB,kBAAkB,GAClB,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport CalendarDate from \"./CalendarDate.js\";\n\nconst cache = new Map<string, CalendarDate>();\n\nconst getMinCalendarDate = (primaryCalendarType: `${CalendarType}`) => {\n\tconst key = `min ${primaryCalendarType}`;\n\n\tif (!cache.has(key)) {\n\t\tconst minDate = new CalendarDate(1, 0, 1, primaryCalendarType);\n\t\tminDate.setYear(1);\n\t\tminDate.setMonth(0);\n\t\tminDate.setDate(1);\n\t\tcache.set(key, minDate);\n\t}\n\n\treturn cache.get(key)!;\n};\n\nconst getMaxCalendarDate = (primaryCalendarType: `${CalendarType}`) => {\n\tconst key = `max ${primaryCalendarType}`;\n\n\tif (!cache.has(key)) {\n\t\tconst maxDate = new CalendarDate(1, 0, 1, primaryCalendarType);\n\t\tmaxDate.setYear(9999);\n\t\tmaxDate.setMonth(11);\n\t\tconst tempDate = new CalendarDate(maxDate, primaryCalendarType);\n\t\ttempDate.setDate(1);\n\t\ttempDate.setMonth(tempDate.getMonth() + 1, 0);\n\t\tmaxDate.setDate(tempDate.getDate());// 31st for Gregorian Calendar\n\t\tcache.set(key, maxDate);\n\t}\n\n\treturn cache.get(key)!;\n};\n\nexport {\n\tgetMinCalendarDate,\n\tgetMaxCalendarDate,\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UI5Date.js","sourceRoot":"","sources":["../../src/dates/UI5Date.ts"],"names":[],"mappings":"AACA,aAAa;AACb,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D,MAAM,cAAc,GAAG,aAA+B,CAAC;AACvD,MAAM,OAAQ,SAAQ,cAAc;CAAG;AAEvC,eAAe,OAAO,CAAC","sourcesContent":["import type UIDateT from \"sap/ui/core/date/UI5Date\";\n// @ts-ignore\nimport UI5DateNative from \"../sap/ui/core/date/UI5Date.js\";\n\nconst UI5DateWrapped = UI5DateNative as typeof UIDateT;\nclass UI5Date extends UI5DateWrapped {}\n\nexport default UI5Date;\n"]}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
2
|
+
import type UI5Date from "./UI5Date.js";
|
3
|
+
type UniversalDate = {
|
4
|
+
new (time: number): UniversalDate;
|
5
|
+
oDate: Date;
|
6
|
+
sCalendarType: string;
|
7
|
+
getInstance: (oDate: UI5Date | Date, sCalendarType?: `${CalendarType}`) => UniversalDate;
|
8
|
+
getDate: () => number;
|
9
|
+
getMonth: () => number;
|
10
|
+
getFullYear: () => number;
|
11
|
+
getYear: () => number;
|
12
|
+
getDay: () => number;
|
13
|
+
getHours: () => number;
|
14
|
+
getMinutes: () => number;
|
15
|
+
getSeconds: () => number;
|
16
|
+
getMilliseconds: () => number;
|
17
|
+
getUTCDate: () => number;
|
18
|
+
getUTCMonth: () => number;
|
19
|
+
getUTCFullYear: () => number;
|
20
|
+
getUTCDay: () => number;
|
21
|
+
getUTCHours: () => number;
|
22
|
+
getUTCMinutes: () => number;
|
23
|
+
getUTCSeconds: () => number;
|
24
|
+
getUTCMilliseconds: () => number;
|
25
|
+
getTime: () => number;
|
26
|
+
valueOf: () => number;
|
27
|
+
getTimezoneOffset: () => number;
|
28
|
+
toString: () => string;
|
29
|
+
toDateString: () => string;
|
30
|
+
setDate: (dayValue: number) => number;
|
31
|
+
setFullYear: (yearValue: number, monthValue?: number, dateValue?: number) => number;
|
32
|
+
setYear: (yearValue: number) => number;
|
33
|
+
setMonth: (monthValue: number, dayValue?: number) => number;
|
34
|
+
setHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number;
|
35
|
+
setMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number;
|
36
|
+
setSeconds: (secondsValue: number, msValue?: number) => number;
|
37
|
+
setMilliseconds: (setMilliseconds: number) => number;
|
38
|
+
setUTCDate: (dayValue: number) => number;
|
39
|
+
setUTCFullYear: (yearValue: number, monthValue?: number, dayValue?: number) => number;
|
40
|
+
setUTCMonth: (monthValue: number, dayValue?: number) => number;
|
41
|
+
setUTCHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number;
|
42
|
+
setUTCMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number;
|
43
|
+
setUTCSeconds: (secondsValue: number, msValue?: number) => number;
|
44
|
+
setUTCMilliseconds: (setMilliseconds: number) => number;
|
45
|
+
};
|
46
|
+
declare const UniversalDate: UniversalDate;
|
47
|
+
export default UniversalDate;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UniversalDate.js","sourceRoot":"","sources":["../../src/dates/UniversalDate.ts"],"names":[],"mappings":"AACA,aAAa;AACb,OAAO,mBAAmB,MAAM,sCAAsC,CAAC;AA+CvE,MAAM,aAAa,GAAkB,mBAAmB,CAAC;AAEzD,eAAe,aAAa,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\n// @ts-ignore\nimport UniversalDateNative from \"../sap/ui/core/date/UniversalDate.js\";\nimport type UI5Date from \"./UI5Date.js\";\n\ntype UniversalDate = {\n new (time: number): UniversalDate;\n oDate: Date,\n sCalendarType: string,\n getInstance: (oDate: UI5Date | Date, sCalendarType?: `${CalendarType}`) => UniversalDate,\n getDate: () => number,\n getMonth: () => number,\n getFullYear: () => number,\n getYear: () => number,\n getDay: () => number,\n getHours: () => number,\n getMinutes: () => number,\n getSeconds: () => number,\n getMilliseconds: () => number,\n getUTCDate: () => number,\n getUTCMonth: () => number,\n getUTCFullYear: () => number,\n getUTCDay: () => number,\n getUTCHours: () => number,\n getUTCMinutes: () => number,\n getUTCSeconds: () => number,\n getUTCMilliseconds: () => number,\n getTime: () => number,\n valueOf: () => number,\n getTimezoneOffset: () => number,\n toString: () => string,\n toDateString: () => string,\n setDate: (dayValue: number) => number,\n setFullYear: (yearValue: number, monthValue?: number, dateValue?: number) => number,\n setYear: (yearValue: number) => number,\n setMonth: (monthValue: number, dayValue?: number) => number,\n setHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number,\n setMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number,\n setSeconds: (secondsValue: number, msValue?: number) => number,\n setMilliseconds: (setMilliseconds: number) => number,\n setUTCDate:(dayValue: number) => number,\n setUTCFullYear: (yearValue: number, monthValue?: number, dayValue?: number) => number,\n setUTCMonth: (monthValue: number, dayValue?: number) => number,\n setUTCHours: (hoursValue: number, minutesValue?: number, secondsValue?: number, msValue?: number) => number,\n setUTCMinutes: (minutesValue: number, secondsValue?: number, msValue?: number) => number,\n setUTCSeconds: (secondsValue: number, msValue?: number) => number,\n setUTCMilliseconds: (setMilliseconds: number) => number,\n}\n\nconst UniversalDate: UniversalDate = UniversalDateNative;\n\nexport default UniversalDate;\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
2
|
+
/**
|
3
|
+
* Convert month number to month name (text).
|
4
|
+
* If the numbers of the two months are the same you will get the name of the month,
|
5
|
+
* otherwise you will get the two names separated by a dash
|
6
|
+
*
|
7
|
+
* @param firstMonth CalendarDate Month
|
8
|
+
* @param lastMonth CalendarDate Month
|
9
|
+
* @param calendarType calendar type
|
10
|
+
* @returns {String}
|
11
|
+
*/
|
12
|
+
declare const convertMonthNumbersToMonthNames: (firstMonth: number, lastMonth: number, calendarType?: `${CalendarType}`) => {
|
13
|
+
text: any;
|
14
|
+
textInfo: any;
|
15
|
+
};
|
16
|
+
export default convertMonthNumbersToMonthNames;
|