@ui5/webcomponents-localization 1.9.2 → 1.10.0

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 (195) hide show
  1. package/dist/Assets-static.d.ts +1 -0
  2. package/dist/Assets-static.js +1 -0
  3. package/dist/Assets-static.js.map +1 -0
  4. package/dist/Assets.d.ts +1 -0
  5. package/dist/Assets.js +1 -0
  6. package/dist/Assets.js.map +1 -0
  7. package/dist/DateFormat.d.ts +6 -0
  8. package/dist/DateFormat.js +6 -2
  9. package/dist/DateFormat.js.map +1 -0
  10. package/dist/LocaleData.d.ts +6 -0
  11. package/dist/LocaleData.js +6 -2
  12. package/dist/LocaleData.js.map +1 -0
  13. package/dist/dates/CalendarDate.d.ts +41 -0
  14. package/dist/dates/CalendarDate.js +170 -207
  15. package/dist/dates/CalendarDate.js.map +1 -0
  16. package/dist/dates/ExtremeDates.d.ts +5 -0
  17. package/dist/dates/ExtremeDates.js +25 -35
  18. package/dist/dates/ExtremeDates.js.map +1 -0
  19. package/dist/dates/UniversalDate.d.ts +46 -0
  20. package/dist/dates/UniversalDate.js +5 -0
  21. package/dist/dates/UniversalDate.js.map +1 -0
  22. package/dist/dates/calculateWeekNumber.d.ts +4 -0
  23. package/dist/dates/calculateWeekNumber.js +42 -48
  24. package/dist/dates/calculateWeekNumber.js.map +1 -0
  25. package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
  26. package/dist/dates/convertMonthNumbersToMonthNames.js +15 -18
  27. package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
  28. package/dist/dates/getDaysInMonth.d.ts +3 -0
  29. package/dist/dates/getDaysInMonth.js +7 -8
  30. package/dist/dates/getDaysInMonth.js.map +1 -0
  31. package/dist/dates/getRoundedTimestamp.d.ts +7 -0
  32. package/dist/dates/getRoundedTimestamp.js +9 -9
  33. package/dist/dates/getRoundedTimestamp.js.map +1 -0
  34. package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
  35. package/dist/dates/getTodayUTCTimestamp.js +2 -3
  36. package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
  37. package/dist/dates/modifyDateBy.d.ts +13 -0
  38. package/dist/dates/modifyDateBy.js +27 -29
  39. package/dist/dates/modifyDateBy.js.map +1 -0
  40. package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
  41. package/dist/dates/transformDateToSecondaryType.js +12 -15
  42. package/dist/dates/transformDateToSecondaryType.js.map +1 -0
  43. package/{src/features/calendar/Buddhist.js → dist/features/calendar/Buddhist.d.ts} +0 -0
  44. package/dist/features/calendar/Buddhist.js +1 -0
  45. package/dist/features/calendar/Buddhist.js.map +1 -0
  46. package/{src/features/calendar/Gregorian.js → dist/features/calendar/Gregorian.d.ts} +0 -0
  47. package/dist/features/calendar/Gregorian.js +1 -0
  48. package/dist/features/calendar/Gregorian.js.map +1 -0
  49. package/{src/features/calendar/Islamic.js → dist/features/calendar/Islamic.d.ts} +0 -0
  50. package/dist/features/calendar/Islamic.js +1 -0
  51. package/dist/features/calendar/Islamic.js.map +1 -0
  52. package/{src/features/calendar/Japanese.js → dist/features/calendar/Japanese.d.ts} +0 -0
  53. package/dist/features/calendar/Japanese.js +1 -0
  54. package/dist/features/calendar/Japanese.js.map +1 -0
  55. package/{src/features/calendar/Persian.js → dist/features/calendar/Persian.d.ts} +0 -0
  56. package/dist/features/calendar/Persian.js +1 -0
  57. package/dist/features/calendar/Persian.js.map +1 -0
  58. package/dist/generated/assets/cldr/ar.json +799 -1
  59. package/dist/generated/assets/cldr/ar_EG.json +799 -1
  60. package/dist/generated/assets/cldr/ar_SA.json +799 -1
  61. package/dist/generated/assets/cldr/bg.json +764 -1
  62. package/dist/generated/assets/cldr/ca.json +798 -1
  63. package/dist/generated/assets/cldr/cs.json +797 -1
  64. package/dist/generated/assets/cldr/cy.json +729 -1
  65. package/dist/generated/assets/cldr/da.json +764 -1
  66. package/dist/generated/assets/cldr/de.json +798 -1
  67. package/dist/generated/assets/cldr/de_AT.json +798 -1
  68. package/dist/generated/assets/cldr/de_CH.json +798 -1
  69. package/dist/generated/assets/cldr/el.json +697 -1
  70. package/dist/generated/assets/cldr/el_CY.json +697 -1
  71. package/dist/generated/assets/cldr/en.json +763 -2
  72. package/dist/generated/assets/cldr/en_AU.json +763 -1
  73. package/dist/generated/assets/cldr/en_GB.json +763 -1
  74. package/dist/generated/assets/cldr/en_HK.json +763 -1
  75. package/dist/generated/assets/cldr/en_IE.json +763 -1
  76. package/dist/generated/assets/cldr/en_IN.json +763 -1
  77. package/dist/generated/assets/cldr/en_NZ.json +763 -1
  78. package/dist/generated/assets/cldr/en_PG.json +763 -1
  79. package/dist/generated/assets/cldr/en_SG.json +763 -1
  80. package/dist/generated/assets/cldr/en_ZA.json +763 -1
  81. package/dist/generated/assets/cldr/es.json +730 -1
  82. package/dist/generated/assets/cldr/es_AR.json +730 -1
  83. package/dist/generated/assets/cldr/es_BO.json +733 -4
  84. package/dist/generated/assets/cldr/es_CL.json +733 -4
  85. package/dist/generated/assets/cldr/es_CO.json +730 -1
  86. package/dist/generated/assets/cldr/es_MX.json +733 -4
  87. package/dist/generated/assets/cldr/es_PE.json +733 -4
  88. package/dist/generated/assets/cldr/es_UY.json +733 -4
  89. package/dist/generated/assets/cldr/es_VE.json +732 -3
  90. package/dist/generated/assets/cldr/et.json +763 -1
  91. package/dist/generated/assets/cldr/fa.json +765 -1
  92. package/dist/generated/assets/cldr/fi.json +797 -1
  93. package/dist/generated/assets/cldr/fr.json +763 -1
  94. package/dist/generated/assets/cldr/fr_BE.json +763 -1
  95. package/dist/generated/assets/cldr/fr_CA.json +763 -1
  96. package/dist/generated/assets/cldr/fr_CH.json +763 -1
  97. package/dist/generated/assets/cldr/fr_LU.json +763 -1
  98. package/dist/generated/assets/cldr/he.json +798 -1
  99. package/dist/generated/assets/cldr/hi.json +730 -1
  100. package/dist/generated/assets/cldr/hr.json +763 -1
  101. package/dist/generated/assets/cldr/hu.json +831 -1
  102. package/dist/generated/assets/cldr/id.json +763 -1
  103. package/dist/generated/assets/cldr/it.json +763 -1
  104. package/dist/generated/assets/cldr/it_CH.json +763 -1
  105. package/dist/generated/assets/cldr/ja.json +797 -1
  106. package/dist/generated/assets/cldr/kk.json +763 -1
  107. package/dist/generated/assets/cldr/ko.json +797 -1
  108. package/dist/generated/assets/cldr/lt.json +763 -1
  109. package/dist/generated/assets/cldr/lv.json +763 -1
  110. package/dist/generated/assets/cldr/ms.json +731 -1
  111. package/dist/generated/assets/cldr/nb.json +764 -1
  112. package/dist/generated/assets/cldr/nl.json +730 -1
  113. package/dist/generated/assets/cldr/nl_BE.json +730 -1
  114. package/dist/generated/assets/cldr/pl.json +797 -1
  115. package/dist/generated/assets/cldr/pt.json +763 -1
  116. package/dist/generated/assets/cldr/pt_PT.json +763 -1
  117. package/dist/generated/assets/cldr/ro.json +763 -1
  118. package/dist/generated/assets/cldr/ru.json +763 -1
  119. package/dist/generated/assets/cldr/ru_UA.json +763 -1
  120. package/dist/generated/assets/cldr/sk.json +797 -1
  121. package/dist/generated/assets/cldr/sl.json +797 -1
  122. package/dist/generated/assets/cldr/sr.json +763 -1
  123. package/dist/generated/assets/cldr/sr_Latn.json +763 -1
  124. package/dist/generated/assets/cldr/sv.json +764 -1
  125. package/dist/generated/assets/cldr/th.json +831 -1
  126. package/dist/generated/assets/cldr/tr.json +831 -1
  127. package/dist/generated/assets/cldr/uk.json +763 -1
  128. package/dist/generated/assets/cldr/vi.json +763 -1
  129. package/dist/generated/assets/cldr/zh_CN.json +799 -2
  130. package/dist/generated/assets/cldr/zh_HK.json +799 -2
  131. package/dist/generated/assets/cldr/zh_SG.json +799 -2
  132. package/dist/generated/assets/cldr/zh_TW.json +798 -1
  133. package/dist/getCachedLocaleDataInstance.d.ts +4 -0
  134. package/dist/getCachedLocaleDataInstance.js +6 -9
  135. package/dist/getCachedLocaleDataInstance.js.map +1 -0
  136. package/dist/locale/getLocaleData.d.ts +11 -0
  137. package/dist/locale/getLocaleData.js +12 -16
  138. package/dist/locale/getLocaleData.js.map +1 -0
  139. package/dist/sap/base/Log.js +28 -29
  140. package/dist/sap/base/assert.js +5 -6
  141. package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
  142. package/dist/sap/base/util/LoaderExtensions.js +9 -12
  143. package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
  144. package/dist/sap/ui/core/Configuration.d.ts +17 -0
  145. package/dist/sap/ui/core/Configuration.js +20 -0
  146. package/dist/sap/ui/core/Configuration.js.map +1 -0
  147. package/dist/sap/ui/core/Core.d.ts +26 -0
  148. package/dist/sap/ui/core/Core.js +7 -34
  149. package/dist/sap/ui/core/Core.js.map +1 -0
  150. package/dist/sap/ui/core/FormatSettings.d.ts +10 -0
  151. package/dist/sap/ui/core/FormatSettings.js +13 -0
  152. package/dist/sap/ui/core/FormatSettings.js.map +1 -0
  153. package/dist/sap/ui/core/Locale.js +3 -0
  154. package/dist/sap/ui/core/LocaleData.js +78 -3
  155. package/dist/sap/ui/core/date/Buddhist.js +0 -6
  156. package/dist/sap/ui/core/date/CalendarUtils.js +36 -0
  157. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +7 -0
  158. package/dist/sap/ui/core/date/Islamic.js +3 -3
  159. package/dist/sap/ui/core/date/Japanese.js +4 -4
  160. package/dist/sap/ui/core/date/UniversalDate.js +73 -22
  161. package/dist/sap/ui/core/format/DateFormat.js +157 -57
  162. package/dist/sap/ui/core/format/TimezoneUtil.js +12 -1
  163. package/package-scripts.js +5 -2
  164. package/package.json +6 -5
  165. package/src/{Assets-static.js → Assets-static.ts} +0 -0
  166. package/src/{Assets.js → Assets.ts} +0 -0
  167. package/src/DateFormat.ts +8 -0
  168. package/src/LocaleData.ts +8 -0
  169. package/src/dates/{CalendarDate.js → CalendarDate.ts} +36 -33
  170. package/src/dates/{ExtremeDates.js → ExtremeDates.ts} +6 -5
  171. package/src/dates/UniversalDate.ts +51 -0
  172. package/src/dates/{calculateWeekNumber.js → calculateWeekNumber.ts} +5 -3
  173. package/src/dates/{convertMonthNumbersToMonthNames.js → convertMonthNumbersToMonthNames.ts} +5 -4
  174. package/src/dates/{getDaysInMonth.js → getDaysInMonth.ts} +1 -1
  175. package/src/dates/{getRoundedTimestamp.js → getRoundedTimestamp.ts} +3 -3
  176. package/src/dates/getTodayUTCTimestamp.ts +10 -0
  177. package/src/dates/{modifyDateBy.js → modifyDateBy.ts} +1 -1
  178. package/src/dates/{transformDateToSecondaryType.js → transformDateToSecondaryType.ts} +2 -1
  179. package/src/features/calendar/Buddhist.ts +1 -0
  180. package/src/features/calendar/Gregorian.ts +1 -0
  181. package/src/features/calendar/Islamic.ts +1 -0
  182. package/src/features/calendar/Japanese.ts +1 -0
  183. package/src/features/calendar/Persian.ts +1 -0
  184. package/src/getCachedLocaleDataInstance.ts +15 -0
  185. package/src/locale/{getLocaleData.js → getLocaleData.ts} +8 -7
  186. package/src/sap/base/util/{LoaderExtensions.js → LoaderExtensions.ts} +1 -1
  187. package/src/sap/ui/core/{Core.js → Configuration.ts} +4 -22
  188. package/src/sap/ui/core/Core.ts +15 -0
  189. package/src/sap/ui/core/FormatSettings.ts +15 -0
  190. package/tsconfig.json +13 -0
  191. package/used-modules.txt +3 -1
  192. package/src/DateFormat.js +0 -3
  193. package/src/LocaleData.js +0 -3
  194. package/src/dates/getTodayUTCTimestamp.js +0 -9
  195. package/src/getCachedLocaleDataInstance.js +0 -13
