@ui5/webcomponents-localization 0.0.0-2f7664755 → 0.0.0-31ad69297
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 +733 -0
- package/README.md +2 -1
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-static.js.map +1 -1
- package/dist/Assets.js.map +1 -1
- package/dist/DateFormat.js.map +1 -1
- package/dist/LocaleData.js.map +1 -1
- package/dist/dates/CalendarDate.d.ts +7 -5
- package/dist/dates/CalendarDate.js +8 -7
- package/dist/dates/CalendarDate.js.map +1 -1
- package/dist/dates/ExtremeDates.d.ts +2 -2
- package/dist/dates/ExtremeDates.js.map +1 -1
- package/dist/dates/UI5Date.d.ts +6 -0
- package/dist/dates/UI5Date.js +7 -0
- package/dist/dates/UI5Date.js.map +1 -0
- package/dist/dates/UniversalDate.d.ts +2 -1
- package/dist/dates/UniversalDate.js.map +1 -1
- package/dist/dates/calculateWeekNumber.d.ts +3 -1
- package/dist/dates/calculateWeekNumber.js +6 -6
- package/dist/dates/calculateWeekNumber.js.map +1 -1
- package/dist/dates/convertMonthNumbersToMonthNames.d.ts +1 -1
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -1
- package/dist/dates/getDaysInMonth.js.map +1 -1
- package/dist/dates/getRoundedTimestamp.js +1 -0
- package/dist/dates/getRoundedTimestamp.js.map +1 -1
- package/dist/dates/getTodayUTCTimestamp.d.ts +1 -1
- package/dist/dates/getTodayUTCTimestamp.js +2 -1
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -1
- package/dist/dates/modifyDateBy.d.ts +2 -1
- package/dist/dates/modifyDateBy.js +34 -19
- package/dist/dates/modifyDateBy.js.map +1 -1
- package/dist/dates/transformDateToSecondaryType.d.ts +1 -1
- package/dist/dates/transformDateToSecondaryType.js +3 -2
- package/dist/dates/transformDateToSecondaryType.js.map +1 -1
- package/dist/features/calendar/Buddhist.js.map +1 -1
- package/dist/features/calendar/Gregorian.js.map +1 -1
- package/dist/features/calendar/Islamic.js.map +1 -1
- package/dist/features/calendar/Japanese.js.map +1 -1
- package/dist/features/calendar/Persian.js.map +1 -1
- package/dist/generated/assets/cldr/ar.json +5571 -6704
- package/dist/generated/assets/cldr/ar_EG.json +5571 -6704
- package/dist/generated/assets/cldr/ar_SA.json +5570 -6704
- package/dist/generated/assets/cldr/bg.json +4491 -5742
- package/dist/generated/assets/cldr/ca.json +4478 -5793
- package/dist/generated/assets/cldr/cnr.json +4667 -0
- package/dist/generated/assets/cldr/cs.json +5067 -6294
- package/dist/generated/assets/cldr/cy.json +5479 -6612
- package/dist/generated/assets/cldr/da.json +4371 -5651
- package/dist/generated/assets/cldr/de.json +4420 -5713
- package/dist/generated/assets/cldr/de_AT.json +4421 -5714
- package/dist/generated/assets/cldr/de_CH.json +4419 -5712
- package/dist/generated/assets/cldr/el.json +4309 -5579
- package/dist/generated/assets/cldr/el_CY.json +4309 -5579
- package/dist/generated/assets/cldr/en.json +4342 -5732
- package/dist/generated/assets/cldr/en_AU.json +4382 -5724
- package/dist/generated/assets/cldr/en_GB.json +4373 -5733
- package/dist/generated/assets/cldr/en_HK.json +4382 -5739
- package/dist/generated/assets/cldr/en_IE.json +4373 -5733
- package/dist/generated/assets/cldr/en_IN.json +4378 -5734
- package/dist/generated/assets/cldr/en_NZ.json +4373 -5733
- package/dist/generated/assets/cldr/en_PG.json +4374 -5734
- package/dist/generated/assets/cldr/en_SG.json +4378 -5735
- package/dist/generated/assets/cldr/en_ZA.json +4374 -5734
- package/dist/generated/assets/cldr/es.json +4584 -5641
- package/dist/generated/assets/cldr/es_AR.json +4587 -5643
- package/dist/generated/assets/cldr/es_BO.json +4586 -5642
- package/dist/generated/assets/cldr/es_CL.json +4479 -5643
- package/dist/generated/assets/cldr/es_CO.json +4479 -5642
- package/dist/generated/assets/cldr/es_MX.json +4588 -5644
- package/dist/generated/assets/cldr/es_PE.json +4370 -5642
- package/dist/generated/assets/cldr/es_UY.json +4372 -5644
- package/dist/generated/assets/cldr/es_VE.json +4371 -5643
- package/dist/generated/assets/cldr/et.json +4373 -5729
- package/dist/generated/assets/cldr/fa.json +4429 -5647
- package/dist/generated/assets/cldr/fi.json +4514 -5804
- package/dist/generated/assets/cldr/fr.json +4383 -5741
- package/dist/generated/assets/cldr/fr_BE.json +4383 -5741
- package/dist/generated/assets/cldr/fr_CA.json +4377 -5735
- package/dist/generated/assets/cldr/fr_CH.json +4401 -5759
- package/dist/generated/assets/cldr/fr_LU.json +4383 -5741
- package/dist/generated/assets/cldr/he.json +4980 -6175
- package/dist/generated/assets/cldr/hi.json +4345 -5558
- package/dist/generated/assets/cldr/hr.json +4640 -5681
- package/dist/generated/assets/cldr/hu.json +4415 -5686
- package/dist/generated/assets/cldr/id.json +4132 -5420
- package/dist/generated/assets/cldr/it.json +4355 -5712
- package/dist/generated/assets/cldr/it_CH.json +4355 -5712
- package/dist/generated/assets/cldr/ja.json +4251 -5626
- package/dist/generated/assets/cldr/kk.json +4503 -5487
- package/dist/generated/assets/cldr/ko.json +4210 -5534
- package/dist/generated/assets/cldr/lt.json +4939 -6243
- package/dist/generated/assets/cldr/lv.json +4651 -5874
- package/dist/generated/assets/cldr/mk.json +4408 -0
- package/dist/generated/assets/cldr/ms.json +4093 -5245
- package/dist/generated/assets/cldr/nb.json +4403 -5740
- package/dist/generated/assets/cldr/nl.json +4542 -5613
- package/dist/generated/assets/cldr/nl_BE.json +4542 -5613
- package/dist/generated/assets/cldr/pl.json +4978 -5972
- package/dist/generated/assets/cldr/pt.json +4597 -5567
- package/dist/generated/assets/cldr/pt_PT.json +4648 -5702
- package/dist/generated/assets/cldr/ro.json +4633 -5852
- package/dist/generated/assets/cldr/ru.json +4947 -6169
- package/dist/generated/assets/cldr/ru_UA.json +4947 -6169
- package/dist/generated/assets/cldr/sk.json +4980 -6166
- package/dist/generated/assets/cldr/sl.json +4948 -6136
- package/dist/generated/assets/cldr/sr.json +4737 -5888
- package/dist/generated/assets/cldr/sr_Latn.json +4722 -5889
- package/dist/generated/assets/cldr/sv.json +4406 -5774
- package/dist/generated/assets/cldr/th.json +4234 -5627
- package/dist/generated/assets/cldr/tr.json +4451 -5809
- package/dist/generated/assets/cldr/uk.json +4908 -6115
- package/dist/generated/assets/cldr/vi.json +4094 -5435
- package/dist/generated/assets/cldr/zh_CN.json +4124 -5429
- package/dist/generated/assets/cldr/zh_HK.json +4132 -5437
- package/dist/generated/assets/cldr/zh_SG.json +4132 -5437
- package/dist/generated/assets/cldr/zh_TW.json +4155 -5525
- package/dist/generated/json-imports/LocaleData-static.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-static.js +11 -11
- package/dist/generated/json-imports/LocaleData-static.js.map +1 -0
- package/dist/generated/json-imports/LocaleData.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData.js +88 -88
- package/dist/generated/json-imports/LocaleData.js.map +1 -0
- package/dist/getCachedLocaleDataInstance.js.map +1 -1
- package/dist/locale/getLocaleData.js.map +1 -1
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +2 -239
- package/dist/sap/base/assert.js +28 -1
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/config.js +17 -0
- package/dist/sap/base/i18n/Formatting.js +1133 -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.js.map +1 -1
- 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 +2 -1
- package/dist/sap/ui/core/Configuration.js +4 -1
- package/dist/sap/ui/core/Configuration.js.map +1 -1
- package/dist/sap/ui/core/Core.d.ts +3 -2
- package/dist/sap/ui/core/Core.js.map +1 -1
- package/dist/sap/ui/core/FormatSettings.d.ts +1 -1
- package/dist/sap/ui/core/FormatSettings.js +2 -1
- package/dist/sap/ui/core/FormatSettings.js.map +1 -1
- package/dist/sap/ui/core/Locale.js +190 -155
- package/dist/sap/ui/core/LocaleData.js +2662 -1300
- 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 -87
- package/dist/sap/ui/core/date/CalendarUtils.js +61 -32
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -7
- 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 +210 -115
- 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 +1238 -255
- package/dist/sap/ui/core/date/_Calendars.js +10 -1
- package/dist/sap/ui/core/format/DateFormat.js +3167 -2093
- package/dist/sap/ui/core/format/TimezoneUtil.js +24 -94
- package/package-scripts.cjs +28 -0
- package/package.json +14 -7
- package/tsconfig.json +12 -1
- package/used-modules.txt +25 -1
- package/dist/sap/ui/Device.js +0 -5
- package/package-scripts.js +0 -38
- package/src/Assets-static.ts +0 -2
- package/src/Assets.ts +0 -2
- package/src/DateFormat.ts +0 -8
- package/src/LocaleData.ts +0 -8
- package/src/dates/CalendarDate.ts +0 -232
- package/src/dates/ExtremeDates.ts +0 -40
- package/src/dates/UniversalDate.ts +0 -51
- package/src/dates/calculateWeekNumber.ts +0 -53
- package/src/dates/convertMonthNumbersToMonthNames.ts +0 -34
- package/src/dates/getDaysInMonth.ts +0 -11
- package/src/dates/getRoundedTimestamp.ts +0 -14
- package/src/dates/getTodayUTCTimestamp.ts +0 -10
- package/src/dates/modifyDateBy.ts +0 -42
- package/src/dates/transformDateToSecondaryType.ts +0 -21
- package/src/features/calendar/Buddhist.ts +0 -1
- package/src/features/calendar/Gregorian.ts +0 -1
- package/src/features/calendar/Islamic.ts +0 -1
- package/src/features/calendar/Japanese.ts +0 -1
- package/src/features/calendar/Persian.ts +0 -1
- package/src/getCachedLocaleDataInstance.ts +0 -15
- package/src/locale/getLocaleData.ts +0 -28
- package/src/sap/base/util/LoaderExtensions.ts +0 -17
- package/src/sap/ui/core/Configuration.ts +0 -22
- package/src/sap/ui/core/Core.ts +0 -15
- package/src/sap/ui/core/FormatSettings.ts +0 -15
- /package/{config/.eslintrc.js → .eslintrc.cjs} +0 -0
@@ -1,53 +0,0 @@
|
|
1
|
-
import type Locale from "@ui5/webcomponents-base/dist/locale/Locale.js";
|
2
|
-
import UniversalDate from "./UniversalDate.js";
|
3
|
-
import type LocaleData from "../LocaleData.js";
|
4
|
-
|
5
|
-
const calculateWeekNumber = (confFirstDayOfWeek: number | undefined, oDate: Date, iYear: number, oLocale: Locale, oLocaleData: LocaleData) => {
|
6
|
-
let iWeekNum = 0;
|
7
|
-
let iWeekDay = 0;
|
8
|
-
const iFirstDayOfWeek = Number.isInteger(confFirstDayOfWeek) ? confFirstDayOfWeek! : oLocaleData.getFirstDayOfWeek();
|
9
|
-
|
10
|
-
// search Locale for containing "en-US", since sometimes
|
11
|
-
// when any user settings have been defined, subtag "sapufmt" is added to the locale name
|
12
|
-
// this is described inside sap.ui.core.Configuration file
|
13
|
-
if (oLocale && (oLocale.getLanguage() === "en" && oLocale.getRegion() === "US")) {
|
14
|
-
/*
|
15
|
-
* in US the week starts with Sunday
|
16
|
-
* The first week of the year starts with January 1st. But Dec. 31 is still in the last year
|
17
|
-
* So the week beginning in December and ending in January has 2 week numbers
|
18
|
-
*/
|
19
|
-
const oJanFirst = new UniversalDate(oDate.getTime());
|
20
|
-
oJanFirst.setUTCFullYear(iYear, 0, 1);
|
21
|
-
iWeekDay = oJanFirst.getUTCDay();
|
22
|
-
|
23
|
-
// get the date for the same weekday like jan 1.
|
24
|
-
const oCheckDate = new UniversalDate(oDate.getTime());
|
25
|
-
oCheckDate.setUTCDate(oCheckDate.getUTCDate() - oCheckDate.getUTCDay() + iWeekDay);
|
26
|
-
|
27
|
-
iWeekNum = Math.round((oCheckDate.getTime() - oJanFirst.getTime()) / 86400000 / 7) + 1;
|
28
|
-
} else {
|
29
|
-
// normally the first week of the year is the one where the first Thursday of the year is
|
30
|
-
// find Thursday of this week
|
31
|
-
// if the checked day is before the 1. day of the week use a day of the previous week to check
|
32
|
-
const oThursday = new UniversalDate(oDate.getTime());
|
33
|
-
oThursday.setUTCDate(oThursday.getUTCDate() - iFirstDayOfWeek);
|
34
|
-
iWeekDay = oThursday.getUTCDay();
|
35
|
-
oThursday.setUTCDate(oThursday.getUTCDate() - iWeekDay + 4);
|
36
|
-
|
37
|
-
const oFirstDayOfYear = new UniversalDate(oThursday.getTime());
|
38
|
-
oFirstDayOfYear.setUTCMonth(0, 1);
|
39
|
-
iWeekDay = oFirstDayOfYear.getUTCDay();
|
40
|
-
let iAddDays = 0;
|
41
|
-
if (iWeekDay > 4) {
|
42
|
-
iAddDays = 7; // first day of year is after Thursday, so first Thursday is in the next week
|
43
|
-
}
|
44
|
-
const oFirstThursday = new UniversalDate(oFirstDayOfYear.getTime());
|
45
|
-
oFirstThursday.setUTCDate(1 - iWeekDay + 4 + iAddDays);
|
46
|
-
|
47
|
-
iWeekNum = Math.round((oThursday.getTime() - oFirstThursday.getTime()) / 86400000 / 7) + 1;
|
48
|
-
}
|
49
|
-
|
50
|
-
return iWeekNum;
|
51
|
-
};
|
52
|
-
|
53
|
-
export default calculateWeekNumber;
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
2
|
-
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
3
|
-
import getCachedLocaleDataInstance from "../getCachedLocaleDataInstance.js";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Convert month number to month name (text).
|
7
|
-
* If the numbers of the two months are the same you will get the name of the month,
|
8
|
-
* otherwise you will get the two names separated by a dash
|
9
|
-
*
|
10
|
-
* @param firstMonth CalendarDate Month
|
11
|
-
* @param lastMonth CalendarDate Month
|
12
|
-
* @param calendarType calendar type
|
13
|
-
* @returns {String}
|
14
|
-
*/
|
15
|
-
const convertMonthNumbersToMonthNames = (firstMonth: number, lastMonth: number, calendarType?: CalendarType) => {
|
16
|
-
const localeData = getCachedLocaleDataInstance(getLocale());
|
17
|
-
const pattern = localeData.getIntervalPattern("");
|
18
|
-
const secondaryMonthsNames = localeData.getMonthsStandAlone("abbreviated", calendarType) as Array<string>;
|
19
|
-
const secondaryMonthsNamesWide = localeData.getMonthsStandAlone("wide", calendarType) as Array<string>;
|
20
|
-
|
21
|
-
if (firstMonth === lastMonth) {
|
22
|
-
return {
|
23
|
-
text: localeData.getMonths("abbreviated", calendarType)[firstMonth],
|
24
|
-
textInfo: localeData.getMonths("wide", calendarType)[firstMonth],
|
25
|
-
};
|
26
|
-
}
|
27
|
-
|
28
|
-
return {
|
29
|
-
text: pattern.replace(/\{0\}/, secondaryMonthsNames[firstMonth]).replace(/\{1\}/, secondaryMonthsNames[lastMonth]),
|
30
|
-
textInfo: pattern.replace(/\{0\}/, secondaryMonthsNamesWide[firstMonth]).replace(/\{1\}/, secondaryMonthsNamesWide[lastMonth]),
|
31
|
-
};
|
32
|
-
};
|
33
|
-
|
34
|
-
export default convertMonthNumbersToMonthNames;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import CalendarDate from "./CalendarDate.js";
|
2
|
-
|
3
|
-
const getDaysInMonth = (date: CalendarDate) => {
|
4
|
-
const tempCalendarDate = new CalendarDate(date);
|
5
|
-
tempCalendarDate.setDate(1);
|
6
|
-
tempCalendarDate.setMonth(tempCalendarDate.getMonth() + 1);
|
7
|
-
tempCalendarDate.setDate(0);
|
8
|
-
return tempCalendarDate.getDate();
|
9
|
-
};
|
10
|
-
|
11
|
-
export default getDaysInMonth;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Returns a timestamp with only the year, month and day (with zero hours, minutes and seconds) and without 000 for milliseconds
|
3
|
-
* @param { number } millisecondsUTC
|
4
|
-
* @returns { number }
|
5
|
-
*/
|
6
|
-
const getRoundedTimestamp = (millisecondsUTC: number) => {
|
7
|
-
if (!millisecondsUTC) {
|
8
|
-
millisecondsUTC = new Date().getTime();
|
9
|
-
}
|
10
|
-
const rounded = millisecondsUTC - (millisecondsUTC % (24 * 60 * 60 * 1000));
|
11
|
-
return rounded / 1000;
|
12
|
-
};
|
13
|
-
|
14
|
-
export default getRoundedTimestamp;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
2
|
-
import CalendarDate from "./CalendarDate.js";
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Returns a UTC timestamp representing today
|
6
|
-
* @public
|
7
|
-
*/
|
8
|
-
const getTodayUTCTimestamp = (primaryCalendarType: CalendarType) => CalendarDate.fromLocalJSDate(new Date(), primaryCalendarType).valueOf() / 1000;
|
9
|
-
|
10
|
-
export default getTodayUTCTimestamp;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import CalendarDate from "./CalendarDate.js";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Adds or subtracts a given amount of days/months/years from a date.
|
5
|
-
* If minDate or maxDate are given, the result will be enforced within these limits
|
6
|
-
*
|
7
|
-
* @param date CalendarDate instance
|
8
|
-
* @param amount how many days/months/years to add (can be a negative number)
|
9
|
-
* @param unit what to modify: "day", "month" or "year"
|
10
|
-
* @param minDate minimum date to enforce
|
11
|
-
* @param maxDate maximum date to enforce
|
12
|
-
*/
|
13
|
-
const modifyDateBy = (date: CalendarDate, amount: number, unit: string, minDate?: CalendarDate, maxDate?: CalendarDate) => {
|
14
|
-
const newDate = new CalendarDate(date);
|
15
|
-
if (unit === "day") {
|
16
|
-
newDate.setDate(date.getDate() + amount);
|
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
|
-
} else {
|
25
|
-
newDate.setYear(date.getYear() + amount);
|
26
|
-
if (newDate.getMonth() !== date.getMonth()) { // f.e. 29th Feb to next/prev year
|
27
|
-
newDate.setDate(0); // Select the last day of the month
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
if (minDate && newDate.valueOf() < minDate.valueOf()) {
|
32
|
-
return new CalendarDate(minDate);
|
33
|
-
}
|
34
|
-
|
35
|
-
if (maxDate && newDate.valueOf() > maxDate.valueOf()) {
|
36
|
-
return new CalendarDate(maxDate);
|
37
|
-
}
|
38
|
-
|
39
|
-
return newDate;
|
40
|
-
};
|
41
|
-
|
42
|
-
export default modifyDateBy;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import type CalendarType from "@ui5/webcomponents-base/dist/types/CalendarType.js";
|
2
|
-
import CalendarDate from "./CalendarDate.js";
|
3
|
-
import getDaysInMonth from "./getDaysInMonth.js";
|
4
|
-
|
5
|
-
const transformDateToSecondaryType = (primaryCalendarType: CalendarType | undefined, secondaryCalendarType: CalendarType| undefined, timeStamp: number, hasYearPicker?: boolean) => {
|
6
|
-
let firstDate = CalendarDate.fromLocalJSDate(new Date(timeStamp * 1000), primaryCalendarType);
|
7
|
-
let lastDate = CalendarDate.fromLocalJSDate(new Date(timeStamp * 1000), primaryCalendarType);
|
8
|
-
firstDate.setDate(1);
|
9
|
-
|
10
|
-
if (hasYearPicker) {
|
11
|
-
firstDate.setMonth(0);
|
12
|
-
lastDate.setMonth(11);
|
13
|
-
}
|
14
|
-
|
15
|
-
lastDate.setDate(getDaysInMonth(lastDate));
|
16
|
-
firstDate = new CalendarDate(firstDate, secondaryCalendarType);
|
17
|
-
lastDate = new CalendarDate(lastDate, secondaryCalendarType);
|
18
|
-
return { firstDate, lastDate };
|
19
|
-
};
|
20
|
-
|
21
|
-
export default transformDateToSecondaryType;
|
@@ -1 +0,0 @@
|
|
1
|
-
import "../../sap/ui/core/date/Buddhist.js";
|
@@ -1 +0,0 @@
|
|
1
|
-
import "../../sap/ui/core/date/Gregorian.js";
|
@@ -1 +0,0 @@
|
|
1
|
-
import "../../sap/ui/core/date/Islamic.js";
|
@@ -1 +0,0 @@
|
|
1
|
-
import "../../sap/ui/core/date/Japanese.js";
|
@@ -1 +0,0 @@
|
|
1
|
-
import "../../sap/ui/core/date/Persian.js";
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type Locale from "@ui5/webcomponents-base/dist/locale/Locale.js";
|
2
|
-
import type LocaleT from "sap/ui/core/Locale";
|
3
|
-
import LocaleData from "./LocaleData.js";
|
4
|
-
|
5
|
-
const cache = new Map<Locale, LocaleData>();
|
6
|
-
|
7
|
-
const getCachedLocaleDataInstance = (locale: Locale) => {
|
8
|
-
if (!cache.has(locale)) {
|
9
|
-
cache.set(locale, new LocaleData(locale as unknown as LocaleT));
|
10
|
-
}
|
11
|
-
|
12
|
-
return cache.get(locale)!;
|
13
|
-
};
|
14
|
-
|
15
|
-
export default getCachedLocaleDataInstance;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { fetchCldr } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
|
-
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
3
|
-
import type LocaleT from "sap/ui/core/Locale";
|
4
|
-
import LocaleData from "../LocaleData.js";
|
5
|
-
|
6
|
-
const instances = new Map<string, LocaleData>();
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Fetches and returns а LocaleData object for the required locale
|
10
|
-
* For more information on this object's API, please see:
|
11
|
-
* https://sdk.openui5.org/api/sap.ui.core.LocaleData
|
12
|
-
*
|
13
|
-
* @param { string } lang - if left empty, will use the configured/current locale
|
14
|
-
* @returns { Promise<LocaleData> }
|
15
|
-
*/
|
16
|
-
const getLocaleData = async (lang: string): Promise<LocaleData> => {
|
17
|
-
const locale = getLocale(lang);
|
18
|
-
const localeLang = locale.getLanguage();
|
19
|
-
|
20
|
-
if (!instances.has(localeLang)) {
|
21
|
-
await fetchCldr(locale.getLanguage(), locale.getRegion(), locale.getScript());
|
22
|
-
instances.set(localeLang, new LocaleData(locale as unknown as LocaleT));
|
23
|
-
}
|
24
|
-
|
25
|
-
return instances.get(localeLang)!;
|
26
|
-
};
|
27
|
-
|
28
|
-
export default getLocaleData;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { getLocaleData } from "@ui5/webcomponents-base/dist/asset-registries/LocaleData.js";
|
2
|
-
|
3
|
-
const loadResource = (moduleName: string) => {
|
4
|
-
const moduleFormat = moduleName.match(/sap\/ui\/core\/cldr\/(\w+)\.json/);
|
5
|
-
if (!moduleFormat) {
|
6
|
-
throw new Error(`Unknown module "${moduleName}"`);
|
7
|
-
}
|
8
|
-
|
9
|
-
const localeId = moduleFormat[1];
|
10
|
-
return getLocaleData(localeId);
|
11
|
-
};
|
12
|
-
|
13
|
-
const LoaderExtensions = {
|
14
|
-
loadResource,
|
15
|
-
};
|
16
|
-
|
17
|
-
export default LoaderExtensions;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
|
2
|
-
import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
|
3
|
-
import getDesigntimePropertyAsArray from "@ui5/webcomponents-base/dist/util/getDesigntimePropertyAsArray.js";
|
4
|
-
// @ts-ignore
|
5
|
-
import TimezoneUtil from "./format/TimezoneUtil.js";
|
6
|
-
import FormatSettings from "./FormatSettings.js";
|
7
|
-
|
8
|
-
const emptyFn = () => {};
|
9
|
-
|
10
|
-
/**
|
11
|
-
* OpenUI5 Configuration Shim
|
12
|
-
*/
|
13
|
-
const Configuration = {
|
14
|
-
getLanguage,
|
15
|
-
getCalendarType,
|
16
|
-
getSupportedLanguages: () => getDesigntimePropertyAsArray("$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$"),
|
17
|
-
getOriginInfo: emptyFn,
|
18
|
-
getFormatSettings: () => FormatSettings,
|
19
|
-
getTimezone: () => TimezoneUtil.getLocalTimezone() as string,
|
20
|
-
};
|
21
|
-
|
22
|
-
export default Configuration;
|
package/src/sap/ui/core/Core.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import FormatSettings from "./FormatSettings.js";
|
2
|
-
import Configuration from "./Configuration.js";
|
3
|
-
|
4
|
-
const emptyFn = () => {};
|
5
|
-
|
6
|
-
/**
|
7
|
-
* OpenUI5 Core shim
|
8
|
-
*/
|
9
|
-
const Core = {
|
10
|
-
getConfiguration: () => Configuration,
|
11
|
-
getLibraryResourceBundle: emptyFn(),
|
12
|
-
getFormatSettings: () => FormatSettings,
|
13
|
-
};
|
14
|
-
|
15
|
-
export default Core;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
|
2
|
-
|
3
|
-
const emptyFn = () => {};
|
4
|
-
|
5
|
-
/**
|
6
|
-
* OpenUI5 FormatSettings shim
|
7
|
-
*/
|
8
|
-
const FormatSettings = {
|
9
|
-
getFormatLocale: getLocale,
|
10
|
-
getLegacyDateFormat: emptyFn,
|
11
|
-
getLegacyDateCalendarCustomizing: emptyFn,
|
12
|
-
getCustomLocaleData: emptyFn,
|
13
|
-
};
|
14
|
-
|
15
|
-
export default FormatSettings;
|
File without changes
|