@ui5/webcomponents-localization 0.0.0-dcd8e5389 → 0.0.0-dd5d66a9a

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 (194) hide show
  1. package/.eslintignore +2 -1
  2. package/CHANGELOG.md +1587 -0
  3. package/README.md +7 -9
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/Assets-fetch.d.ts +1 -0
  6. package/dist/Assets-fetch.js +3 -0
  7. package/dist/Assets-fetch.js.map +1 -0
  8. package/dist/Assets-node.d.ts +11 -0
  9. package/dist/Assets-node.js +12 -0
  10. package/dist/Assets-node.js.map +1 -0
  11. package/dist/CalendarUtils.d.ts +3 -0
  12. package/dist/CalendarUtils.js +6 -0
  13. package/dist/CalendarUtils.js.map +1 -0
  14. package/dist/DateFormat.d.ts +0 -1
  15. package/dist/LocaleData.d.ts +0 -1
  16. package/dist/dates/CalendarDate.d.ts +2 -3
  17. package/dist/dates/CalendarDate.js.map +1 -1
  18. package/dist/dates/ExtremeDates.d.ts +3 -3
  19. package/dist/dates/ExtremeDates.js.map +1 -1
  20. package/dist/dates/UI5Date.d.ts +0 -1
  21. package/dist/dates/UniversalDate.d.ts +1 -1
  22. package/dist/dates/UniversalDate.js.map +1 -1
  23. package/dist/dates/convertMonthNumbersToMonthNames.d.ts +1 -1
  24. package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -1
  25. package/dist/dates/getRoundedTimestamp.js.map +1 -1
  26. package/dist/dates/getTodayUTCTimestamp.d.ts +1 -1
  27. package/dist/dates/getTodayUTCTimestamp.js.map +1 -1
  28. package/dist/dates/modifyDateBy.d.ts +2 -1
  29. package/dist/dates/modifyDateBy.js +34 -19
  30. package/dist/dates/modifyDateBy.js.map +1 -1
  31. package/dist/dates/transformDateToSecondaryType.d.ts +1 -1
  32. package/dist/dates/transformDateToSecondaryType.js.map +1 -1
  33. package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
  34. package/dist/generated/assets/cldr/ar.json +7085 -2816
  35. package/dist/generated/assets/cldr/ar_EG.json +7085 -2816
  36. package/dist/generated/assets/cldr/ar_SA.json +7084 -2815
  37. package/dist/generated/assets/cldr/bg.json +5979 -2733
  38. package/dist/generated/assets/cldr/ca.json +6081 -2680
  39. package/dist/generated/assets/cldr/cnr.json +6169 -0
  40. package/dist/generated/assets/cldr/cs.json +6707 -2716
  41. package/dist/generated/assets/cldr/cy.json +6930 -2797
  42. package/dist/generated/assets/cldr/da.json +5925 -2597
  43. package/dist/generated/assets/cldr/de.json +6046 -2614
  44. package/dist/generated/assets/cldr/de_AT.json +6047 -2614
  45. package/dist/generated/assets/cldr/de_CH.json +6045 -2614
  46. package/dist/generated/assets/cldr/el.json +5830 -2595
  47. package/dist/generated/assets/cldr/el_CY.json +5830 -2595
  48. package/dist/generated/assets/cldr/en.json +6042 -2583
  49. package/dist/generated/assets/cldr/en_AU.json +6082 -2592
  50. package/dist/generated/assets/cldr/en_GB.json +6073 -2584
  51. package/dist/generated/assets/cldr/en_HK.json +6082 -2593
  52. package/dist/generated/assets/cldr/en_IE.json +6073 -2584
  53. package/dist/generated/assets/cldr/en_IN.json +6078 -2588
  54. package/dist/generated/assets/cldr/en_NZ.json +6073 -2584
  55. package/dist/generated/assets/cldr/en_PG.json +6074 -2584
  56. package/dist/generated/assets/cldr/en_SG.json +6078 -2588
  57. package/dist/generated/assets/cldr/en_ZA.json +6074 -2584
  58. package/dist/generated/assets/cldr/es.json +6101 -2640
  59. package/dist/generated/assets/cldr/es_AR.json +6104 -2645
  60. package/dist/generated/assets/cldr/es_BO.json +6103 -2645
  61. package/dist/generated/assets/cldr/es_CL.json +5996 -2645
  62. package/dist/generated/assets/cldr/es_CO.json +5996 -2644
  63. package/dist/generated/assets/cldr/es_MX.json +6105 -2645
  64. package/dist/generated/assets/cldr/es_PE.json +5887 -2645
  65. package/dist/generated/assets/cldr/es_UY.json +5889 -2645
  66. package/dist/generated/assets/cldr/es_VE.json +5888 -2645
  67. package/dist/generated/assets/cldr/et.json +6025 -2599
  68. package/dist/generated/assets/cldr/fa.json +5948 -2618
  69. package/dist/generated/assets/cldr/fi.json +6193 -2726
  70. package/dist/generated/assets/cldr/fr.json +5995 -2590
  71. package/dist/generated/assets/cldr/fr_BE.json +5995 -2590
  72. package/dist/generated/assets/cldr/fr_CA.json +5989 -2605
  73. package/dist/generated/assets/cldr/fr_CH.json +6013 -2607
  74. package/dist/generated/assets/cldr/fr_LU.json +5995 -2590
  75. package/dist/generated/assets/cldr/he.json +6539 -2711
  76. package/dist/generated/assets/cldr/hi.json +5857 -2602
  77. package/dist/generated/assets/cldr/hr.json +6194 -2652
  78. package/dist/generated/assets/cldr/hu.json +5943 -2598
  79. package/dist/generated/assets/cldr/id.json +5728 -2544
  80. package/dist/generated/assets/cldr/it.json +5984 -2590
  81. package/dist/generated/assets/cldr/it_CH.json +5984 -2590
  82. package/dist/generated/assets/cldr/ja.json +5887 -2663
  83. package/dist/generated/assets/cldr/kk.json +5937 -2589
  84. package/dist/generated/assets/cldr/ko.json +5768 -2641
  85. package/dist/generated/assets/cldr/lt.json +6576 -2720
  86. package/dist/generated/assets/cldr/lv.json +6112 -2644
  87. package/dist/generated/assets/cldr/mk.json +6045 -0
  88. package/dist/generated/assets/cldr/ms.json +5562 -2538
  89. package/dist/generated/assets/cldr/nb.json +6033 -2621
  90. package/dist/generated/assets/cldr/nl.json +6200 -2601
  91. package/dist/generated/assets/cldr/nl_BE.json +6200 -2601
  92. package/dist/generated/assets/cldr/pl.json +6587 -2723
  93. package/dist/generated/assets/cldr/pt.json +6113 -2607
  94. package/dist/generated/assets/cldr/pt_PT.json +6178 -2658
  95. package/dist/generated/assets/cldr/ro.json +6198 -2645
  96. package/dist/generated/assets/cldr/ru.json +6501 -2704
  97. package/dist/generated/assets/cldr/ru_UA.json +6501 -2704
  98. package/dist/generated/assets/cldr/sk.json +6430 -2726
  99. package/dist/generated/assets/cldr/sl.json +6442 -2688
  100. package/dist/generated/assets/cldr/sr.json +6239 -2663
  101. package/dist/generated/assets/cldr/sr_Latn.json +6224 -2666
  102. package/dist/generated/assets/cldr/sv.json +6074 -2631
  103. package/dist/generated/assets/cldr/th.json +5873 -2635
  104. package/dist/generated/assets/cldr/tr.json +6092 -2612
  105. package/dist/generated/assets/cldr/uk.json +6452 -2684
  106. package/dist/generated/assets/cldr/vi.json +5667 -2555
  107. package/dist/generated/assets/cldr/zh_CN.json +5715 -2555
  108. package/dist/generated/assets/cldr/zh_HK.json +5724 -2563
  109. package/dist/generated/assets/cldr/zh_SG.json +5724 -2562
  110. package/dist/generated/assets/cldr/zh_TW.json +5791 -2587
  111. package/dist/generated/json-imports/LocaleData-fetch.d.ts +1 -0
  112. package/dist/generated/json-imports/LocaleData-fetch.js +93 -0
  113. package/dist/generated/json-imports/LocaleData-fetch.js.map +1 -0
  114. package/dist/generated/json-imports/LocaleData-node.d.ts +1 -0
  115. package/dist/generated/json-imports/LocaleData-node.js +93 -0
  116. package/dist/generated/json-imports/LocaleData-node.js.map +1 -0
  117. package/dist/generated/json-imports/LocaleData.d.ts +1 -0
  118. package/dist/generated/json-imports/LocaleData.js +89 -89
  119. package/dist/generated/json-imports/LocaleData.js.map +1 -0
  120. package/dist/getCachedLocaleDataInstance.js.map +1 -1
  121. package/dist/locale/getLocaleData.js.map +1 -1
  122. package/dist/sap/base/Event.js +59 -0
  123. package/dist/sap/base/Eventing.js +146 -0
  124. package/dist/sap/base/Log.js +2 -239
  125. package/dist/sap/base/assert.js +28 -1
  126. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  127. package/dist/sap/base/config.js +17 -0
  128. package/dist/sap/base/i18n/Formatting.d.ts +8 -0
  129. package/dist/sap/base/i18n/Formatting.js +11 -0
  130. package/dist/sap/base/i18n/Formatting.js.map +1 -0
  131. package/dist/sap/base/i18n/LanguageTag.js +173 -0
  132. package/dist/sap/base/i18n/Localization.d.ts +4 -0
  133. package/dist/sap/base/i18n/Localization.js +12 -0
  134. package/dist/sap/base/i18n/Localization.js.map +1 -0
  135. package/dist/sap/base/i18n/date/CalendarType.js +43 -0
  136. package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +105 -0
  137. package/dist/sap/base/i18n/date/TimezoneUtils.js +319 -0
  138. package/dist/sap/base/strings/camelize.js +30 -0
  139. package/dist/sap/base/strings/formatMessage.js +88 -15
  140. package/dist/sap/base/util/LoaderExtensions.js.map +1 -1
  141. package/dist/sap/base/util/ObjectPath.d.ts +4 -0
  142. package/dist/sap/base/util/ObjectPath.js +4 -33
  143. package/dist/sap/base/util/ObjectPath.js.map +1 -0
  144. package/dist/sap/base/util/Version.js +157 -0
  145. package/dist/sap/base/util/_merge.js +83 -26
  146. package/dist/sap/base/util/array/uniqueSort.js +37 -15
  147. package/dist/sap/base/util/deepClone.js +102 -0
  148. package/dist/sap/base/util/deepEqual.js +75 -51
  149. package/dist/sap/base/util/extend.js +58 -7
  150. package/dist/sap/base/util/isEmptyObject.js +34 -0
  151. package/dist/sap/base/util/isPlainObject.js +35 -1
  152. package/dist/sap/base/util/now.js +24 -3
  153. package/dist/sap/base/util/resolveReference.js +3 -0
  154. package/dist/sap/base/util/uid.js +27 -0
  155. package/dist/sap/ui/base/DataType.js +657 -0
  156. package/dist/sap/ui/base/Interface.js +47 -1
  157. package/dist/sap/ui/base/Metadata.js +435 -171
  158. package/dist/sap/ui/base/Object.js +284 -48
  159. package/dist/sap/ui/core/CalendarType.js +24 -8
  160. package/dist/sap/ui/core/Configuration.d.ts +2 -2
  161. package/dist/sap/ui/core/Configuration.js +2 -0
  162. package/dist/sap/ui/core/Configuration.js.map +1 -1
  163. package/dist/sap/ui/core/Core.d.ts +3 -4
  164. package/dist/sap/ui/core/FormatSettings.d.ts +1 -2
  165. package/dist/sap/ui/core/FormatSettings.js +0 -2
  166. package/dist/sap/ui/core/FormatSettings.js.map +1 -1
  167. package/dist/sap/ui/core/Locale.js +190 -155
  168. package/dist/sap/ui/core/LocaleData.js +2659 -1351
  169. package/dist/sap/ui/core/Supportability.js +5 -0
  170. package/dist/sap/ui/core/Theming.js +539 -0
  171. package/dist/sap/ui/core/date/Buddhist.js +162 -87
  172. package/dist/sap/ui/core/date/CalendarUtils.js +61 -32
  173. package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -7
  174. package/dist/sap/ui/core/date/Gregorian.js +25 -10
  175. package/dist/sap/ui/core/date/Islamic.js +298 -185
  176. package/dist/sap/ui/core/date/Japanese.js +210 -115
  177. package/dist/sap/ui/core/date/Persian.js +324 -195
  178. package/dist/sap/ui/core/date/UI5Date.js +923 -237
  179. package/dist/sap/ui/core/date/UniversalDate.js +1238 -256
  180. package/dist/sap/ui/core/date/_Calendars.js +10 -1
  181. package/dist/sap/ui/core/format/DateFormat.js +3171 -2111
  182. package/dist/sap/ui/core/format/TimezoneUtil.js +24 -89
  183. package/package-scripts.cjs +12 -21
  184. package/package.json +13 -8
  185. package/tsconfig.json +20 -10
  186. package/used-modules.txt +23 -1
  187. package/dist/Assets-static.d.ts +0 -1
  188. package/dist/Assets-static.js +0 -3
  189. package/dist/Assets-static.js.map +0 -1
  190. package/dist/dates/calculateWeekNumber.d.ts +0 -5
  191. package/dist/dates/calculateWeekNumber.js +0 -45
  192. package/dist/dates/calculateWeekNumber.js.map +0 -1
  193. package/dist/generated/json-imports/LocaleData-static.js +0 -90
  194. package/dist/sap/ui/Device.js +0 -5