@@ -0,0 +1 @@
1
+ import "./generated/json-imports/LocaleData-static.js";
@@ -1,2 +1,3 @@
1
1
  // Currently the base package provides CLDR assets only
2
2
  import "./generated/json-imports/LocaleData-static.js";
3
+ //# sourceMappingURL=Assets-static.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Assets-static.js","sourceRoot":"","sources":["../src/Assets-static.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,+CAA+C,CAAC"}
@@ -0,0 +1 @@
1
+ import "./generated/json-imports/LocaleData.js";
package/dist/Assets.js CHANGED
@@ -1,2 +1,3 @@
1
1
  // Currently the base package provides CLDR assets only
2
2
  import "./generated/json-imports/LocaleData.js";
3
+ //# sourceMappingURL=Assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Assets.js","sourceRoot":"","sources":["../src/Assets.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,wCAAwC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="openui5" />
2
+ import type DateFormatT from "sap/ui/core/format/DateFormat";
3
+ declare const DateFormatWrapped: typeof DateFormatT;
4
+ declare class DateFormat extends DateFormatWrapped {
5
+ }
6
+ export default DateFormat;
@@ -1,3 +1,7 @@
1
- import DateFormat from "./sap/ui/core/format/DateFormat.js";
2
-
1
+ // @ts-ignore
2
+ import DateFormatNative from "./sap/ui/core/format/DateFormat.js";
3
+ const DateFormatWrapped = DateFormatNative;
4
+ class DateFormat extends DateFormatWrapped {
5
+ }
3
6
  export default DateFormat;
