@ui5/webcomponents-localization 0.0.0-037d08c67
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 +6 -0
- package/.eslintrc.cjs +3 -0
- package/.npsrc.json +3 -0
- package/CHANGELOG.md +2261 -0
- package/LICENSE.txt +201 -0
- package/README.md +51 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-fetch.d.ts +1 -0
- package/dist/Assets-fetch.js +3 -0
- package/dist/Assets-fetch.js.map +1 -0
- package/dist/Assets-node.d.ts +11 -0
- package/dist/Assets-node.js +12 -0
- package/dist/Assets-node.js.map +1 -0
- package/dist/Assets.d.ts +1 -0
- package/dist/Assets.js +3 -0
- package/dist/Assets.js.map +1 -0
- package/dist/CalendarUtils.d.ts +3 -0
- package/dist/CalendarUtils.js +6 -0
- package/dist/CalendarUtils.js.map +1 -0
- package/dist/DateFormat.d.ts +5 -0
- package/dist/DateFormat.js +7 -0
- package/dist/DateFormat.js.map +1 -0
- package/dist/LocaleData.d.ts +5 -0
- package/dist/LocaleData.js +7 -0
- package/dist/LocaleData.js.map +1 -0
- package/dist/NumberFormat.d.ts +5 -0
- package/dist/NumberFormat.js +7 -0
- package/dist/NumberFormat.js.map +1 -0
- package/dist/dates/CalendarDate.d.ts +42 -0
- package/dist/dates/CalendarDate.js +193 -0
- package/dist/dates/CalendarDate.js.map +1 -0
- package/dist/dates/ExtremeDates.d.ts +5 -0
- package/dist/dates/ExtremeDates.js +29 -0
- package/dist/dates/ExtremeDates.js.map +1 -0
- package/dist/dates/UI5Date.d.ts +5 -0
- package/dist/dates/UI5Date.js +7 -0
- package/dist/dates/UI5Date.js.map +1 -0
- package/dist/dates/UniversalDate.d.ts +47 -0
- package/dist/dates/UniversalDate.js +5 -0
- package/dist/dates/UniversalDate.js.map +1 -0
- package/dist/dates/convertMonthNumbersToMonthNames.d.ts +16 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js +30 -0
- package/dist/dates/convertMonthNumbersToMonthNames.js.map +1 -0
- package/dist/dates/getDaysInMonth.d.ts +3 -0
- package/dist/dates/getDaysInMonth.js +10 -0
- package/dist/dates/getDaysInMonth.js.map +1 -0
- package/dist/dates/getRoundedTimestamp.d.ts +7 -0
- package/dist/dates/getRoundedTimestamp.js +15 -0
- package/dist/dates/getRoundedTimestamp.js.map +1 -0
- package/dist/dates/getTodayUTCTimestamp.d.ts +7 -0
- package/dist/dates/getTodayUTCTimestamp.js +9 -0
- package/dist/dates/getTodayUTCTimestamp.js.map +1 -0
- package/dist/dates/modifyDateBy.d.ts +14 -0
- package/dist/dates/modifyDateBy.js +55 -0
- package/dist/dates/modifyDateBy.js.map +1 -0
- package/dist/dates/transformDateToSecondaryType.d.ts +7 -0
- package/dist/dates/transformDateToSecondaryType.js +18 -0
- package/dist/dates/transformDateToSecondaryType.js.map +1 -0
- package/dist/features/calendar/Buddhist.d.ts +1 -0
- package/dist/features/calendar/Buddhist.js +2 -0
- package/dist/features/calendar/Buddhist.js.map +1 -0
- package/dist/features/calendar/Gregorian.d.ts +1 -0
- package/dist/features/calendar/Gregorian.js +2 -0
- package/dist/features/calendar/Gregorian.js.map +1 -0
- package/dist/features/calendar/Islamic.d.ts +1 -0
- package/dist/features/calendar/Islamic.js +2 -0
- package/dist/features/calendar/Islamic.js.map +1 -0
- package/dist/features/calendar/Japanese.d.ts +1 -0
- package/dist/features/calendar/Japanese.js +2 -0
- package/dist/features/calendar/Japanese.js.map +1 -0
- package/dist/features/calendar/Persian.d.ts +1 -0
- package/dist/features/calendar/Persian.js +2 -0
- package/dist/features/calendar/Persian.js.map +1 -0
- package/dist/generated/assets/cldr/Unicode-Data-Files-LICENSE.txt +27 -0
- package/dist/generated/assets/cldr/ar.json +7087 -0
- package/dist/generated/assets/cldr/ar_EG.json +7087 -0
- package/dist/generated/assets/cldr/ar_SA.json +7086 -0
- package/dist/generated/assets/cldr/bg.json +5981 -0
- package/dist/generated/assets/cldr/ca.json +6083 -0
- package/dist/generated/assets/cldr/cnr.json +6169 -0
- package/dist/generated/assets/cldr/cs.json +6709 -0
- package/dist/generated/assets/cldr/cy.json +6932 -0
- package/dist/generated/assets/cldr/da.json +5927 -0
- package/dist/generated/assets/cldr/de.json +6048 -0
- package/dist/generated/assets/cldr/de_AT.json +6049 -0
- package/dist/generated/assets/cldr/de_CH.json +6047 -0
- package/dist/generated/assets/cldr/el.json +5832 -0
- package/dist/generated/assets/cldr/el_CY.json +5832 -0
- package/dist/generated/assets/cldr/en.json +6044 -0
- package/dist/generated/assets/cldr/en_AU.json +6084 -0
- package/dist/generated/assets/cldr/en_GB.json +6075 -0
- package/dist/generated/assets/cldr/en_HK.json +6084 -0
- package/dist/generated/assets/cldr/en_IE.json +6075 -0
- package/dist/generated/assets/cldr/en_IN.json +6080 -0
- package/dist/generated/assets/cldr/en_NZ.json +6075 -0
- package/dist/generated/assets/cldr/en_PG.json +6076 -0
- package/dist/generated/assets/cldr/en_SG.json +6080 -0
- package/dist/generated/assets/cldr/en_ZA.json +6076 -0
- package/dist/generated/assets/cldr/es.json +6103 -0
- package/dist/generated/assets/cldr/es_AR.json +6106 -0
- package/dist/generated/assets/cldr/es_BO.json +6105 -0
- package/dist/generated/assets/cldr/es_CL.json +5998 -0
- package/dist/generated/assets/cldr/es_CO.json +5998 -0
- package/dist/generated/assets/cldr/es_MX.json +6107 -0
- package/dist/generated/assets/cldr/es_PE.json +5889 -0
- package/dist/generated/assets/cldr/es_UY.json +5891 -0
- package/dist/generated/assets/cldr/es_VE.json +5890 -0
- package/dist/generated/assets/cldr/et.json +6027 -0
- package/dist/generated/assets/cldr/fa.json +5950 -0
- package/dist/generated/assets/cldr/fi.json +6195 -0
- package/dist/generated/assets/cldr/fr.json +5997 -0
- package/dist/generated/assets/cldr/fr_BE.json +5997 -0
- package/dist/generated/assets/cldr/fr_CA.json +5991 -0
- package/dist/generated/assets/cldr/fr_CH.json +6015 -0
- package/dist/generated/assets/cldr/fr_LU.json +5997 -0
- package/dist/generated/assets/cldr/he.json +6541 -0
- package/dist/generated/assets/cldr/hi.json +5859 -0
- package/dist/generated/assets/cldr/hr.json +6196 -0
- package/dist/generated/assets/cldr/hu.json +5945 -0
- package/dist/generated/assets/cldr/id.json +5730 -0
- package/dist/generated/assets/cldr/it.json +5986 -0
- package/dist/generated/assets/cldr/it_CH.json +5986 -0
- package/dist/generated/assets/cldr/ja.json +5889 -0
- package/dist/generated/assets/cldr/kk.json +5939 -0
- package/dist/generated/assets/cldr/ko.json +5770 -0
- package/dist/generated/assets/cldr/lt.json +6578 -0
- package/dist/generated/assets/cldr/lv.json +6114 -0
- package/dist/generated/assets/cldr/mk.json +6045 -0
- package/dist/generated/assets/cldr/ms.json +5564 -0
- package/dist/generated/assets/cldr/nb.json +6035 -0
- package/dist/generated/assets/cldr/nl.json +6202 -0
- package/dist/generated/assets/cldr/nl_BE.json +6202 -0
- package/dist/generated/assets/cldr/pl.json +6589 -0
- package/dist/generated/assets/cldr/pt.json +6115 -0
- package/dist/generated/assets/cldr/pt_PT.json +6180 -0
- package/dist/generated/assets/cldr/ro.json +6200 -0
- package/dist/generated/assets/cldr/ru.json +6503 -0
- package/dist/generated/assets/cldr/ru_UA.json +6503 -0
- package/dist/generated/assets/cldr/sk.json +6432 -0
- package/dist/generated/assets/cldr/sl.json +6444 -0
- package/dist/generated/assets/cldr/sr.json +6241 -0
- package/dist/generated/assets/cldr/sr_Latn.json +6226 -0
- package/dist/generated/assets/cldr/sv.json +6076 -0
- package/dist/generated/assets/cldr/th.json +5875 -0
- package/dist/generated/assets/cldr/tr.json +6094 -0
- package/dist/generated/assets/cldr/uk.json +6454 -0
- package/dist/generated/assets/cldr/vi.json +5669 -0
- package/dist/generated/assets/cldr/zh_CN.json +5717 -0
- package/dist/generated/assets/cldr/zh_HK.json +5726 -0
- package/dist/generated/assets/cldr/zh_SG.json +5726 -0
- package/dist/generated/assets/cldr/zh_TW.json +5793 -0
- package/dist/generated/json-imports/LocaleData-fetch.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-fetch.js +93 -0
- package/dist/generated/json-imports/LocaleData-fetch.js.map +1 -0
- package/dist/generated/json-imports/LocaleData-node.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData-node.js +93 -0
- package/dist/generated/json-imports/LocaleData-node.js.map +1 -0
- package/dist/generated/json-imports/LocaleData.d.ts +1 -0
- package/dist/generated/json-imports/LocaleData.js +93 -0
- package/dist/generated/json-imports/LocaleData.js.map +1 -0
- package/dist/getCachedLocaleDataInstance.d.ts +4 -0
- package/dist/getCachedLocaleDataInstance.js +10 -0
- package/dist/getCachedLocaleDataInstance.js.map +1 -0
- package/dist/locale/getLocaleData.d.ts +11 -0
- package/dist/locale/getLocaleData.js +23 -0
- package/dist/locale/getLocaleData.js.map +1 -0
- package/dist/sap/base/Event.js +59 -0
- package/dist/sap/base/Eventing.js +146 -0
- package/dist/sap/base/Log.js +3 -0
- package/dist/sap/base/assert.js +34 -0
- package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/sap/base/config.js +17 -0
- package/dist/sap/base/i18n/Formatting.d.ts +8 -0
- package/dist/sap/base/i18n/Formatting.js +11 -0
- package/dist/sap/base/i18n/Formatting.js.map +1 -0
- package/dist/sap/base/i18n/LanguageTag.js +173 -0
- package/dist/sap/base/i18n/Localization.d.ts +4 -0
- package/dist/sap/base/i18n/Localization.js +12 -0
- package/dist/sap/base/i18n/Localization.js.map +1 -0
- package/dist/sap/base/i18n/date/CalendarType.js +43 -0
- package/dist/sap/base/i18n/date/CalendarWeekNumbering.js +105 -0
- package/dist/sap/base/i18n/date/TimezoneUtils.js +319 -0
- package/dist/sap/base/strings/camelize.js +30 -0
- package/dist/sap/base/strings/formatMessage.js +93 -0
- package/dist/sap/base/util/LoaderExtensions.d.ts +4 -0
- package/dist/sap/base/util/LoaderExtensions.js +14 -0
- package/dist/sap/base/util/LoaderExtensions.js.map +1 -0
- package/dist/sap/base/util/ObjectPath.d.ts +4 -0
- package/dist/sap/base/util/ObjectPath.js +6 -0
- 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 +89 -0
- package/dist/sap/base/util/array/uniqueSort.js +41 -0
- package/dist/sap/base/util/deepClone.js +102 -0
- package/dist/sap/base/util/deepEqual.js +83 -0
- package/dist/sap/base/util/extend.js +61 -0
- package/dist/sap/base/util/isEmptyObject.js +34 -0
- package/dist/sap/base/util/isPlainObject.js +52 -0
- package/dist/sap/base/util/now.js +28 -0
- 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 +72 -0
- package/dist/sap/ui/base/Metadata.js +483 -0
- package/dist/sap/ui/base/Object.js +300 -0
- package/dist/sap/ui/core/CalendarType.js +24 -0
- package/dist/sap/ui/core/Configuration.d.ts +17 -0
- package/dist/sap/ui/core/Configuration.js +23 -0
- package/dist/sap/ui/core/Configuration.js.map +1 -0
- package/dist/sap/ui/core/Core.d.ts +25 -0
- package/dist/sap/ui/core/Core.js +13 -0
- package/dist/sap/ui/core/Core.js.map +1 -0
- package/dist/sap/ui/core/FormatSettings.d.ts +9 -0
- package/dist/sap/ui/core/FormatSettings.js +12 -0
- package/dist/sap/ui/core/FormatSettings.js.map +1 -0
- package/dist/sap/ui/core/Locale.js +194 -0
- package/dist/sap/ui/core/LocaleData.js +2717 -0
- 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 +196 -0
- package/dist/sap/ui/core/date/CalendarUtils.js +65 -0
- package/dist/sap/ui/core/date/CalendarWeekNumbering.js +30 -0
- package/dist/sap/ui/core/date/Gregorian.js +32 -0
- package/dist/sap/ui/core/date/Islamic.js +367 -0
- package/dist/sap/ui/core/date/Japanese.js +257 -0
- package/dist/sap/ui/core/date/Persian.js +394 -0
- package/dist/sap/ui/core/date/UI5Date.js +991 -0
- package/dist/sap/ui/core/date/UniversalDate.js +1324 -0
- package/dist/sap/ui/core/date/_Calendars.js +22 -0
- package/dist/sap/ui/core/format/DateFormat.js +3310 -0
- package/dist/sap/ui/core/format/NumberFormat.js +2835 -0
- package/dist/sap/ui/core/format/TimezoneUtil.js +24 -0
- package/package-scripts.cjs +35 -0
- package/package.json +46 -0
- package/tsconfig.json +24 -0
- package/used-modules.txt +52 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
// Provides class sap.ui.core.date.Japanese
|
|
7
|
+
import UniversalDate from "./UniversalDate.js";
|
|
8
|
+
import CalendarType from "../CalendarType.js";
|
|
9
|
+
import _Calendars from "./_Calendars.js";
|
|
10
|
+
/**
|
|
11
|
+
* The Japanese date class
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
* The Japanese date adds support for era, by returning the CLDR era type in the getEra method and calculating
|
|
15
|
+
* the year dependent on the current era.
|
|
16
|
+
*
|
|
17
|
+
* For the constructor and the UTC method, for the year parameter the following rules apply:
|
|
18
|
+
* - A year less than 100 will be treated as year of the current emperor era
|
|
19
|
+
* - A year equal or more than 100 will be treated as a gregorian year
|
|
20
|
+
* - An array with two entries will be treated as era and emperor year
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @alias sap.ui.core.date.Japanese
|
|
24
|
+
* @extends sap.ui.core.date.UniversalDate
|
|
25
|
+
*/
|
|
26
|
+
var Japanese = UniversalDate.extend("sap.ui.core.date.Japanese", /** @lends sap.ui.core.date.Japanese.prototype */{
|
|
27
|
+
constructor: function () {
|
|
28
|
+
var aArgs = arguments;
|
|
29
|
+
if (aArgs.length > 1) {
|
|
30
|
+
aArgs = toGregorianArguments(aArgs);
|
|
31
|
+
}
|
|
32
|
+
this.oDate = this.createDate(Date, aArgs);
|
|
33
|
+
this.sCalendarType = CalendarType.Japanese;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Japanese.UTC = function () {
|
|
37
|
+
var aArgs = toGregorianArguments(arguments);
|
|
38
|
+
return Date.UTC.apply(Date, aArgs);
|
|
39
|
+
};
|
|
40
|
+
Japanese.now = function () {
|
|
41
|
+
return Date.now();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Find the matching japanese date for the given gregorian date
|
|
46
|
+
*
|
|
47
|
+
* @param {object} oGregorian
|
|
48
|
+
* @return {object}
|
|
49
|
+
*/
|
|
50
|
+
function toJapanese(oGregorian) {
|
|
51
|
+
var iEra = UniversalDate.getEraByDate(CalendarType.Japanese, oGregorian.year, oGregorian.month, oGregorian.day),
|
|
52
|
+
iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra).year;
|
|
53
|
+
return {
|
|
54
|
+
era: iEra,
|
|
55
|
+
year: oGregorian.year - iEraStartYear + 1,
|
|
56
|
+
month: oGregorian.month,
|
|
57
|
+
day: oGregorian.day
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Calculate Gregorian year from Japanese era and year
|
|
63
|
+
*
|
|
64
|
+
* @param {object} oJapanese
|
|
65
|
+
* @return {int}
|
|
66
|
+
*/
|
|
67
|
+
function toGregorian(oJapanese) {
|
|
68
|
+
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Japanese, oJapanese.era).year;
|
|
69
|
+
return {
|
|
70
|
+
year: iEraStartYear + oJapanese.year - 1,
|
|
71
|
+
month: oJapanese.month,
|
|
72
|
+
day: oJapanese.day
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Convert arguments array from Japanese date to Gregorian data.
|
|
78
|
+
*
|
|
79
|
+
* @param {int[]|any[]} aArgs Array with year (or [era, year]), month and day (optional) according to Japanese calendar
|
|
80
|
+
* @returns {int[]} Array with year, month and day according to the Gregorian calendar
|
|
81
|
+
*/
|
|
82
|
+
function toGregorianArguments(aArgs) {
|
|
83
|
+
var oJapanese,
|
|
84
|
+
oGregorian,
|
|
85
|
+
iEra,
|
|
86
|
+
vYear = aArgs[0];
|
|
87
|
+
if (typeof vYear == "number") {
|
|
88
|
+
if (vYear >= 100) {
|
|
89
|
+
// Year greater than 100 will be treated as gregorian year
|
|
90
|
+
return aArgs;
|
|
91
|
+
} else {
|
|
92
|
+
// Year less than 100 is emperor year in the current era
|
|
93
|
+
iEra = UniversalDate.getCurrentEra(CalendarType.Japanese);
|
|
94
|
+
vYear = [iEra, vYear];
|
|
95
|
+
}
|
|
96
|
+
} else if (!Array.isArray(vYear)) {
|
|
97
|
+
// Invalid year
|
|
98
|
+
vYear = [];
|
|
99
|
+
}
|
|
100
|
+
oJapanese = {
|
|
101
|
+
era: vYear[0],
|
|
102
|
+
year: vYear[1],
|
|
103
|
+
month: aArgs[1],
|
|
104
|
+
day: aArgs[2] !== undefined ? aArgs[2] : 1
|
|
105
|
+
};
|
|
106
|
+
oGregorian = toGregorian(oJapanese);
|
|
107
|
+
aArgs[0] = oGregorian.year;
|
|
108
|
+
return aArgs;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get the japanese era/year from this.oDate
|
|
113
|
+
*
|
|
114
|
+
* @return {object}
|
|
115
|
+
*/
|
|
116
|
+
Japanese.prototype._getJapanese = function () {
|
|
117
|
+
var oGregorian = {
|
|
118
|
+
year: this.oDate.getFullYear(),
|
|
119
|
+
month: this.oDate.getMonth(),
|
|
120
|
+
day: this.oDate.getDate()
|
|
121
|
+
};
|
|
122
|
+
return toJapanese(oGregorian);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Set the japanese era/year to this.oDate
|
|
127
|
+
*/
|
|
128
|
+
Japanese.prototype._setJapanese = function (oJapanese) {
|
|
129
|
+
var oGregorian = toGregorian(oJapanese);
|
|
130
|
+
return this.oDate.setFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the japanese era/year from this.oDate in UTC
|
|
135
|
+
*
|
|
136
|
+
* @return {object}
|
|
137
|
+
*/
|
|
138
|
+
Japanese.prototype._getUTCJapanese = function () {
|
|
139
|
+
var oGregorian = {
|
|
140
|
+
year: this.oDate.getUTCFullYear(),
|
|
141
|
+
month: this.oDate.getUTCMonth(),
|
|
142
|
+
day: this.oDate.getUTCDate()
|
|
143
|
+
};
|
|
144
|
+
return toJapanese(oGregorian);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Set the japanese era/year to this.oDate in UTC
|
|
149
|
+
*/
|
|
150
|
+
Japanese.prototype._setUTCJapanese = function (oJapanese) {
|
|
151
|
+
var oGregorian = toGregorian(oJapanese);
|
|
152
|
+
return this.oDate.setUTCFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
* Override relevant getters/setters
|
|
157
|
+
*/
|
|
158
|
+
Japanese.prototype.getYear = function () {
|
|
159
|
+
return this._getJapanese().year;
|
|
160
|
+
};
|
|
161
|
+
Japanese.prototype.getFullYear = function () {
|
|
162
|
+
return this._getJapanese().year;
|
|
163
|
+
};
|
|
164
|
+
Japanese.prototype.getEra = function () {
|
|
165
|
+
return this._getJapanese().era;
|
|
166
|
+
};
|
|
167
|
+
Japanese.prototype.getUTCFullYear = function () {
|
|
168
|
+
return this._getUTCJapanese().year;
|
|
169
|
+
};
|
|
170
|
+
Japanese.prototype.getUTCEra = function () {
|
|
171
|
+
return this._getUTCJapanese().era;
|
|
172
|
+
};
|
|
173
|
+
Japanese.prototype.setYear = function (iYear) {
|
|
174
|
+
var oJapanese = this._getJapanese();
|
|
175
|
+
oJapanese.year = iYear;
|
|
176
|
+
return this._setJapanese(oJapanese);
|
|
177
|
+
};
|
|
178
|
+
Japanese.prototype.setFullYear = function (iYear, iMonth, iDay) {
|
|
179
|
+
var oJapanese = this._getJapanese();
|
|
180
|
+
oJapanese.year = iYear;
|
|
181
|
+
if (iMonth !== undefined) {
|
|
182
|
+
oJapanese.month = iMonth;
|
|
183
|
+
}
|
|
184
|
+
if (iDay !== undefined) {
|
|
185
|
+
oJapanese.day = iDay;
|
|
186
|
+
}
|
|
187
|
+
return this._setJapanese(oJapanese);
|
|
188
|
+
};
|
|
189
|
+
Japanese.prototype.setEra = function (iEra, iYear, iMonth, iDay) {
|
|
190
|
+
var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra),
|
|
191
|
+
oJapanese = toJapanese(oEraStartDate);
|
|
192
|
+
if (iYear !== undefined) {
|
|
193
|
+
oJapanese.year = iYear;
|
|
194
|
+
}
|
|
195
|
+
if (iMonth !== undefined) {
|
|
196
|
+
oJapanese.month = iMonth;
|
|
197
|
+
}
|
|
198
|
+
if (iDay !== undefined) {
|
|
199
|
+
oJapanese.day = iDay;
|
|
200
|
+
}
|
|
201
|
+
return this._setJapanese(oJapanese);
|
|
202
|
+
};
|
|
203
|
+
Japanese.prototype.setUTCFullYear = function (iYear, iMonth, iDay) {
|
|
204
|
+
var oJapanese = this._getUTCJapanese();
|
|
205
|
+
oJapanese.year = iYear;
|
|
206
|
+
if (iMonth !== undefined) {
|
|
207
|
+
oJapanese.month = iMonth;
|
|
208
|
+
}
|
|
209
|
+
if (iDay !== undefined) {
|
|
210
|
+
oJapanese.day = iDay;
|
|
211
|
+
}
|
|
212
|
+
return this._setUTCJapanese(oJapanese);
|
|
213
|
+
};
|
|
214
|
+
Japanese.prototype.setUTCEra = function (iEra, iYear, iMonth, iDay) {
|
|
215
|
+
var oEraStartDate = UniversalDate.getEraStartDate(CalendarType.Japanese, iEra),
|
|
216
|
+
oJapanese = toJapanese(oEraStartDate);
|
|
217
|
+
if (iYear !== undefined) {
|
|
218
|
+
oJapanese.year = iYear;
|
|
219
|
+
}
|
|
220
|
+
if (iMonth !== undefined) {
|
|
221
|
+
oJapanese.month = iMonth;
|
|
222
|
+
}
|
|
223
|
+
if (iDay !== undefined) {
|
|
224
|
+
oJapanese.day = iDay;
|
|
225
|
+
}
|
|
226
|
+
return this._setUTCJapanese(oJapanese);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Note: The resulting year is the Gregorian year
|
|
231
|
+
*
|
|
232
|
+
* @override
|
|
233
|
+
* @see sap.ui.core.date.UniversalDate#getWeek
|
|
234
|
+
*/
|
|
235
|
+
Japanese.prototype.getWeek = function (oLocale, vCalendarWeekNumbering) {
|
|
236
|
+
// Use the Gregorian year (from this.oDate), because the Japanese emperor year lacks the
|
|
237
|
+
// information of the era which makes the year not unique.
|
|
238
|
+
// Using the Gregorian year is valid, because Japanese#constructor is able to calculate the
|
|
239
|
+
// era and Japanese emperor year from the Gregorian year.
|
|
240
|
+
return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getFullYear(), this.getMonth(), this.getDate(), oLocale, vCalendarWeekNumbering);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Note: The resulting year is the Gregorian year
|
|
245
|
+
*
|
|
246
|
+
* @override
|
|
247
|
+
* @see sap.ui.core.date.UniversalDate#getUTCWeek
|
|
248
|
+
*/
|
|
249
|
+
Japanese.prototype.getUTCWeek = function (oLocale, vCalendarWeekNumbering) {
|
|
250
|
+
// Use the Gregorian year (from this.oDate), because the Japanese emperor year lacks the
|
|
251
|
+
// information of the era which makes the year not unique.
|
|
252
|
+
// Using the Gregorian year is valid, because Japanese#constructor is able to calculate the
|
|
253
|
+
// era and Japanese emperor year from the Gregorian year.
|
|
254
|
+
return UniversalDate.getWeekByDate(this.sCalendarType, this.oDate.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), oLocale, vCalendarWeekNumbering);
|
|
255
|
+
};
|
|
256
|
+
_Calendars.set(CalendarType.Japanese, Japanese);
|
|
257
|
+
export default Japanese;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
// Provides class sap.ui.core.date.Persian
|
|
7
|
+
import UniversalDate from "./UniversalDate.js";
|
|
8
|
+
import CalendarType from "../CalendarType.js";
|
|
9
|
+
import _Calendars from "./_Calendars.js";
|
|
10
|
+
/**
|
|
11
|
+
* The Persian date class
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
* The Persian date does conversion of day, month and year values based on the vernal equinox.
|
|
15
|
+
* Calculation taken from jalaali-js.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
* @alias sap.ui.core.date.Persian
|
|
19
|
+
* @extends sap.ui.core.date.UniversalDate
|
|
20
|
+
*/
|
|
21
|
+
var Persian = UniversalDate.extend("sap.ui.core.date.Persian", /** @lends sap.ui.core.date.Persian.prototype */{
|
|
22
|
+
constructor: function () {
|
|
23
|
+
var aArgs = arguments;
|
|
24
|
+
if (aArgs.length > 1) {
|
|
25
|
+
aArgs = toGregorianArguments(aArgs);
|
|
26
|
+
}
|
|
27
|
+
this.oDate = this.createDate(Date, aArgs);
|
|
28
|
+
this.sCalendarType = CalendarType.Persian;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Persian.UTC = function () {
|
|
32
|
+
var aArgs = toGregorianArguments(arguments);
|
|
33
|
+
return Date.UTC.apply(Date, aArgs);
|
|
34
|
+
};
|
|
35
|
+
Persian.now = function () {
|
|
36
|
+
return Date.now();
|
|
37
|
+
};
|
|
38
|
+
var BASE_YEAR = 1300;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Calculate Persian date from gregorian
|
|
42
|
+
*
|
|
43
|
+
* @param {object} oGregorian a JS object containing day, month and year in the gregorian calendar
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
function toPersian(oGregorian) {
|
|
47
|
+
var iJulianDayNumber = g2d(oGregorian.year, oGregorian.month + 1, oGregorian.day);
|
|
48
|
+
return d2j(iJulianDayNumber);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Calculate gregorian date from Persian
|
|
53
|
+
*
|
|
54
|
+
* @param {object} oPersian a JS object containing day, month and year in the Persian calendar
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
function toGregorian(oPersian) {
|
|
58
|
+
var iJulianDayNumber = j2d(oPersian.year, oPersian.month + 1, oPersian.day);
|
|
59
|
+
return d2g(iJulianDayNumber);
|
|
60
|
+
}
|
|
61
|
+
function toGregorianArguments(aArgs) {
|
|
62
|
+
var aGregorianArgs = Array.prototype.slice.call(aArgs),
|
|
63
|
+
oPersian,
|
|
64
|
+
oGregorian;
|
|
65
|
+
// Validate arguments
|
|
66
|
+
if (typeof aArgs[0] !== "number" || typeof aArgs[1] !== "number" || aArgs[2] !== undefined && typeof aArgs[2] != "number") {
|
|
67
|
+
aGregorianArgs[0] = NaN;
|
|
68
|
+
aGregorianArgs[1] = NaN;
|
|
69
|
+
aGregorianArgs[2] = NaN;
|
|
70
|
+
return aGregorianArgs;
|
|
71
|
+
}
|
|
72
|
+
oPersian = {
|
|
73
|
+
year: aArgs[0],
|
|
74
|
+
month: aArgs[1],
|
|
75
|
+
day: aArgs[2] !== undefined ? aArgs[2] : 1
|
|
76
|
+
};
|
|
77
|
+
oGregorian = toGregorian(oPersian);
|
|
78
|
+
aGregorianArgs[0] = oGregorian.year;
|
|
79
|
+
aGregorianArgs[1] = oGregorian.month;
|
|
80
|
+
aGregorianArgs[2] = oGregorian.day;
|
|
81
|
+
return aGregorianArgs;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
This function determines if the Jalaali (Persian) year is
|
|
86
|
+
leap (366-day long) or is the common year (365 days), and
|
|
87
|
+
finds the day in March (Gregorian calendar) of the first
|
|
88
|
+
day of the Jalaali year (jy).
|
|
89
|
+
@param jy Jalaali calendar year (-61 to 3177)
|
|
90
|
+
@return
|
|
91
|
+
leap: number of years since the last leap year (0 to 4)
|
|
92
|
+
gy: Gregorian year of the beginning of Jalaali year
|
|
93
|
+
march: the March day of Farvardin the 1st (1st day of jy)
|
|
94
|
+
@see: http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm
|
|
95
|
+
@see: http://www.fourmilab.ch/documents/calendar/
|
|
96
|
+
*/
|
|
97
|
+
function jalCal(jy) {
|
|
98
|
+
// Jalaali years starting the 33-year rule.
|
|
99
|
+
var breaks = [-61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210, 1635, 2060, 2097, 2192, 2262, 2324, 2394, 2456, 3178],
|
|
100
|
+
bl = breaks.length,
|
|
101
|
+
gy = jy + 621,
|
|
102
|
+
leapJ = -14,
|
|
103
|
+
jp = breaks[0],
|
|
104
|
+
jm,
|
|
105
|
+
jump,
|
|
106
|
+
leap,
|
|
107
|
+
leapG,
|
|
108
|
+
march,
|
|
109
|
+
n,
|
|
110
|
+
i;
|
|
111
|
+
|
|
112
|
+
// Find the limiting years for the Jalaali year jy.
|
|
113
|
+
for (i = 1; i < bl; i += 1) {
|
|
114
|
+
jm = breaks[i];
|
|
115
|
+
jump = jm - jp;
|
|
116
|
+
if (jy < jm) {
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
leapJ = leapJ + div(jump, 33) * 8 + div(mod(jump, 33), 4);
|
|
120
|
+
jp = jm;
|
|
121
|
+
}
|
|
122
|
+
n = jy - jp;
|
|
123
|
+
|
|
124
|
+
// Find the number of leap years from AD 621 to the beginning
|
|
125
|
+
// of the current Jalaali year in the Persian calendar.
|
|
126
|
+
leapJ = leapJ + div(n, 33) * 8 + div(mod(n, 33) + 3, 4);
|
|
127
|
+
if (mod(jump, 33) === 4 && jump - n === 4) {
|
|
128
|
+
leapJ += 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// And the same in the Gregorian calendar (until the year gy).
|
|
132
|
+
leapG = div(gy, 4) - div((div(gy, 100) + 1) * 3, 4) - 150;
|
|
133
|
+
|
|
134
|
+
// Determine the Gregorian date of Farvardin the 1st.
|
|
135
|
+
march = 20 + leapJ - leapG;
|
|
136
|
+
|
|
137
|
+
// Find how many years have passed since the last leap year.
|
|
138
|
+
if (jump - n < 6) {
|
|
139
|
+
n = n - jump + div(jump + 4, 33) * 33;
|
|
140
|
+
}
|
|
141
|
+
leap = mod(mod(n + 1, 33) - 1, 4);
|
|
142
|
+
if (leap === -1) {
|
|
143
|
+
leap = 4;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
leap: leap,
|
|
147
|
+
gy: gy,
|
|
148
|
+
march: march
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/*
|
|
153
|
+
Converts a date of the Jalaali calendar to the Julian Day number.
|
|
154
|
+
@param jy Jalaali year (1 to 3100)
|
|
155
|
+
@param jm Jalaali month (1 to 12)
|
|
156
|
+
@param jd Jalaali day (1 to 29/31)
|
|
157
|
+
@return Julian Day number
|
|
158
|
+
*/
|
|
159
|
+
function j2d(jy, jm, jd) {
|
|
160
|
+
// Correct month overflow/underflow for correct day calculation
|
|
161
|
+
while (jm < 1) {
|
|
162
|
+
jm += 12;
|
|
163
|
+
jy--;
|
|
164
|
+
}
|
|
165
|
+
while (jm > 12) {
|
|
166
|
+
jm -= 12;
|
|
167
|
+
jy++;
|
|
168
|
+
}
|
|
169
|
+
var r = jalCal(jy);
|
|
170
|
+
return g2d(r.gy, 3, r.march) + (jm - 1) * 31 - div(jm, 7) * (jm - 7) + jd - 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
Converts the Julian Day number to a date in the Jalaali calendar.
|
|
175
|
+
@param jdn Julian Day number
|
|
176
|
+
@return
|
|
177
|
+
jy: Jalaali year (1 to 3100)
|
|
178
|
+
jm: Jalaali month (1 to 12)
|
|
179
|
+
jd: Jalaali day (1 to 29/31)
|
|
180
|
+
*/
|
|
181
|
+
function d2j(jdn) {
|
|
182
|
+
var gy = d2g(jdn).year,
|
|
183
|
+
jy = gy - 621,
|
|
184
|
+
r = jalCal(jy),
|
|
185
|
+
jdn1f = g2d(gy, 3, r.march),
|
|
186
|
+
jd,
|
|
187
|
+
jm,
|
|
188
|
+
k;
|
|
189
|
+
|
|
190
|
+
// Find number of days that passed since 1 Farvardin.
|
|
191
|
+
k = jdn - jdn1f;
|
|
192
|
+
if (k >= 0) {
|
|
193
|
+
if (k <= 185) {
|
|
194
|
+
// The first 6 months.
|
|
195
|
+
jm = 1 + div(k, 31);
|
|
196
|
+
jd = mod(k, 31) + 1;
|
|
197
|
+
return {
|
|
198
|
+
year: jy,
|
|
199
|
+
month: jm - 1,
|
|
200
|
+
day: jd
|
|
201
|
+
};
|
|
202
|
+
} else {
|
|
203
|
+
// The remaining months.
|
|
204
|
+
k -= 186;
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
// Previous Jalaali year.
|
|
208
|
+
jy -= 1;
|
|
209
|
+
k += 179;
|
|
210
|
+
if (r.leap === 1) {
|
|
211
|
+
k += 1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
jm = 7 + div(k, 30);
|
|
215
|
+
jd = mod(k, 30) + 1;
|
|
216
|
+
return {
|
|
217
|
+
year: jy,
|
|
218
|
+
month: jm - 1,
|
|
219
|
+
day: jd
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/*
|
|
224
|
+
Calculates the Julian Day number from Gregorian or Julian
|
|
225
|
+
calendar dates. This integer number corresponds to the noon of
|
|
226
|
+
the date (i.e. 12 hours of Universal Time).
|
|
227
|
+
The procedure was tested to be good since 1 March, -100100 (of both
|
|
228
|
+
calendars) up to a few million years into the future.
|
|
229
|
+
@param gy Calendar year (years BC numbered 0, -1, -2, ...)
|
|
230
|
+
@param gm Calendar month (1 to 12)
|
|
231
|
+
@param gd Calendar day of the month (1 to 28/29/30/31)
|
|
232
|
+
@return Julian Day number
|
|
233
|
+
*/
|
|
234
|
+
function g2d(gy, gm, gd) {
|
|
235
|
+
var d = div((gy + div(gm - 8, 6) + 100100) * 1461, 4) + div(153 * mod(gm + 9, 12) + 2, 5) + gd - 34840408;
|
|
236
|
+
d = d - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752;
|
|
237
|
+
return d;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/*
|
|
241
|
+
Calculates Gregorian and Julian calendar dates from the Julian Day number
|
|
242
|
+
(jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both
|
|
243
|
+
calendars) to some millions years ahead of the present.
|
|
244
|
+
@param jdn Julian Day number
|
|
245
|
+
@return
|
|
246
|
+
gy: Calendar year (years BC numbered 0, -1, -2, ...)
|
|
247
|
+
gm: Calendar month (1 to 12)
|
|
248
|
+
gd: Calendar day of the month M (1 to 28/29/30/31)
|
|
249
|
+
*/
|
|
250
|
+
function d2g(jdn) {
|
|
251
|
+
var j, i, gd, gm, gy;
|
|
252
|
+
j = 4 * jdn + 139361631;
|
|
253
|
+
j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908;
|
|
254
|
+
i = div(mod(j, 1461), 4) * 5 + 308;
|
|
255
|
+
gd = div(mod(i, 153), 5) + 1;
|
|
256
|
+
gm = mod(div(i, 153), 12) + 1;
|
|
257
|
+
gy = div(j, 1461) - 100100 + div(8 - gm, 6);
|
|
258
|
+
return {
|
|
259
|
+
year: gy,
|
|
260
|
+
month: gm - 1,
|
|
261
|
+
day: gd
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
Utility helper functions.
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
function div(a, b) {
|
|
270
|
+
return ~~(a / b);
|
|
271
|
+
}
|
|
272
|
+
function mod(a, b) {
|
|
273
|
+
return a - ~~(a / b) * b;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Get the Persian date from the this.oDate
|
|
278
|
+
*/
|
|
279
|
+
Persian.prototype._getPersian = function () {
|
|
280
|
+
return toPersian({
|
|
281
|
+
day: this.oDate.getDate(),
|
|
282
|
+
month: this.oDate.getMonth(),
|
|
283
|
+
year: this.oDate.getFullYear()
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Set the Persian date to the current this.oDate object
|
|
289
|
+
* @param {object} oPersian a JS object containing day, month and year in the Persian calendar
|
|
290
|
+
*/
|
|
291
|
+
Persian.prototype._setPersian = function (oPersian) {
|
|
292
|
+
var oGregorian = toGregorian(oPersian);
|
|
293
|
+
return this.oDate.setFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Get the Persian date from the this.oDate
|
|
298
|
+
*/
|
|
299
|
+
Persian.prototype._getUTCPersian = function () {
|
|
300
|
+
return toPersian({
|
|
301
|
+
day: this.oDate.getUTCDate(),
|
|
302
|
+
month: this.oDate.getUTCMonth(),
|
|
303
|
+
year: this.oDate.getUTCFullYear()
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Set the Persian date to the current this.oDate object
|
|
309
|
+
* @param {object} oPersian a JS object containing day, month and year in the Persian calendar
|
|
310
|
+
*/
|
|
311
|
+
Persian.prototype._setUTCPersian = function (oPersian) {
|
|
312
|
+
var oGregorian = toGregorian(oPersian);
|
|
313
|
+
return this.oDate.setUTCFullYear(oGregorian.year, oGregorian.month, oGregorian.day);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/*
|
|
317
|
+
* Override setters and getters specific to the Persian date
|
|
318
|
+
*/
|
|
319
|
+
Persian.prototype.getDate = function (iDate) {
|
|
320
|
+
return this._getPersian().day;
|
|
321
|
+
};
|
|
322
|
+
Persian.prototype.getMonth = function () {
|
|
323
|
+
return this._getPersian().month;
|
|
324
|
+
};
|
|
325
|
+
Persian.prototype.getYear = function () {
|
|
326
|
+
return this._getPersian().year - BASE_YEAR;
|
|
327
|
+
};
|
|
328
|
+
Persian.prototype.getFullYear = function () {
|
|
329
|
+
return this._getPersian().year;
|
|
330
|
+
};
|
|
331
|
+
Persian.prototype.setDate = function (iDate) {
|
|
332
|
+
var oPersian = this._getPersian();
|
|
333
|
+
oPersian.day = iDate;
|
|
334
|
+
return this._setPersian(oPersian);
|
|
335
|
+
};
|
|
336
|
+
Persian.prototype.setMonth = function (iMonth, iDay) {
|
|
337
|
+
var oPersian = this._getPersian();
|
|
338
|
+
oPersian.month = iMonth;
|
|
339
|
+
if (iDay !== undefined) {
|
|
340
|
+
oPersian.day = iDay;
|
|
341
|
+
}
|
|
342
|
+
return this._setPersian(oPersian);
|
|
343
|
+
};
|
|
344
|
+
Persian.prototype.setYear = function (iYear) {
|
|
345
|
+
var oPersian = this._getPersian();
|
|
346
|
+
oPersian.year = iYear + BASE_YEAR;
|
|
347
|
+
return this._setPersian(oPersian);
|
|
348
|
+
};
|
|
349
|
+
Persian.prototype.setFullYear = function (iYear, iMonth, iDay) {
|
|
350
|
+
var oPersian = this._getPersian();
|
|
351
|
+
oPersian.year = iYear;
|
|
352
|
+
if (iMonth !== undefined) {
|
|
353
|
+
oPersian.month = iMonth;
|
|
354
|
+
}
|
|
355
|
+
if (iDay !== undefined) {
|
|
356
|
+
oPersian.day = iDay;
|
|
357
|
+
}
|
|
358
|
+
return this._setPersian(oPersian);
|
|
359
|
+
};
|
|
360
|
+
Persian.prototype.getUTCDate = function (iDate) {
|
|
361
|
+
return this._getUTCPersian().day;
|
|
362
|
+
};
|
|
363
|
+
Persian.prototype.getUTCMonth = function () {
|
|
364
|
+
return this._getUTCPersian().month;
|
|
365
|
+
};
|
|
366
|
+
Persian.prototype.getUTCFullYear = function () {
|
|
367
|
+
return this._getUTCPersian().year;
|
|
368
|
+
};
|
|
369
|
+
Persian.prototype.setUTCDate = function (iDate) {
|
|
370
|
+
var oPersian = this._getUTCPersian();
|
|
371
|
+
oPersian.day = iDate;
|
|
372
|
+
return this._setUTCPersian(oPersian);
|
|
373
|
+
};
|
|
374
|
+
Persian.prototype.setUTCMonth = function (iMonth, iDay) {
|
|
375
|
+
var oPersian = this._getUTCPersian();
|
|
376
|
+
oPersian.month = iMonth;
|
|
377
|
+
if (iDay !== undefined) {
|
|
378
|
+
oPersian.day = iDay;
|
|
379
|
+
}
|
|
380
|
+
return this._setUTCPersian(oPersian);
|
|
381
|
+
};
|
|
382
|
+
Persian.prototype.setUTCFullYear = function (iYear, iMonth, iDay) {
|
|
383
|
+
var oPersian = this._getUTCPersian();
|
|
384
|
+
oPersian.year = iYear;
|
|
385
|
+
if (iMonth !== undefined) {
|
|
386
|
+
oPersian.month = iMonth;
|
|
387
|
+
}
|
|
388
|
+
if (iDay !== undefined) {
|
|
389
|
+
oPersian.day = iDay;
|
|
390
|
+
}
|
|
391
|
+
return this._setUTCPersian(oPersian);
|
|
392
|
+
};
|
|
393
|
+
_Calendars.set(CalendarType.Persian, Persian);
|
|
394
|
+
export default Persian;
|