@@ -1 +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"]}
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"]}
@@ -9,7 +9,7 @@ import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.j
9
9
  * @param calendarType calendar type
10
10
  * @returns {String}
11
11
  */
12
- declare const convertMonthNumbersToMonthNames: (firstMonth: number, lastMonth: number, calendarType?: CalendarType) => {
12
+ declare const convertMonthNumbersToMonthNames: (firstMonth: number, lastMonth: number, calendarType?: `${CalendarType}`) => {
13
13
  text: any;
14
14
  textInfo: any;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"convertMonthNumbersToMonthNames.js","sourceRoot":"","sources":["../../src/dates/convertMonthNumbersToMonthNames.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kDAAkD,CAAC;AAEzE,OAAO,2BAA2B,MAAM,mCAAmC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,+BAA+B,GAAG,CAAC,UAAkB,EAAE,SAAiB,EAAE,YAA2B,EAAE,EAAE;IAC9G,MAAM,UAAU,GAAG,2BAA2B,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAClD,MAAM,oBAAoB,GAAG,UAAU,CAAC,mBAAmB,CAAC,aAAa,EAAE,YAAY,CAAkB,CAAC;IAC1G,MAAM,wBAAwB,GAAG,UAAU,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAkB,CAAC;IAEvG,IAAI,UAAU,KAAK,SAAS,EAAE;QAC7B,OAAO;YACN,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,UAAU,CAAC;YACnE,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,UAAU,CAAC;SAChE,CAAC;KACF;IAED,OAAO;QACN,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAClH,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;KAC9H,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,+BAA+B,CAAC","sourcesContent":["import getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport getCachedLocaleDataInstance from \"../getCachedLocaleDataInstance.js\";\n\n/**\n * Convert month number to month name (text).\n * If the numbers of the two months are the same you will get the name of the month,\n * otherwise you will get the two names separated by a dash\n *\n * @param firstMonth CalendarDate Month\n * @param lastMonth CalendarDate Month\n * @param calendarType calendar type\n * @returns {String}\n */\nconst convertMonthNumbersToMonthNames = (firstMonth: number, lastMonth: number, calendarType?: CalendarType) => {\n\tconst localeData = getCachedLocaleDataInstance(getLocale());\n\tconst pattern = localeData.getIntervalPattern(\"\");\n\tconst secondaryMonthsNames = localeData.getMonthsStandAlone(\"abbreviated\", calendarType) as Array<string>;\n\tconst secondaryMonthsNamesWide = localeData.getMonthsStandAlone(\"wide\", calendarType) as Array<string>;\n\n\tif (firstMonth === lastMonth) {\n\t\treturn {\n\t\t\ttext: localeData.getMonths(\"abbreviated\", calendarType)[firstMonth],\n\t\t\ttextInfo: localeData.getMonths(\"wide\", calendarType)[firstMonth],\n\t\t};\n\t}\n\n\treturn {\n\t\ttext: pattern.replace(/\\{0\\}/, secondaryMonthsNames[firstMonth]).replace(/\\{1\\}/, secondaryMonthsNames[lastMonth]),\n\t\ttextInfo: pattern.replace(/\\{0\\}/, secondaryMonthsNamesWide[firstMonth]).replace(/\\{1\\}/, secondaryMonthsNamesWide[lastMonth]),\n\t};\n};\n\nexport default convertMonthNumbersToMonthNames;\n"]}
1
+ {"version":3,"file":"convertMonthNumbersToMonthNames.js","sourceRoot":"","sources":["../../src/dates/convertMonthNumbersToMonthNames.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kDAAkD,CAAC;AAEzE,OAAO,2BAA2B,MAAM,mCAAmC,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,+BAA+B,GAAG,CAAC,UAAkB,EAAE,SAAiB,EAAE,YAAgC,EAAE,EAAE;IACnH,MAAM,UAAU,GAAG,2BAA2B,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAClD,MAAM,oBAAoB,GAAG,UAAU,CAAC,mBAAmB,CAAC,aAAa,EAAE,YAAY,CAAkB,CAAC;IAC1G,MAAM,wBAAwB,GAAG,UAAU,CAAC,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAkB,CAAC;IAEvG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO;YACN,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,UAAU,CAAC;YACnE,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,UAAU,CAAC;SAChE,CAAC;IACH,CAAC;IAED,OAAO;QACN,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAClH,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;KAC9H,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,+BAA+B,CAAC","sourcesContent":["import getLocale from \"@ui5/webcomponents-base/dist/locale/getLocale.js\";\nimport type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport getCachedLocaleDataInstance from \"../getCachedLocaleDataInstance.js\";\n\n/**\n * Convert month number to month name (text).\n * If the numbers of the two months are the same you will get the name of the month,\n * otherwise you will get the two names separated by a dash\n *\n * @param firstMonth CalendarDate Month\n * @param lastMonth CalendarDate Month\n * @param calendarType calendar type\n * @returns {String}\n */\nconst convertMonthNumbersToMonthNames = (firstMonth: number, lastMonth: number, calendarType?: `${CalendarType}`) => {\n\tconst localeData = getCachedLocaleDataInstance(getLocale());\n\tconst pattern = localeData.getIntervalPattern(\"\");\n\tconst secondaryMonthsNames = localeData.getMonthsStandAlone(\"abbreviated\", calendarType) as Array<string>;\n\tconst secondaryMonthsNamesWide = localeData.getMonthsStandAlone(\"wide\", calendarType) as Array<string>;\n\n\tif (firstMonth === lastMonth) {\n\t\treturn {\n\t\t\ttext: localeData.getMonths(\"abbreviated\", calendarType)[firstMonth],\n\t\t\ttextInfo: localeData.getMonths(\"wide\", calendarType)[firstMonth],\n\t\t};\n\t}\n\n\treturn {\n\t\ttext: pattern.replace(/\\{0\\}/, secondaryMonthsNames[firstMonth]).replace(/\\{1\\}/, secondaryMonthsNames[lastMonth]),\n\t\ttextInfo: pattern.replace(/\\{0\\}/, secondaryMonthsNamesWide[firstMonth]).replace(/\\{1\\}/, secondaryMonthsNamesWide[lastMonth]),\n\t};\n};\n\nexport default convertMonthNumbersToMonthNames;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getRoundedTimestamp.js","sourceRoot":"","sources":["../../src/dates/getRoundedTimestamp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,eAAuB,EAAE,EAAE;IACvD,IAAI,CAAC,eAAe,EAAE;QACrB,yEAAyE;QACzE,eAAe,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;KACvC;IACD,MAAM,OAAO,GAAG,eAAe,GAAG,CAAC,eAAe,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAO,OAAO,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["/**\n * Returns a timestamp with only the year, month and day (with zero hours, minutes and seconds) and without 000 for milliseconds\n * @param { number } millisecondsUTC\n * @returns { number }\n */\nconst getRoundedTimestamp = (millisecondsUTC: number) => {\n\tif (!millisecondsUTC) {\n\t\t// no need to replace with UI5Date, as we don't use any non-UTC functions\n\t\tmillisecondsUTC = new Date().getTime();\n\t}\n\tconst rounded = millisecondsUTC - (millisecondsUTC % (24 * 60 * 60 * 1000));\n\treturn rounded / 1000;\n};\n\nexport default getRoundedTimestamp;\n"]}
1
+ {"version":3,"file":"getRoundedTimestamp.js","sourceRoot":"","sources":["../../src/dates/getRoundedTimestamp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,eAAuB,EAAE,EAAE;IACvD,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,yEAAyE;QACzE,eAAe,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IACD,MAAM,OAAO,GAAG,eAAe,GAAG,CAAC,eAAe,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAO,OAAO,GAAG,IAAI,CAAC;AACvB,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["/**\n * Returns a timestamp with only the year, month and day (with zero hours, minutes and seconds) and without 000 for milliseconds\n * @param { number } millisecondsUTC\n * @returns { number }\n */\nconst getRoundedTimestamp = (millisecondsUTC: number) => {\n\tif (!millisecondsUTC) {\n\t\t// no need to replace with UI5Date, as we don't use any non-UTC functions\n\t\tmillisecondsUTC = new Date().getTime();\n\t}\n\tconst rounded = millisecondsUTC - (millisecondsUTC % (24 * 60 * 60 * 1000));\n\treturn rounded / 1000;\n};\n\nexport default getRoundedTimestamp;\n"]}
@@ -3,5 +3,5 @@ import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.j
3
3
  * Returns a UTC timestamp representing today
4
4
  * @public
5
5
  */
6
- declare const getTodayUTCTimestamp: (primaryCalendarType: CalendarType) => number;
6
+ declare const getTodayUTCTimestamp: (primaryCalendarType: `${CalendarType}`) => number;
7
7
  export default getTodayUTCTimestamp;
@@ -1 +1 @@
1
- {"version":3,"file":"getTodayUTCTimestamp.js","sourceRoot":"","sources":["../../src/dates/getTodayUTCTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,mBAAiC,EAAE,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,mBAAmB,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;AAE9J,eAAe,oBAAoB,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport CalendarDate from \"./CalendarDate.js\";\nimport UI5Date from \"./UI5Date.js\";\n\n/**\n * Returns a UTC timestamp representing today\n * @public\n */\nconst getTodayUTCTimestamp = (primaryCalendarType: CalendarType) => CalendarDate.fromLocalJSDate(UI5Date.getInstance(), primaryCalendarType).valueOf() / 1000;\n\nexport default getTodayUTCTimestamp;\n"]}
1
+ {"version":3,"file":"getTodayUTCTimestamp.js","sourceRoot":"","sources":["../../src/dates/getTodayUTCTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,mBAAsC,EAAE,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,mBAAmB,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;AAEnK,eAAe,oBAAoB,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport CalendarDate from \"./CalendarDate.js\";\nimport UI5Date from \"./UI5Date.js\";\n\n/**\n * Returns a UTC timestamp representing today\n * @public\n */\nconst getTodayUTCTimestamp = (primaryCalendarType: `${CalendarType}`) => CalendarDate.fromLocalJSDate(UI5Date.getInstance(), primaryCalendarType).valueOf() / 1000;\n\nexport default getTodayUTCTimestamp;\n"]}
@@ -6,8 +6,9 @@ import CalendarDate from "./CalendarDate.js";
6
6
  * @param date CalendarDate instance
7
7
  * @param amount how many days/months/years to add (can be a negative number)
8
8
  * @param unit what to modify: "day", "month" or "year"
9
+ * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)
9
10
  * @param minDate minimum date to enforce
10
11
  * @param maxDate maximum date to enforce
11
12
  */
12
- declare const modifyDateBy: (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => CalendarDate;
13
+ declare const modifyDateBy: (date: CalendarDate, amount: number, unit: string, preserveDate?: boolean, minDate?: CalendarDate, maxDate?: CalendarDate) => CalendarDate;
13
14
  export default modifyDateBy;
@@ -6,32 +6,47 @@ import CalendarDate from "./CalendarDate.js";
6
6
  * @param date CalendarDate instance
7
7
  * @param amount how many days/months/years to add (can be a negative number)
8
8
  * @param unit what to modify: "day", "month" or "year"
9
+ * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)
9
10
  * @param minDate minimum date to enforce
10
11
  * @param maxDate maximum date to enforce
11
12
  */
12
- const modifyDateBy = (date, amount, unit, minDate, maxDate) => {
13
+ const modifyDateBy = (date, amount, unit, preserveDate = true, minDate, maxDate) => {
13
14
  const newDate = new CalendarDate(date);
14
- if (unit === "day") {
15
- newDate.setDate(date.getDate() + amount);
15
+ switch (unit) {
16
+ case "day":
17
+ newDate.setDate(date.getDate() + amount);
18
+ break;
19
+ case "month":
20
+ if (preserveDate) {
21
+ newDate.setMonth(date.getMonth() + amount);
22
+ const stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month
23
+ const monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month
24
+ if (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios
25
+ newDate.setDate(0);
26
+ }
27
+ }
28
+ else {
29
+ if (amount === 1) {
30
+ newDate.setMonth(newDate.getMonth() + 1, 1);
31
+ }
32
+ if (amount === -1) {
33
+ newDate.setDate(0);
34
+ }
35
+ }
36
+ break;
37
+ case "year":
38
+ newDate.setYear(date.getYear() + amount);
39
+ if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
40
+ newDate.setDate(0); // Select the last day of the month
41
+ }
42
+ break;
43
+ default:
44
+ break;
16
45
  }
17
- else if (unit === "month") {
18
- newDate.setMonth(date.getMonth() + amount);
19
- const stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month
20
- const monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month
21
- if (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios
22
- newDate.setDate(0);
23
- }
24
- }
25
- else {
26
- newDate.setYear(date.getYear() + amount);
27
- if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
28
- newDate.setDate(0); // Select the last day of the month
29
- }
30
- }
31
- if (minDate && newDate.valueOf() < minDate.valueOf()) {
46
+ if (minDate && newDate.isBefore(minDate)) {
32
47
  return new CalendarDate(minDate);
33
48
  }
34
- if (maxDate && newDate.valueOf() > maxDate.valueOf()) {
49
+ if (maxDate && newDate.isAfter(maxDate)) {
35
50
  return new CalendarDate(maxDate);
36
51
  }
37
52
  return newDate;
@@ -1 +1 @@
1
- {"version":3,"file":"modifyDateBy.js","sourceRoot":"","sources":["../../src/dates/modifyDateBy.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,MAAc,EAAE,IAAY,EAAE,OAAsB,EAAE,OAAsB,EAAE,EAAE;IACzH,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,KAAK,EAAE;QACnB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;KACzC;SAAM,IAAI,IAAI,KAAK,OAAO,EAAE;QAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,yCAAyC;QACzH,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,sCAAsC;QACrH,IAAI,cAAc,IAAI,YAAY,EAAE,EAAE,+DAA+D;YACpG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACnB;KACD;SAAM;QACN,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;QACzC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,kCAAkC;YAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;SACvD;KACD;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE;QACrD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE;QACrD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import CalendarDate from \"./CalendarDate.js\";\n\n/**\n * Adds or subtracts a given amount of days/months/years from a date.\n * If minDate or maxDate are given, the result will be enforced within these limits\n *\n * @param date CalendarDate instance\n * @param amount how many days/months/years to add (can be a negative number)\n * @param unit what to modify: \"day\", \"month\" or \"year\"\n * @param minDate minimum date to enforce\n * @param maxDate maximum date to enforce\n */\nconst modifyDateBy = (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => {\n\tconst newDate = new CalendarDate(date);\n\tif (unit === \"day\") {\n\t\tnewDate.setDate(date.getDate() + amount);\n\t} else if (unit === \"month\") {\n\t\tnewDate.setMonth(date.getMonth() + amount);\n\t\tconst stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month\n\t\tconst monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month\n\t\tif (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios\n\t\t\tnewDate.setDate(0);\n\t\t}\n\t} else {\n\t\tnewDate.setYear(date.getYear() + amount);\n\t\tif (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year\n\t\t\tnewDate.setDate(0); // Select the last day of the month\n\t\t}\n\t}\n\n\tif (minDate && newDate.valueOf() < minDate.valueOf()) {\n\t\treturn new CalendarDate(minDate);\n\t}\n\n\tif (maxDate && newDate.valueOf() > maxDate.valueOf()) {\n\t\treturn new CalendarDate(maxDate);\n\t}\n\n\treturn newDate;\n};\n\nexport default modifyDateBy;\n"]}
1
+ {"version":3,"file":"modifyDateBy.js","sourceRoot":"","sources":["../../src/dates/modifyDateBy.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,MAAc,EAAE,IAAY,EAAE,YAAY,GAAG,IAAI,EAAE,OAAsB,EAAE,OAAsB,EAAE,EAAE;IAC9I,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAEvC,QAAQ,IAAI,EAAE,CAAC;QACf,KAAK,KAAK;YACT,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;YACzC,MAAM;QACP,KAAK,OAAO;YACX,IAAI,YAAY,EAAE,CAAC;gBAClB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;gBAC3C,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,yCAAyC;gBACzH,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,sCAAsC;gBACrH,IAAI,cAAc,IAAI,YAAY,EAAE,CAAC,CAAC,+DAA+D;oBACpG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;oBAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC7C,CAAC;gBACD,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;oBACnB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACpB,CAAC;YACF,CAAC;YACD,MAAM;QACP,KAAK,MAAM;YACV,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;YACzC,IAAI,OAAO,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,kCAAkC;gBAC/E,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC;YACxD,CAAC;YACD,MAAM;QACP;YACC,MAAM;IACP,CAAC;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import CalendarDate from \"./CalendarDate.js\";\n\n/**\n * Adds or subtracts a given amount of days/months/years from a date.\n * If minDate or maxDate are given, the result will be enforced within these limits\n *\n * @param date CalendarDate instance\n * @param amount how many days/months/years to add (can be a negative number)\n * @param unit what to modify: \"day\", \"month\" or \"year\"\n * @param preserveDate whether to preserve the day of the month (f.e. 15th of March + 1 month = 15th of April)\n * @param minDate minimum date to enforce\n * @param maxDate maximum date to enforce\n */\nconst modifyDateBy = (date: CalendarDate, amount: number, unit: string, preserveDate = true, minDate?: CalendarDate, maxDate?: CalendarDate) => {\n\tconst newDate = new CalendarDate(date);\n\n\tswitch (unit) {\n\tcase \"day\":\n\t\tnewDate.setDate(date.getDate() + amount);\n\t\tbreak;\n\tcase \"month\":\n\t\tif (preserveDate) {\n\t\t\tnewDate.setMonth(date.getMonth() + amount);\n\t\t\tconst stillSameMonth = amount === -1 && newDate.getMonth() === date.getMonth(); // f.e. PageUp remained in the same month\n\t\t\tconst monthSkipped = amount === 1 && newDate.getMonth() - date.getMonth() > 1; // f.e. PageDown skipped a whole month\n\t\t\tif (stillSameMonth || monthSkipped) { // Select the last day of the month in any of these 2 scenarios\n\t\t\t\tnewDate.setDate(0);\n\t\t\t}\n\t\t} else {\n\t\t\tif (amount === 1) {\n\t\t\t\tnewDate.setMonth(newDate.getMonth() + 1, 1);\n\t\t\t}\n\t\t\tif (amount === -1) {\n\t\t\t\tnewDate.setDate(0);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase \"year\":\n\t\tnewDate.setYear(date.getYear() + amount);\n\t\tif (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year\n\t\t\tnewDate.setDate(0); // Select the last day of the month\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\n\tif (minDate && newDate.isBefore(minDate)) {\n\t\treturn new CalendarDate(minDate);\n\t}\n\n\tif (maxDate && newDate.isAfter(maxDate)) {\n\t\treturn new CalendarDate(maxDate);\n\t}\n\n\treturn newDate;\n};\n\nexport default modifyDateBy;\n"]}
@@ -1,6 +1,6 @@
1
1
  import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
2
2
  import CalendarDate from "./CalendarDate.js";
3
- declare const transformDateToSecondaryType: (primaryCalendarType: CalendarType | undefined, secondaryCalendarType: CalendarType | undefined, timeStamp: number, hasYearPicker?: boolean) => {
3
+ declare const transformDateToSecondaryType: (primaryCalendarType: `${CalendarType}` | undefined, secondaryCalendarType: `${CalendarType}` | undefined, timeStamp: number, hasYearPicker?: boolean) => {
4
4
  firstDate: CalendarDate;
5
5
  lastDate: CalendarDate;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transformDateToSecondaryType.js","sourceRoot":"","sources":["../../src/dates/transformDateToSecondaryType.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,4BAA4B,GAAG,CAAC,mBAA6C,EAAE,qBAA8C,EAAE,SAAiB,EAAE,aAAuB,EAAE,EAAE;IAClL,IAAI,SAAS,GAAG,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACzG,IAAI,QAAQ,GAAG,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACxG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAErB,IAAI,aAAa,EAAE;QAClB,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;KACtB;IAED,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3C,SAAS,GAAG,IAAI,YAAY,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAC/D,QAAQ,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC7D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport CalendarDate from \"./CalendarDate.js\";\nimport getDaysInMonth from \"./getDaysInMonth.js\";\nimport UI5Date from \"./UI5Date.js\";\n\nconst transformDateToSecondaryType = (primaryCalendarType: CalendarType | undefined, secondaryCalendarType: CalendarType| undefined, timeStamp: number, hasYearPicker?: boolean) => {\n\tlet firstDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(timeStamp * 1000), primaryCalendarType);\n\tlet lastDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(timeStamp * 1000), primaryCalendarType);\n\tfirstDate.setDate(1);\n\n\tif (hasYearPicker) {\n\t\tfirstDate.setMonth(0);\n\t\tlastDate.setMonth(11);\n\t}\n\n\tlastDate.setDate(getDaysInMonth(lastDate));\n\tfirstDate = new CalendarDate(firstDate, secondaryCalendarType);\n\tlastDate = new CalendarDate(lastDate, secondaryCalendarType);\n\treturn { firstDate, lastDate };\n};\n\nexport default transformDateToSecondaryType;\n"]}
1
+ {"version":3,"file":"transformDateToSecondaryType.js","sourceRoot":"","sources":["../../src/dates/transformDateToSecondaryType.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,4BAA4B,GAAG,CAAC,mBAAkD,EAAE,qBAAmD,EAAE,SAAiB,EAAE,aAAuB,EAAE,EAAE;IAC5L,IAAI,SAAS,GAAG,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACzG,IAAI,QAAQ,GAAG,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,mBAAmB,CAAC,CAAC;IACxG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAErB,IAAI,aAAa,EAAE,CAAC;QACnB,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3C,SAAS,GAAG,IAAI,YAAY,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAC/D,QAAQ,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC7D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["import type CalendarType from \"@ui5/webcomponents-base/dist/types/CalendarType.js\";\nimport CalendarDate from \"./CalendarDate.js\";\nimport getDaysInMonth from \"./getDaysInMonth.js\";\nimport UI5Date from \"./UI5Date.js\";\n\nconst transformDateToSecondaryType = (primaryCalendarType: `${CalendarType}` | undefined, secondaryCalendarType: `${CalendarType}`| undefined, timeStamp: number, hasYearPicker?: boolean) => {\n\tlet firstDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(timeStamp * 1000), primaryCalendarType);\n\tlet lastDate = CalendarDate.fromLocalJSDate(UI5Date.getInstance(timeStamp * 1000), primaryCalendarType);\n\tfirstDate.setDate(1);\n\n\tif (hasYearPicker) {\n\t\tfirstDate.setMonth(0);\n\t\tlastDate.setMonth(11);\n\t}\n\n\tlastDate.setDate(getDaysInMonth(lastDate));\n\tfirstDate = new CalendarDate(firstDate, secondaryCalendarType);\n\tlastDate = new CalendarDate(lastDate, secondaryCalendarType);\n\treturn { firstDate, lastDate };\n};\n\nexport default transformDateToSecondaryType;\n"]}
@@ -0,0 +1,27 @@
1
+ Copyright © 1991-2023 Unicode, Inc. All rights reserved.
2
+ Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of the
5
+ Unicode data files and any associated documentation (the "Data Files") or Unicode
6
+ software and any associated documentation (the "Software") to deal in the Data Files
7
+ or Software without restriction, including without limitation the rights to use, copy,
8
+ modify, merge, publish, distribute, and/or sell copies of the Data Files or Software,
9
+ and to permit persons to whom the Data Files or Software are furnished to do so,
10
+ provided that (a) the above copyright notice(s) and this permission notice appear
11
+ with all copies of the Data Files or Software, (b) both the above copyright notice(s)
12
+ and this permission notice appear in associated documentation, and (c) there is clear
13
+ notice in each modified Data File or in the Software as well as in the documentation
14
+ associated with the Data File(s) or Software that the data or software has been modified.
15
+
16
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
19
+ THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
20
+ OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
21
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23
+ OF THE DATA FILES OR SOFTWARE.
24
+
25
+ Except as contained in this notice, the name of a copyright holder shall not be used in
26
+ advertising or otherwise to promote the sale, use or other dealings in these Data Files
27
+ or Software without prior written authorization of the copyright holder.