7
+ //# sourceMappingURL=DateFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateFormat.js","sourceRoot":"","sources":["../src/DateFormat.ts"],"names":[],"mappings":"AACA,aAAa;AACb,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAElE,MAAM,iBAAiB,GAAG,gBAAsC,CAAC;AACjE,MAAM,UAAW,SAAQ,iBAAiB;CAAG;AAE7C,eAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="openui5" />
2
+ import type LocaleDataOpenUI5T from "sap/ui/core/LocaleData";
3
+ declare const LocaleDataWrapped: typeof LocaleDataOpenUI5T;
4
+ declare class LocaleData extends LocaleDataWrapped {
5
+ }
6
+ export default LocaleData;
@@ -1,3 +1,7 @@
1
- import LocaleData from "./sap/ui/core/LocaleData.js";
2
-
1
+ // @ts-ignore
2
+ import LocaleDataNative from "./sap/ui/core/LocaleData.js";
3
+ const LocaleDataWrapped = LocaleDataNative;
4
+ class LocaleData extends LocaleDataWrapped {
5
+ }
3
6
  export default LocaleData;
7
+ //# sourceMappingURL=LocaleData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocaleData.js","sourceRoot":"","sources":["../src/LocaleData.ts"],"names":[],"mappings":"AACA,aAAa;AACb,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAE3D,MAAM,iBAAiB,GAAG,gBAA6C,CAAC;AACxE,MAAM,UAAW,SAAQ,iBAAiB;CAAG;AAE7C,eAAe,UAAU,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
+ import UniversalDate from "./UniversalDate.js";
3
+ declare class CalendarDate {
4
+ _oUDate: Date | UniversalDate;
5
+ constructor(year?: number | CalendarDate, month?: number | string, date?: number, calendarType?: string);
6
+ getYear(): number;
7
+ setYear(year: number): this;
8
+ getMonth(): number;
9
+ /**
10
+ * Sets the given month as ordinal month of the year.
11
+ * @param {int} month An integer between 0 and 11, representing the months January through December( or their
12
+ * equivalent month names for the given calendar).
13
+ * If the specified value is is outside of the expected range, this method attempts to update the date information
14
+ * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
15
+ * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
16
+ * 0 will result in the previous month's last day.
17
+ * -1 will result in the day before the previous month's last day.
18
+ * 32 will result in:
19
+ * - first day of the next month if the current month has 31 days.
20
+ * - second day of the next month if the current month has 30 days.
21
+ * Other value will result in adding or subtracting days according to the given value.
22
+ * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
23
+ */
24
+ setMonth(month: number, date?: number): this;
25
+ getDate(): number;
26
+ setDate(date: number): this;
27
+ getDay(): number;
28
+ getCalendarType(): string;
29
+ isBefore(oCalendarDate: CalendarDate): boolean;
30
+ isAfter(oCalendarDate: CalendarDate): boolean;
31
+ isSameOrBefore(oCalendarDate: CalendarDate): boolean;
32
+ isSameOrAfter(oCalendarDate: CalendarDate): boolean;
33
+ isSame(oCalendarDate: CalendarDate): boolean;
34
+ toLocalJSDate(): Date;
35
+ toUTCJSDate(): Date;
36
+ toString(): string;
37
+ valueOf(): number;
38
+ static fromLocalJSDate(oJSDate: Date, sCalendarType?: CalendarType): CalendarDate;
39
+ static fromTimestamp(iTimestamp: number, sCalendarType?: CalendarType): CalendarDate;
40
+ }
41
+ export default CalendarDate;
@@ -1,219 +1,182 @@
1
- import UniversalDate from "../sap/ui/core/date/UniversalDate.js";
2
-
1
+ import UniversalDate from "./UniversalDate.js";
3
2
  class CalendarDate {
4
- constructor() {
5
- let aArgs = arguments, // eslint-disable-line
6
- oJSDate,
7
- oNow,
8
- sCalendarType;
9
-
10
- switch (aArgs.length) {
11
- case 0: // defaults to the current date
12
- oNow = new Date();
13
- return this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate());
14
-
15
- case 1: // CalendarDate
16
- case 2: // CalendarDate, sCalendarType
17
- if (!(aArgs[0] instanceof CalendarDate)) {
18
- throw new Error("Invalid arguments: the first argument must be of type sap.ui.unified.calendar.CalendarDate.");
19
- }
20
- sCalendarType = aArgs[1] ? aArgs[1] : aArgs[0]._oUDate.sCalendarType;
21
- // Use source.valueOf() (returns the same point of time regardless calendar type) instead of
22
- // source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date
23
- oJSDate = new Date(aArgs[0].valueOf());
24
-
25
- // Make this date really local. Now getters are safe.
26
- oJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());
27
- oJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());
28
-
29
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
30
- break;
31
-
32
- case 3: // year, month, date
33
- case 4: // year, month, date, sCalendarType
34
- checkNumericLike(aArgs[0], `Invalid year: ${aArgs[0]}`);
35
- checkNumericLike(aArgs[1], `Invalid month: ${aArgs[1]}`);
36
- checkNumericLike(aArgs[2], `Invalid date: ${aArgs[2]}`);
37
-
38
- oJSDate = new Date(0, 0, 1);
39
- oJSDate.setFullYear(aArgs[0], aArgs[1], aArgs[2]); // 2 digits year is not supported. If so, it is considered as full year as well.
40
-
41
- if (aArgs[3]) {
42
- sCalendarType = aArgs[3];
43
- }
44
- this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
45
- break;
46
-
47
- default:
48
- throw new Error(`${"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType"
49
- + "or 2) year, month, date, (optional) calendarType"}${aArgs}`);
50
- }
51
- }
52
-
53
- getYear() {
54
- return this._oUDate.getUTCFullYear();
55
- }
56
-
57
- setYear(year) {
58
- checkNumericLike(year, `Invalid year: ${year}`);
59
- this._oUDate.setUTCFullYear(year);
60
- return this;
61
- }
62
-
63
- getMonth() {
64
- return this._oUDate.getUTCMonth();
65
- }
66
-
67
- /**
68
- * Sets the given month as ordinal month of the year.
69
- * @param {int} month An integer between 0 and 11, representing the months January through December( or their
70
- * equivalent month names for the given calendar).
71
- * If the specified value is is outside of the expected range, this method attempts to update the date information
72
- * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
73
- * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
74
- * 0 will result in the previous month's last day.
75
- * -1 will result in the day before the previous month's last day.
76
- * 32 will result in:
77
- * - first day of the next month if the current month has 31 days.
78
- * - second day of the next month if the current month has 30 days.
79
- * Other value will result in adding or subtracting days according to the given value.
80
- * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
81
- */
82
- setMonth(month, date) {
83
- checkNumericLike(month, `Invalid month: ${month}`);
84
- if (date || date === 0) {
85
- checkNumericLike(date, `Invalid date: ${date}`);
86
- this._oUDate.setUTCMonth(month, date);
87
- } else {
88
- this._oUDate.setUTCMonth(month);
89
- }
90
- return this;
91
- }
92
-
93
- getDate() {
94
- return this._oUDate.getUTCDate();
95
- }
96
-
97
- setDate(date) {
98
- checkNumericLike(date, `Invalid date: ${date}`);
99
- this._oUDate.setUTCDate(date);
100
- return this;
101
- }
102
-
103
- getDay() {
104
- return this._oUDate.getUTCDay();
105
- }
106
-
107
- getCalendarType() {
108
- return this._oUDate.sCalendarType;
109
- }
110
-
111
- isBefore(oCalendarDate) {
112
- checkCalendarDate(oCalendarDate);
113
- return this.valueOf() < oCalendarDate.valueOf();
114
- }
115
-
116
- isAfter(oCalendarDate) {
117
- checkCalendarDate(oCalendarDate);
118
- return this.valueOf() > oCalendarDate.valueOf();
119
- }
120
-
121
- isSameOrBefore(oCalendarDate) {
122
- checkCalendarDate(oCalendarDate);
123
- return this.valueOf() <= oCalendarDate.valueOf();
124
- }
125
-
126
- isSameOrAfter(oCalendarDate) {
127
- checkCalendarDate(oCalendarDate);
128
- return this.valueOf() >= oCalendarDate.valueOf();
129
- }
130
-
131
- isSame(oCalendarDate) {
132
- checkCalendarDate(oCalendarDate);
133
- return this.valueOf() === oCalendarDate.valueOf();
134
- }
135
-
136
- toLocalJSDate() {
137
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
138
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
139
- const oLocalDate = new Date(this._oUDate.getTime());
140
-
141
- // Make this date really local. Now getters are safe.
142
- oLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());
143
- oLocalDate.setHours(0, 0, 0, 0);
144
-
145
- return oLocalDate;
146
- }
147
-
148
- toUTCJSDate() {
149
- // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
150
- // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
151
- const oUTCDate = new Date(this._oUDate.getTime());
152
- oUTCDate.setUTCHours(0, 0, 0, 0);
153
-
154
- return oUTCDate;
155
- }
156
-
157
- toString() {
158
- return `${this._oUDate.sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;
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
- }
3
+ constructor(year, month, date, calendarType) {
4
+ let aArgs = arguments, // eslint-disable-line
5
+ oJSDate, oNow, sCalendarType;
6
+ switch (aArgs.length) {
7
+ case 0: // defaults to the current date
8
+ oNow = new Date();
9
+ return this.constructor(oNow.getFullYear(), oNow.getMonth(), oNow.getDate());
10
+ case 1: // CalendarDate
11
+ case 2: // CalendarDate, sCalendarType
12
+ if (!(aArgs[0] instanceof CalendarDate)) {
13
+ throw new Error("Invalid arguments: the first argument must be of type CalendarDate.");
14
+ }
15
+ sCalendarType = aArgs[1] ? aArgs[1] : aArgs[0]._oUDate.sCalendarType;
16
+ // Use source.valueOf() (returns the same point of time regardless calendar type) instead of
17
+ // source's getters to avoid non-gregorian Year, Month and Date may be used to construct a Gregorian date
18
+ oJSDate = new Date(aArgs[0].valueOf());
19
+ // Make this date really local. Now getters are safe.
20
+ oJSDate.setFullYear(oJSDate.getUTCFullYear(), oJSDate.getUTCMonth(), oJSDate.getUTCDate());
21
+ oJSDate.setHours(oJSDate.getUTCHours(), oJSDate.getUTCMinutes(), oJSDate.getUTCSeconds(), oJSDate.getUTCMilliseconds());
22
+ this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
23
+ break;
24
+ case 3: // year, month, date
25
+ case 4: // year, month, date, sCalendarType
26
+ checkNumericLike(aArgs[0], `Invalid year: ${aArgs[0]}`);
27
+ checkNumericLike(aArgs[1], `Invalid month: ${aArgs[1]}`);
28
+ checkNumericLike(aArgs[2], `Invalid date: ${aArgs[2]}`);
29
+ oJSDate = new Date(0, 0, 1);
30
+ oJSDate.setFullYear(aArgs[0], aArgs[1], aArgs[2]); // 2 digits year is not supported. If so, it is considered as full year as well.
31
+ if (aArgs[3]) {
32
+ sCalendarType = aArgs[3];
33
+ }
34
+ this._oUDate = createUniversalUTCDate(oJSDate, sCalendarType);
35
+ break;
36
+ default:
37
+ throw new Error(`${"Invalid arguments. Accepted arguments are: 1) oCalendarDate, (optional)calendarType"
38
+ + "or 2) year, month, date, (optional) calendarType"}${aArgs}`);
39
+ }
40
+ }
41
+ getYear() {
42
+ return this._oUDate.getUTCFullYear();
43
+ }
44
+ setYear(year) {
45
+ checkNumericLike(year, `Invalid year: ${year}`);
46
+ this._oUDate.setUTCFullYear(year);
47
+ return this;
48
+ }
49
+ getMonth() {
50
+ return this._oUDate.getUTCMonth();
51
+ }
52
+ /**
53
+ * Sets the given month as ordinal month of the year.
54
+ * @param {int} month An integer between 0 and 11, representing the months January through December( or their
55
+ * equivalent month names for the given calendar).
56
+ * If the specified value is is outside of the expected range, this method attempts to update the date information
57
+ * accordingly. For example, if 12 is given as a month, the year will be incremented by 1, and 1 will be used for month.
58
+ * @param {int} [date] An integer between 1 and 31, representing the day of the month, but other values are allowed.
59
+ * 0 will result in the previous month's last day.
60
+ * -1 will result in the day before the previous month's last day.
61
+ * 32 will result in:
62
+ * - first day of the next month if the current month has 31 days.
63
+ * - second day of the next month if the current month has 30 days.
64
+ * Other value will result in adding or subtracting days according to the given value.
65
+ * @returns {sap.ui.unified.calendar.CalendarDate} <code>this</code> for method chaining.
66
+ */
67
+ setMonth(month, date) {
68
+ checkNumericLike(month, `Invalid month: ${month}`);
69
+ if (date || date === 0) {
70
+ checkNumericLike(date, `Invalid date: ${date}`);
71
+ this._oUDate.setUTCMonth(month, date);
72
+ }
73
+ else {
74
+ this._oUDate.setUTCMonth(month);
75
+ }
76
+ return this;
77
+ }
78
+ getDate() {
79
+ return this._oUDate.getUTCDate();
80
+ }
81
+ setDate(date) {
82
+ checkNumericLike(date, `Invalid date: ${date}`);
83
+ this._oUDate.setUTCDate(date);
84
+ return this;
85
+ }
86
+ getDay() {
87
+ return this._oUDate.getUTCDay();
88
+ }
89
+ getCalendarType() {
90
+ return this._oUDate.sCalendarType;
91
+ }
92
+ isBefore(oCalendarDate) {
93
+ checkCalendarDate(oCalendarDate);
94
+ return this.valueOf() < oCalendarDate.valueOf();
95
+ }
96
+ isAfter(oCalendarDate) {
97
+ checkCalendarDate(oCalendarDate);
98
+ return this.valueOf() > oCalendarDate.valueOf();
99
+ }
100
+ isSameOrBefore(oCalendarDate) {
101
+ checkCalendarDate(oCalendarDate);
102
+ return this.valueOf() <= oCalendarDate.valueOf();
103
+ }
104
+ isSameOrAfter(oCalendarDate) {
105
+ checkCalendarDate(oCalendarDate);
106
+ return this.valueOf() >= oCalendarDate.valueOf();
107
+ }
108
+ isSame(oCalendarDate) {
109
+ checkCalendarDate(oCalendarDate);
110
+ return this.valueOf() === oCalendarDate.valueOf();
111
+ }
112
+ toLocalJSDate() {
113
+ // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
114
+ // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
115
+ const oLocalDate = new Date(this._oUDate.getTime());
116
+ // Make this date really local. Now getters are safe.
117
+ oLocalDate.setFullYear(oLocalDate.getUTCFullYear(), oLocalDate.getUTCMonth(), oLocalDate.getUTCDate());
118
+ oLocalDate.setHours(0, 0, 0, 0);
119
+ return oLocalDate;
120
+ }
121
+ toUTCJSDate() {
122
+ // Use this._oUDate.getTime()(returns the same point of time regardless calendar type) instead of
123
+ // this._oUDate's getters to avoid non-gregorian Year, Month and Date to be used to construct a Gregorian date
124
+ const oUTCDate = new Date(this._oUDate.getTime());
125
+ oUTCDate.setUTCHours(0, 0, 0, 0);
126
+ return oUTCDate;
127
+ }
128
+ toString() {
129
+ return `${this._oUDate.sCalendarType}: ${this.getYear()}/${this.getMonth() + 1}/${this.getDate()}`;
130
+ }
131
+ valueOf() {
132
+ return this._oUDate.getTime();
133
+ }
134
+ static fromLocalJSDate(oJSDate, sCalendarType) {
135
+ // Cross frame check for a date should be performed here otherwise setDateValue would fail in OPA tests
136
+ // because Date object in the test is different than the Date object in the application (due to the iframe).
137
+ // We can use jQuery.type or this method:
138
+ function isValidDate(date) {
139
+ return date && Object.prototype.toString.call(date) === "[object Date]" && !isNaN(date); // eslint-disable-line
140
+ }
141
+ if (!isValidDate(oJSDate)) {
142
+ throw new Error(`Date parameter must be a JavaScript Date object: [${oJSDate}].`);
143
+ }
144
+ return new CalendarDate(oJSDate.getFullYear(), oJSDate.getMonth(), oJSDate.getDate(), sCalendarType);
145
+ }
146
+ static fromTimestamp(iTimestamp, sCalendarType) {
147
+ const oCalDate = new CalendarDate(0, 0, 1);
148
+ let oUDate;
149
+ try {
150
+ oUDate = UniversalDate.getInstance(new Date(iTimestamp), sCalendarType);
151
+ }
152
+ catch (e) {
153
+ oUDate = new Date(NaN); // UniversalDate.getInstance may now throw an Exception - keep the old behavior
154
+ }
155
+ oCalDate._oUDate = oUDate;
156
+ return oCalDate;
157
+ }
189
158
  }
190
-
191
159
  function createUniversalUTCDate(oDate, sCalendarType) {
192
- if (sCalendarType) {
193
- return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
194
- }
195
- return new UniversalDate(createUTCDate(oDate).getTime());
160
+ if (sCalendarType) {
161
+ return UniversalDate.getInstance(createUTCDate(oDate), sCalendarType);
162
+ }
163
+ return new UniversalDate(createUTCDate(oDate).getTime());
196
164
  }
197
-
198
165
  /**
199
166
  * Creates a JavaScript UTC Date corresponding to the given JavaScript Date.
200
167
  * @param {Date} oDate JavaScript date object. Time related information is cut.
201
168
  * @returns {Date} JavaScript date created from the date object, but this time considered as UTC date information.
202
169
  */
203
170
  function createUTCDate(oDate) {
204
- const oUTCDate = new Date(Date.UTC(0, 0, 1));
205
-
206
- oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());
207
-
208
- return oUTCDate;
171
+ const oUTCDate = new Date(Date.UTC(0, 0, 1));
172
+ oUTCDate.setUTCFullYear(oDate.getFullYear(), oDate.getMonth(), oDate.getDate());
173
+ return oUTCDate;
209
174
  }
210
-
211
175
  function checkCalendarDate(oCalendarDate) {
212
- if (!(oCalendarDate instanceof CalendarDate)) {
213
- throw new Error(`Invalid calendar date: [${oCalendarDate}]. Expected: sap.ui.unified.calendar.CalendarDate`);
214
- }
176
+ if (!(oCalendarDate instanceof CalendarDate)) {
177
+ throw new Error(`Invalid calendar date: [${oCalendarDate}]. Expected: CalendarDate`);
178
+ }
215
179
  }
216
-
217
180
  /**
218
181
  * Verifies the given value is numeric like, i.e. 3, "3" and throws an error if it is not.
219
182
  * @param {any} value The value of any type to check. If null or undefined, this method throws an error.
@@ -221,9 +184,9 @@ function checkCalendarDate(oCalendarDate) {
221
184
  * @throws will throw an error if the value is null or undefined or is not like a number
222
185
  */
223
186
  function checkNumericLike(value, message) {
224
- if (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line
225
- throw message;
226
- }
187
+ if (value === undefined || value === Infinity || isNaN(value)) { // eslint-disable-line
188
+ throw message;
189
+ }
227
190
  }
228
-
229
191
  export default CalendarDate;
192
+ //# sourceMappingURL=CalendarDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalendarDate.js","sourceRoot":"","sources":["../../src/dates/CalendarDate.ts"],"names":[],"mappings":"AACA,OA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,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC;KACtE;IACD,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAW;IACjC,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE7C,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;QAC7C,MAAM,IAAI,KAAK,CAAC,2BAA2B,aAAkC,2BAA2B,CAAC,CAAC;KAC1G;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,EAAE,sBAAsB;QACtF,MAAM,OAAO,CAAC;KACd;AACF,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import 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 getMinCalendarDate = primaryCalendarType => {
6
- const key = `min ${primaryCalendarType}`;
7
-
8
- if (!cache.has(key)) {
9
- const minDate = new CalendarDate(1, 0, 1, primaryCalendarType);
10
- minDate.setYear(1);
11
- minDate.setMonth(0);
12
- minDate.setDate(1);
13
- cache.set(key, minDate);
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 getMaxCalendarDate = primaryCalendarType => {
20
- const key = `max ${primaryCalendarType}`;
21
-
22
- if (!cache.has(key)) {
23
- const maxDate = new CalendarDate(1, 0, 1, primaryCalendarType);
24
- maxDate.setYear(9999);
25
- maxDate.setMonth(11);
26
- const tempDate = new CalendarDate(maxDate, primaryCalendarType);
27
- tempDate.setDate(1);
28
- tempDate.setMonth(tempDate.getMonth() + 1, 0);
29
- maxDate.setDate(tempDate.getDate());// 31st for Gregorian Calendar
30
- cache.set(key, maxDate);
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=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