@internationalized/date 3.5.3-nightly.4555 → 3.5.3-nightly.4560

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 (96) hide show
  1. package/dist/BuddhistCalendar.main.js +54 -0
  2. package/dist/BuddhistCalendar.main.js.map +1 -0
  3. package/dist/BuddhistCalendar.mjs +49 -0
  4. package/dist/BuddhistCalendar.module.js +49 -0
  5. package/dist/BuddhistCalendar.module.js.map +1 -0
  6. package/dist/CalendarDate.main.js +260 -0
  7. package/dist/CalendarDate.main.js.map +1 -0
  8. package/dist/CalendarDate.mjs +252 -0
  9. package/dist/CalendarDate.module.js +252 -0
  10. package/dist/CalendarDate.module.js.map +1 -0
  11. package/dist/DateFormatter.main.js +145 -0
  12. package/dist/DateFormatter.main.js.map +1 -0
  13. package/dist/DateFormatter.mjs +140 -0
  14. package/dist/DateFormatter.module.js +140 -0
  15. package/dist/DateFormatter.module.js.map +1 -0
  16. package/dist/EthiopicCalendar.main.js +170 -0
  17. package/dist/EthiopicCalendar.main.js.map +1 -0
  18. package/dist/EthiopicCalendar.mjs +163 -0
  19. package/dist/EthiopicCalendar.module.js +163 -0
  20. package/dist/EthiopicCalendar.module.js.map +1 -0
  21. package/dist/GregorianCalendar.main.js +143 -0
  22. package/dist/GregorianCalendar.main.js.map +1 -0
  23. package/dist/GregorianCalendar.mjs +134 -0
  24. package/dist/GregorianCalendar.module.js +134 -0
  25. package/dist/GregorianCalendar.module.js.map +1 -0
  26. package/dist/HebrewCalendar.main.js +149 -0
  27. package/dist/HebrewCalendar.main.js.map +1 -0
  28. package/dist/HebrewCalendar.mjs +144 -0
  29. package/dist/HebrewCalendar.module.js +144 -0
  30. package/dist/HebrewCalendar.module.js.map +1 -0
  31. package/dist/IndianCalendar.main.js +107 -0
  32. package/dist/IndianCalendar.main.js.map +1 -0
  33. package/dist/IndianCalendar.mjs +102 -0
  34. package/dist/IndianCalendar.module.js +102 -0
  35. package/dist/IndianCalendar.module.js.map +1 -0
  36. package/dist/IslamicCalendar.main.js +164 -0
  37. package/dist/IslamicCalendar.main.js.map +1 -0
  38. package/dist/IslamicCalendar.mjs +157 -0
  39. package/dist/IslamicCalendar.module.js +157 -0
  40. package/dist/IslamicCalendar.module.js.map +1 -0
  41. package/dist/JapaneseCalendar.main.js +180 -0
  42. package/dist/JapaneseCalendar.main.js.map +1 -0
  43. package/dist/JapaneseCalendar.mjs +175 -0
  44. package/dist/JapaneseCalendar.module.js +175 -0
  45. package/dist/JapaneseCalendar.module.js.map +1 -0
  46. package/dist/PersianCalendar.main.js +81 -0
  47. package/dist/PersianCalendar.main.js.map +1 -0
  48. package/dist/PersianCalendar.mjs +76 -0
  49. package/dist/PersianCalendar.module.js +76 -0
  50. package/dist/PersianCalendar.module.js.map +1 -0
  51. package/dist/TaiwanCalendar.main.js +81 -0
  52. package/dist/TaiwanCalendar.main.js.map +1 -0
  53. package/dist/TaiwanCalendar.mjs +76 -0
  54. package/dist/TaiwanCalendar.module.js +76 -0
  55. package/dist/TaiwanCalendar.module.js.map +1 -0
  56. package/dist/conversion.main.js +236 -0
  57. package/dist/conversion.main.js.map +1 -0
  58. package/dist/conversion.mjs +218 -0
  59. package/dist/conversion.module.js +218 -0
  60. package/dist/conversion.module.js.map +1 -0
  61. package/dist/createCalendar.main.js +69 -0
  62. package/dist/createCalendar.main.js.map +1 -0
  63. package/dist/createCalendar.mjs +64 -0
  64. package/dist/createCalendar.module.js +64 -0
  65. package/dist/createCalendar.module.js.map +1 -0
  66. package/dist/import.mjs +15 -2534
  67. package/dist/main.js +75 -2594
  68. package/dist/main.js.map +1 -1
  69. package/dist/manipulation.main.js +362 -0
  70. package/dist/manipulation.main.js.map +1 -0
  71. package/dist/manipulation.mjs +344 -0
  72. package/dist/manipulation.module.js +344 -0
  73. package/dist/manipulation.module.js.map +1 -0
  74. package/dist/module.js +15 -2534
  75. package/dist/module.js.map +1 -1
  76. package/dist/queries.main.js +287 -0
  77. package/dist/queries.main.js.map +1 -0
  78. package/dist/queries.mjs +256 -0
  79. package/dist/queries.module.js +256 -0
  80. package/dist/queries.module.js.map +1 -0
  81. package/dist/string.main.js +171 -0
  82. package/dist/string.main.js.map +1 -0
  83. package/dist/string.mjs +156 -0
  84. package/dist/string.module.js +156 -0
  85. package/dist/string.module.js.map +1 -0
  86. package/dist/utils.main.js +33 -0
  87. package/dist/utils.main.js.map +1 -0
  88. package/dist/utils.mjs +28 -0
  89. package/dist/utils.module.js +28 -0
  90. package/dist/utils.module.js.map +1 -0
  91. package/dist/weekStartData.main.js +118 -0
  92. package/dist/weekStartData.main.js.map +1 -0
  93. package/dist/weekStartData.mjs +113 -0
  94. package/dist/weekStartData.module.js +113 -0
  95. package/dist/weekStartData.module.js.map +1 -0
  96. package/package.json +2 -2
@@ -0,0 +1,107 @@
1
+ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
2
+ var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "IndianCalendar", () => $5f1dfa5c67609fe6$export$39f31c639fa15726);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */ // Portions of the code in this file are based on code from ICU.
21
+ // Original licensing can be found in the NOTICE file in the root directory of this source tree.
22
+
23
+
24
+ // Starts in 78 AD,
25
+ const $5f1dfa5c67609fe6$var$INDIAN_ERA_START = 78;
26
+ // The Indian year starts 80 days later than the Gregorian year.
27
+ const $5f1dfa5c67609fe6$var$INDIAN_YEAR_START = 80;
28
+ class $5f1dfa5c67609fe6$export$39f31c639fa15726 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
29
+ fromJulianDay(jd) {
30
+ // Gregorian date for Julian day
31
+ let date = super.fromJulianDay(jd);
32
+ // Year in Saka era
33
+ let indianYear = date.year - $5f1dfa5c67609fe6$var$INDIAN_ERA_START;
34
+ // Day number in Gregorian year (starting from 0)
35
+ let yDay = jd - (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(date.era, date.year, 1, 1);
36
+ let leapMonth;
37
+ if (yDay < $5f1dfa5c67609fe6$var$INDIAN_YEAR_START) {
38
+ // Day is at the end of the preceding Saka year
39
+ indianYear--;
40
+ // Days in leapMonth this year, previous Gregorian year
41
+ leapMonth = (0, $af14c9812fdceb33$exports.isLeapYear)(date.year - 1) ? 31 : 30;
42
+ yDay += leapMonth + 155 + 90 + 10;
43
+ } else {
44
+ // Days in leapMonth this year
45
+ leapMonth = (0, $af14c9812fdceb33$exports.isLeapYear)(date.year) ? 31 : 30;
46
+ yDay -= $5f1dfa5c67609fe6$var$INDIAN_YEAR_START;
47
+ }
48
+ let indianMonth;
49
+ let indianDay;
50
+ if (yDay < leapMonth) {
51
+ indianMonth = 1;
52
+ indianDay = yDay + 1;
53
+ } else {
54
+ let mDay = yDay - leapMonth;
55
+ if (mDay < 155) {
56
+ indianMonth = Math.floor(mDay / 31) + 2;
57
+ indianDay = mDay % 31 + 1;
58
+ } else {
59
+ mDay -= 155;
60
+ indianMonth = Math.floor(mDay / 30) + 7;
61
+ indianDay = mDay % 30 + 1;
62
+ }
63
+ }
64
+ return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, indianYear, indianMonth, indianDay);
65
+ }
66
+ toJulianDay(date) {
67
+ let extendedYear = date.year + $5f1dfa5c67609fe6$var$INDIAN_ERA_START;
68
+ let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)(extendedYear);
69
+ let leapMonth;
70
+ let jd;
71
+ if ((0, $af14c9812fdceb33$exports.isLeapYear)(year)) {
72
+ leapMonth = 31;
73
+ jd = (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(era, year, 3, 21);
74
+ } else {
75
+ leapMonth = 30;
76
+ jd = (0, $af14c9812fdceb33$exports.gregorianToJulianDay)(era, year, 3, 22);
77
+ }
78
+ if (date.month === 1) return jd + date.day - 1;
79
+ jd += leapMonth + Math.min(date.month - 2, 5) * 31;
80
+ if (date.month >= 8) jd += (date.month - 7) * 30;
81
+ jd += date.day - 1;
82
+ return jd;
83
+ }
84
+ getDaysInMonth(date) {
85
+ if (date.month === 1 && (0, $af14c9812fdceb33$exports.isLeapYear)(date.year + $5f1dfa5c67609fe6$var$INDIAN_ERA_START)) return 31;
86
+ if (date.month >= 2 && date.month <= 6) return 31;
87
+ return 30;
88
+ }
89
+ getYearsInEra() {
90
+ // 9999-12-31 gregorian is 9920-10-10 indian.
91
+ // Round down to 9919 for the last full year.
92
+ return 9919;
93
+ }
94
+ getEras() {
95
+ return [
96
+ "saka"
97
+ ];
98
+ }
99
+ balanceDate() {}
100
+ constructor(...args){
101
+ super(...args);
102
+ this.identifier = "indian";
103
+ }
104
+ }
105
+
106
+
107
+ //# sourceMappingURL=IndianCalendar.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,mBAAmB;AACnB,MAAM,yCAAmB;AAEzB,gEAAgE;AAChE,MAAM,0CAAoB;AAOnB,MAAM,kDAAuB,CAAA,GAAA,2CAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,gCAAgC;QAChC,IAAI,OAAO,KAAK,CAAC,cAAc;QAE/B,mBAAmB;QACnB,IAAI,aAAa,KAAK,IAAI,GAAG;QAE7B,iDAAiD;QACjD,IAAI,OAAO,KAAK,CAAA,GAAA,8CAAmB,EAAE,KAAK,GAAG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AAM,AAAC,CAAA,KAAK,KAAK,GAAG,CAAA,IAAK;QAG3B,MAAM,KAAK,GAAG,GAAG;QACjB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,KAAK,KAAK,CAAA,GAAA,oCAAS,EAAE,KAAK,IAAI,GAAG,yCAC7C,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,GACnC,OAAO;QAGT,OAAO;IACT;IAEA,gBAAwB;QACtB,6CAA6C;QAC7C,6CAA6C;QAC7C,OAAO;IACT;IAEA,UAAU;QACR,OAAO;YAAC;SAAO;IACjB;IAEA,cAAc,CAAC;;;aAhGf,aAAa;;AAiGf","sources":["packages/@internationalized/date/src/calendars/IndianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, GregorianCalendar, gregorianToJulianDay, isLeapYear} from './GregorianCalendar';\n\n// Starts in 78 AD,\nconst INDIAN_ERA_START = 78;\n\n// The Indian year starts 80 days later than the Gregorian year.\nconst INDIAN_YEAR_START = 80;\n\n/**\n * The Indian National Calendar is similar to the Gregorian calendar, but with\n * years numbered since the Saka era in 78 AD (Gregorian). There are 12 months\n * in each year, with either 30 or 31 days. Only one era identifier is supported: 'saka'.\n */\nexport class IndianCalendar extends GregorianCalendar {\n identifier = 'indian';\n\n fromJulianDay(jd: number): CalendarDate {\n // Gregorian date for Julian day\n let date = super.fromJulianDay(jd);\n\n // Year in Saka era\n let indianYear = date.year - INDIAN_ERA_START;\n\n // Day number in Gregorian year (starting from 0)\n let yDay = jd - gregorianToJulianDay(date.era, date.year, 1, 1);\n\n let leapMonth: number;\n if (yDay < INDIAN_YEAR_START) {\n // Day is at the end of the preceding Saka year\n indianYear--;\n\n // Days in leapMonth this year, previous Gregorian year\n leapMonth = isLeapYear(date.year - 1) ? 31 : 30;\n yDay += leapMonth + (31 * 5) + (30 * 3) + 10;\n } else {\n // Days in leapMonth this year\n leapMonth = isLeapYear(date.year) ? 31 : 30;\n yDay -= INDIAN_YEAR_START;\n }\n\n let indianMonth: number;\n let indianDay: number;\n if (yDay < leapMonth) {\n indianMonth = 1;\n indianDay = yDay + 1;\n } else {\n let mDay = yDay - leapMonth;\n if (mDay < (31 * 5)) {\n indianMonth = Math.floor(mDay / 31) + 2;\n indianDay = (mDay % 31) + 1;\n } else {\n mDay -= 31 * 5;\n indianMonth = Math.floor(mDay / 30) + 7;\n indianDay = (mDay % 30) + 1;\n }\n }\n\n return new CalendarDate(this, indianYear, indianMonth, indianDay);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let extendedYear = date.year + INDIAN_ERA_START;\n let [era, year] = fromExtendedYear(extendedYear);\n\n let leapMonth: number;\n let jd: number;\n if (isLeapYear(year)) {\n leapMonth = 31;\n jd = gregorianToJulianDay(era, year, 3, 21);\n } else {\n leapMonth = 30;\n jd = gregorianToJulianDay(era, year, 3, 22);\n }\n\n if (date.month === 1) {\n return jd + date.day - 1;\n }\n\n jd += leapMonth + Math.min(date.month - 2, 5) * 31;\n\n if (date.month >= 8) {\n jd += (date.month - 7) * 30;\n }\n\n jd += date.day - 1;\n return jd;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month === 1 && isLeapYear(date.year + INDIAN_ERA_START)) {\n return 31;\n }\n\n if (date.month >= 2 && date.month <= 6) {\n return 31;\n }\n\n return 30;\n }\n\n getYearsInEra(): number {\n // 9999-12-31 gregorian is 9920-10-10 indian.\n // Round down to 9919 for the last full year.\n return 9919;\n }\n\n getEras() {\n return ['saka'];\n }\n\n balanceDate() {}\n}\n"],"names":[],"version":3,"file":"IndianCalendar.main.js.map"}
@@ -0,0 +1,102 @@
1
+ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.mjs";
2
+ import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec, gregorianToJulianDay as $3b62074eb05584b2$export$f297eb839006d339, isLeapYear as $3b62074eb05584b2$export$553d7fa8e3805fc0} from "./GregorianCalendar.mjs";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ // Portions of the code in this file are based on code from ICU.
15
+ // Original licensing can be found in the NOTICE file in the root directory of this source tree.
16
+
17
+
18
+ // Starts in 78 AD,
19
+ const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
20
+ // The Indian year starts 80 days later than the Gregorian year.
21
+ const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
22
+ class $82c358003bdda0a8$export$39f31c639fa15726 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
23
+ fromJulianDay(jd) {
24
+ // Gregorian date for Julian day
25
+ let date = super.fromJulianDay(jd);
26
+ // Year in Saka era
27
+ let indianYear = date.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
28
+ // Day number in Gregorian year (starting from 0)
29
+ let yDay = jd - (0, $3b62074eb05584b2$export$f297eb839006d339)(date.era, date.year, 1, 1);
30
+ let leapMonth;
31
+ if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
32
+ // Day is at the end of the preceding Saka year
33
+ indianYear--;
34
+ // Days in leapMonth this year, previous Gregorian year
35
+ leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
36
+ yDay += leapMonth + 155 + 90 + 10;
37
+ } else {
38
+ // Days in leapMonth this year
39
+ leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
40
+ yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
41
+ }
42
+ let indianMonth;
43
+ let indianDay;
44
+ if (yDay < leapMonth) {
45
+ indianMonth = 1;
46
+ indianDay = yDay + 1;
47
+ } else {
48
+ let mDay = yDay - leapMonth;
49
+ if (mDay < 155) {
50
+ indianMonth = Math.floor(mDay / 31) + 2;
51
+ indianDay = mDay % 31 + 1;
52
+ } else {
53
+ mDay -= 155;
54
+ indianMonth = Math.floor(mDay / 30) + 7;
55
+ indianDay = mDay % 30 + 1;
56
+ }
57
+ }
58
+ return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
59
+ }
60
+ toJulianDay(date) {
61
+ let extendedYear = date.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
62
+ let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(extendedYear);
63
+ let leapMonth;
64
+ let jd;
65
+ if ((0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(year)) {
66
+ leapMonth = 31;
67
+ jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 21);
68
+ } else {
69
+ leapMonth = 30;
70
+ jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 22);
71
+ }
72
+ if (date.month === 1) return jd + date.day - 1;
73
+ jd += leapMonth + Math.min(date.month - 2, 5) * 31;
74
+ if (date.month >= 8) jd += (date.month - 7) * 30;
75
+ jd += date.day - 1;
76
+ return jd;
77
+ }
78
+ getDaysInMonth(date) {
79
+ if (date.month === 1 && (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year + $82c358003bdda0a8$var$INDIAN_ERA_START)) return 31;
80
+ if (date.month >= 2 && date.month <= 6) return 31;
81
+ return 30;
82
+ }
83
+ getYearsInEra() {
84
+ // 9999-12-31 gregorian is 9920-10-10 indian.
85
+ // Round down to 9919 for the last full year.
86
+ return 9919;
87
+ }
88
+ getEras() {
89
+ return [
90
+ "saka"
91
+ ];
92
+ }
93
+ balanceDate() {}
94
+ constructor(...args){
95
+ super(...args);
96
+ this.identifier = "indian";
97
+ }
98
+ }
99
+
100
+
101
+ export {$82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar};
102
+ //# sourceMappingURL=IndianCalendar.mjs.map
@@ -0,0 +1,102 @@
1
+ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";
2
+ import {fromExtendedYear as $3b62074eb05584b2$export$4475b7e617eb123c, GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec, gregorianToJulianDay as $3b62074eb05584b2$export$f297eb839006d339, isLeapYear as $3b62074eb05584b2$export$553d7fa8e3805fc0} from "./GregorianCalendar.module.js";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ // Portions of the code in this file are based on code from ICU.
15
+ // Original licensing can be found in the NOTICE file in the root directory of this source tree.
16
+
17
+
18
+ // Starts in 78 AD,
19
+ const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
20
+ // The Indian year starts 80 days later than the Gregorian year.
21
+ const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
22
+ class $82c358003bdda0a8$export$39f31c639fa15726 extends (0, $3b62074eb05584b2$export$80ee6245ec4f29ec) {
23
+ fromJulianDay(jd) {
24
+ // Gregorian date for Julian day
25
+ let date = super.fromJulianDay(jd);
26
+ // Year in Saka era
27
+ let indianYear = date.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
28
+ // Day number in Gregorian year (starting from 0)
29
+ let yDay = jd - (0, $3b62074eb05584b2$export$f297eb839006d339)(date.era, date.year, 1, 1);
30
+ let leapMonth;
31
+ if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
32
+ // Day is at the end of the preceding Saka year
33
+ indianYear--;
34
+ // Days in leapMonth this year, previous Gregorian year
35
+ leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year - 1) ? 31 : 30;
36
+ yDay += leapMonth + 155 + 90 + 10;
37
+ } else {
38
+ // Days in leapMonth this year
39
+ leapMonth = (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year) ? 31 : 30;
40
+ yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
41
+ }
42
+ let indianMonth;
43
+ let indianDay;
44
+ if (yDay < leapMonth) {
45
+ indianMonth = 1;
46
+ indianDay = yDay + 1;
47
+ } else {
48
+ let mDay = yDay - leapMonth;
49
+ if (mDay < 155) {
50
+ indianMonth = Math.floor(mDay / 31) + 2;
51
+ indianDay = mDay % 31 + 1;
52
+ } else {
53
+ mDay -= 155;
54
+ indianMonth = Math.floor(mDay / 30) + 7;
55
+ indianDay = mDay % 30 + 1;
56
+ }
57
+ }
58
+ return new (0, $35ea8db9cb2ccb90$export$99faa760c7908e4f)(this, indianYear, indianMonth, indianDay);
59
+ }
60
+ toJulianDay(date) {
61
+ let extendedYear = date.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
62
+ let [era, year] = (0, $3b62074eb05584b2$export$4475b7e617eb123c)(extendedYear);
63
+ let leapMonth;
64
+ let jd;
65
+ if ((0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(year)) {
66
+ leapMonth = 31;
67
+ jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 21);
68
+ } else {
69
+ leapMonth = 30;
70
+ jd = (0, $3b62074eb05584b2$export$f297eb839006d339)(era, year, 3, 22);
71
+ }
72
+ if (date.month === 1) return jd + date.day - 1;
73
+ jd += leapMonth + Math.min(date.month - 2, 5) * 31;
74
+ if (date.month >= 8) jd += (date.month - 7) * 30;
75
+ jd += date.day - 1;
76
+ return jd;
77
+ }
78
+ getDaysInMonth(date) {
79
+ if (date.month === 1 && (0, $3b62074eb05584b2$export$553d7fa8e3805fc0)(date.year + $82c358003bdda0a8$var$INDIAN_ERA_START)) return 31;
80
+ if (date.month >= 2 && date.month <= 6) return 31;
81
+ return 30;
82
+ }
83
+ getYearsInEra() {
84
+ // 9999-12-31 gregorian is 9920-10-10 indian.
85
+ // Round down to 9919 for the last full year.
86
+ return 9919;
87
+ }
88
+ getEras() {
89
+ return [
90
+ "saka"
91
+ ];
92
+ }
93
+ balanceDate() {}
94
+ constructor(...args){
95
+ super(...args);
96
+ this.identifier = "indian";
97
+ }
98
+ }
99
+
100
+
101
+ export {$82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar};
102
+ //# sourceMappingURL=IndianCalendar.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,mBAAmB;AACnB,MAAM,yCAAmB;AAEzB,gEAAgE;AAChE,MAAM,0CAAoB;AAOnB,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,gCAAgC;QAChC,IAAI,OAAO,KAAK,CAAC,cAAc;QAE/B,mBAAmB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G,GAAG;QAGzB,MAAM,YAAY,KAAK,GAAG,CAAC,KAAK,KAAK,GAAG,GAAG,KAAK;QAEhD,IAAI,KAAK,KAAK,IAAI,GAChB,MAAM,AAAC,CAAA,KAAK,KAAK,GAAG,CAAA,IAAK;QAG3B,MAAM,KAAK,GAAG,GAAG;QACjB,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,KAAK,KAAK,KAAK,CAAA,GAAA,yCAAS,EAAE,KAAK,IAAI,GAAG,yCAC7C,OAAO;QAGT,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,GACnC,OAAO;QAGT,OAAO;IACT;IAEA,gBAAwB;QACtB,6CAA6C;QAC7C,6CAA6C;QAC7C,OAAO;IACT;IAEA,UAAU;QACR,OAAO;YAAC;SAAO;IACjB;IAEA,cAAc,CAAC;;;aAhGf,aAAa;;AAiGf","sources":["packages/@internationalized/date/src/calendars/IndianCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {fromExtendedYear, GregorianCalendar, gregorianToJulianDay, isLeapYear} from './GregorianCalendar';\n\n// Starts in 78 AD,\nconst INDIAN_ERA_START = 78;\n\n// The Indian year starts 80 days later than the Gregorian year.\nconst INDIAN_YEAR_START = 80;\n\n/**\n * The Indian National Calendar is similar to the Gregorian calendar, but with\n * years numbered since the Saka era in 78 AD (Gregorian). There are 12 months\n * in each year, with either 30 or 31 days. Only one era identifier is supported: 'saka'.\n */\nexport class IndianCalendar extends GregorianCalendar {\n identifier = 'indian';\n\n fromJulianDay(jd: number): CalendarDate {\n // Gregorian date for Julian day\n let date = super.fromJulianDay(jd);\n\n // Year in Saka era\n let indianYear = date.year - INDIAN_ERA_START;\n\n // Day number in Gregorian year (starting from 0)\n let yDay = jd - gregorianToJulianDay(date.era, date.year, 1, 1);\n\n let leapMonth: number;\n if (yDay < INDIAN_YEAR_START) {\n // Day is at the end of the preceding Saka year\n indianYear--;\n\n // Days in leapMonth this year, previous Gregorian year\n leapMonth = isLeapYear(date.year - 1) ? 31 : 30;\n yDay += leapMonth + (31 * 5) + (30 * 3) + 10;\n } else {\n // Days in leapMonth this year\n leapMonth = isLeapYear(date.year) ? 31 : 30;\n yDay -= INDIAN_YEAR_START;\n }\n\n let indianMonth: number;\n let indianDay: number;\n if (yDay < leapMonth) {\n indianMonth = 1;\n indianDay = yDay + 1;\n } else {\n let mDay = yDay - leapMonth;\n if (mDay < (31 * 5)) {\n indianMonth = Math.floor(mDay / 31) + 2;\n indianDay = (mDay % 31) + 1;\n } else {\n mDay -= 31 * 5;\n indianMonth = Math.floor(mDay / 30) + 7;\n indianDay = (mDay % 30) + 1;\n }\n }\n\n return new CalendarDate(this, indianYear, indianMonth, indianDay);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let extendedYear = date.year + INDIAN_ERA_START;\n let [era, year] = fromExtendedYear(extendedYear);\n\n let leapMonth: number;\n let jd: number;\n if (isLeapYear(year)) {\n leapMonth = 31;\n jd = gregorianToJulianDay(era, year, 3, 21);\n } else {\n leapMonth = 30;\n jd = gregorianToJulianDay(era, year, 3, 22);\n }\n\n if (date.month === 1) {\n return jd + date.day - 1;\n }\n\n jd += leapMonth + Math.min(date.month - 2, 5) * 31;\n\n if (date.month >= 8) {\n jd += (date.month - 7) * 30;\n }\n\n jd += date.day - 1;\n return jd;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month === 1 && isLeapYear(date.year + INDIAN_ERA_START)) {\n return 31;\n }\n\n if (date.month >= 2 && date.month <= 6) {\n return 31;\n }\n\n return 30;\n }\n\n getYearsInEra(): number {\n // 9999-12-31 gregorian is 9920-10-10 indian.\n // Round down to 9919 for the last full year.\n return 9919;\n }\n\n getEras() {\n return ['saka'];\n }\n\n balanceDate() {}\n}\n"],"names":[],"version":3,"file":"IndianCalendar.module.js.map"}
@@ -0,0 +1,164 @@
1
+ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "IslamicCivilCalendar", () => $ecb2c4cc8c9aae25$export$2066795aadd37bfc);
9
+ $parcel$export(module.exports, "IslamicTabularCalendar", () => $ecb2c4cc8c9aae25$export$37f0887f2f9d22f7);
10
+ $parcel$export(module.exports, "IslamicUmalquraCalendar", () => $ecb2c4cc8c9aae25$export$5baab4758c231076);
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */ // Portions of the code in this file are based on code from ICU.
22
+ // Original licensing can be found in the NOTICE file in the root directory of this source tree.
23
+
24
+ const $ecb2c4cc8c9aae25$var$CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)
25
+ const $ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)
26
+ const $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START = 1300;
27
+ const $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END = 1600;
28
+ const $ecb2c4cc8c9aae25$var$UMALQURA_START_DAYS = 460322;
29
+ function $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, month, day) {
30
+ return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
31
+ }
32
+ function $ecb2c4cc8c9aae25$var$julianDayToIslamic(calendar, epoch, jd) {
33
+ let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
34
+ let month = Math.min(12, Math.ceil((jd - (29 + $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
35
+ let day = jd - $ecb2c4cc8c9aae25$var$islamicToJulianDay(epoch, year, month, 1) + 1;
36
+ return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(calendar, year, month, day);
37
+ }
38
+ function $ecb2c4cc8c9aae25$var$isLeapYear(year) {
39
+ return (14 + 11 * year) % 30 < 11;
40
+ }
41
+ class $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
42
+ fromJulianDay(jd) {
43
+ return $ecb2c4cc8c9aae25$var$julianDayToIslamic(this, $ecb2c4cc8c9aae25$var$CIVIL_EPOC, jd);
44
+ }
45
+ toJulianDay(date) {
46
+ return $ecb2c4cc8c9aae25$var$islamicToJulianDay($ecb2c4cc8c9aae25$var$CIVIL_EPOC, date.year, date.month, date.day);
47
+ }
48
+ getDaysInMonth(date) {
49
+ let length = 29 + date.month % 2;
50
+ if (date.month === 12 && $ecb2c4cc8c9aae25$var$isLeapYear(date.year)) length++;
51
+ return length;
52
+ }
53
+ getMonthsInYear() {
54
+ return 12;
55
+ }
56
+ getDaysInYear(date) {
57
+ return $ecb2c4cc8c9aae25$var$isLeapYear(date.year) ? 355 : 354;
58
+ }
59
+ getYearsInEra() {
60
+ // 9999 gregorian
61
+ return 9665;
62
+ }
63
+ getEras() {
64
+ return [
65
+ "AH"
66
+ ];
67
+ }
68
+ constructor(){
69
+ this.identifier = "islamic-civil";
70
+ }
71
+ }
72
+ class $ecb2c4cc8c9aae25$export$37f0887f2f9d22f7 extends $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
73
+ fromJulianDay(jd) {
74
+ return $ecb2c4cc8c9aae25$var$julianDayToIslamic(this, $ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC, jd);
75
+ }
76
+ toJulianDay(date) {
77
+ return $ecb2c4cc8c9aae25$var$islamicToJulianDay($ecb2c4cc8c9aae25$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
78
+ }
79
+ constructor(...args){
80
+ super(...args);
81
+ this.identifier = "islamic-tbla";
82
+ }
83
+ }
84
+ // Generated by scripts/generate-umalqura.js
85
+ const $ecb2c4cc8c9aae25$var$UMALQURA_DATA = "qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=";
86
+ let $ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH;
87
+ let $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE;
88
+ function $ecb2c4cc8c9aae25$var$umalquraYearStart(year) {
89
+ return $ecb2c4cc8c9aae25$var$UMALQURA_START_DAYS + $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START];
90
+ }
91
+ function $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, month) {
92
+ let idx = year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START;
93
+ let mask = 0x01 << 11 - (month - 1);
94
+ if (($ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
95
+ else return 30;
96
+ }
97
+ function $ecb2c4cc8c9aae25$var$umalquraMonthStart(year, month) {
98
+ let day = $ecb2c4cc8c9aae25$var$umalquraYearStart(year);
99
+ for(let i = 1; i < month; i++)day += $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, i);
100
+ return day;
101
+ }
102
+ function $ecb2c4cc8c9aae25$var$umalquraYearLength(year) {
103
+ return $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year + 1 - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START] - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START];
104
+ }
105
+ class $ecb2c4cc8c9aae25$export$5baab4758c231076 extends $ecb2c4cc8c9aae25$export$2066795aadd37bfc {
106
+ fromJulianDay(jd) {
107
+ let days = jd - $ecb2c4cc8c9aae25$var$CIVIL_EPOC;
108
+ let startDays = $ecb2c4cc8c9aae25$var$umalquraYearStart($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START);
109
+ let endDays = $ecb2c4cc8c9aae25$var$umalquraYearStart($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END);
110
+ if (days < startDays || days > endDays) return super.fromJulianDay(jd);
111
+ else {
112
+ let y = $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START - 1;
113
+ let m = 1;
114
+ let d = 1;
115
+ while(d > 0){
116
+ y++;
117
+ d = days - $ecb2c4cc8c9aae25$var$umalquraYearStart(y) + 1;
118
+ let yearLength = $ecb2c4cc8c9aae25$var$umalquraYearLength(y);
119
+ if (d === yearLength) {
120
+ m = 12;
121
+ break;
122
+ } else if (d < yearLength) {
123
+ let monthLength = $ecb2c4cc8c9aae25$var$umalquraMonthLength(y, m);
124
+ m = 1;
125
+ while(d > monthLength){
126
+ d -= monthLength;
127
+ m++;
128
+ monthLength = $ecb2c4cc8c9aae25$var$umalquraMonthLength(y, m);
129
+ }
130
+ break;
131
+ }
132
+ }
133
+ return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, y, m, days - $ecb2c4cc8c9aae25$var$umalquraMonthStart(y, m) + 1);
134
+ }
135
+ }
136
+ toJulianDay(date) {
137
+ if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
138
+ return $ecb2c4cc8c9aae25$var$CIVIL_EPOC + $ecb2c4cc8c9aae25$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
139
+ }
140
+ getDaysInMonth(date) {
141
+ if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
142
+ return $ecb2c4cc8c9aae25$var$umalquraMonthLength(date.year, date.month);
143
+ }
144
+ getDaysInYear(date) {
145
+ if (date.year < $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START || date.year > $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
146
+ return $ecb2c4cc8c9aae25$var$umalquraYearLength(date.year);
147
+ }
148
+ constructor(){
149
+ super();
150
+ this.identifier = "islamic-umalqura";
151
+ if (!$ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH) $ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($ecb2c4cc8c9aae25$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);
152
+ if (!$ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE) {
153
+ $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START + 1);
154
+ let yearStart = 0;
155
+ for(let year = $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START; year <= $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_END; year++){
156
+ $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE[year - $ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START] = yearStart;
157
+ for(let i = 1; i <= 12; i++)yearStart += $ecb2c4cc8c9aae25$var$umalquraMonthLength(year, i);
158
+ }
159
+ }
160
+ }
161
+ }
162
+
163
+
164
+ //# sourceMappingURL=IslamicCalendar.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAKhG,MAAM,mCAAa,SAAS,gFAAgF;AAC5G,MAAM,0CAAoB,SAAS,4CAA4C;AAC/E,MAAM,4CAAsB;AAC5B,MAAM,0CAAoB;AAC1B,MAAM,4CAAsB;AAE5B,S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AAI,GAAG,KAAK,IAAI,IACvB,aAAa,0CAAoB,MAAM;YAE3C;QACF;IACF;AA0DF","sources":["packages/@internationalized/date/src/calendars/IslamicCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\n\nconst CIVIL_EPOC = 1948440; // CE 622 July 16 Friday (Julian calendar) / CE 622 July 19 (Gregorian calendar)\nconst ASTRONOMICAL_EPOC = 1948439; // CE 622 July 15 Thursday (Julian calendar)\nconst UMALQURA_YEAR_START = 1300;\nconst UMALQURA_YEAR_END = 1600;\nconst UMALQURA_START_DAYS = 460322;\n\nfunction islamicToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return day +\n Math.ceil(29.5 * (month - 1)) +\n (year - 1) * 354 +\n Math.floor((3 + 11 * year) / 30) +\n epoch - 1;\n}\n\nfunction julianDayToIslamic(calendar: Calendar, epoch: number, jd: number) {\n let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);\n let month = Math.min(12, Math.ceil((jd - (29 + islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);\n let day = jd - islamicToJulianDay(epoch, year, month, 1) + 1;\n\n return new CalendarDate(calendar, year, month, day);\n}\n\nfunction isLeapYear(year: number): boolean {\n return (14 + 11 * year) % 30 < 11;\n}\n\n/**\n * The Islamic calendar, also known as the \"Hijri\" calendar, is used throughout much of the Arab world.\n * The civil variant uses simple arithmetic rules rather than astronomical calculations to approximate\n * the traditional calendar, which is based on sighting of the crescent moon. It uses Friday, July 16 622 CE (Julian) as the epoch.\n * Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.\n * Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).\n */\nexport class IslamicCivilCalendar implements Calendar {\n identifier = 'islamic-civil';\n\n fromJulianDay(jd: number): CalendarDate {\n return julianDayToIslamic(this, CIVIL_EPOC, jd);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return islamicToJulianDay(CIVIL_EPOC, date.year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let length = 29 + date.month % 2;\n if (date.month === 12 && isLeapYear(date.year)) {\n length++;\n }\n\n return length;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 355 : 354;\n }\n\n getYearsInEra(): number {\n // 9999 gregorian\n return 9665;\n }\n\n getEras() {\n return ['AH'];\n }\n}\n\n/**\n * The Islamic calendar, also known as the \"Hijri\" calendar, is used throughout much of the Arab world.\n * The tabular variant uses simple arithmetic rules rather than astronomical calculations to approximate\n * the traditional calendar, which is based on sighting of the crescent moon. It uses Thursday, July 15 622 CE (Julian) as the epoch.\n * Each year has 12 months, with either 354 or 355 days depending on whether it is a leap year.\n * Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).\n */\nexport class IslamicTabularCalendar extends IslamicCivilCalendar {\n identifier = 'islamic-tbla';\n\n fromJulianDay(jd: number): CalendarDate {\n return julianDayToIslamic(this, ASTRONOMICAL_EPOC, jd);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return islamicToJulianDay(ASTRONOMICAL_EPOC, date.year, date.month, date.day);\n }\n}\n\n// Generated by scripts/generate-umalqura.js\nconst UMALQURA_DATA = 'qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=';\nlet UMALQURA_MONTHLENGTH: Uint16Array;\nlet UMALQURA_YEAR_START_TABLE: Uint32Array;\n\nfunction umalquraYearStart(year: number): number {\n return UMALQURA_START_DAYS + UMALQURA_YEAR_START_TABLE[year - UMALQURA_YEAR_START];\n}\n\nfunction umalquraMonthLength(year: number, month: number): number {\n let idx = (year - UMALQURA_YEAR_START);\n let mask = (0x01 << (11 - (month - 1)));\n if ((UMALQURA_MONTHLENGTH[idx] & mask) === 0) {\n return 29;\n } else {\n return 30;\n }\n}\n\nfunction umalquraMonthStart(year: number, month: number): number {\n let day = umalquraYearStart(year);\n for (let i = 1; i < month; i++) {\n day += umalquraMonthLength(year, i);\n }\n return day;\n}\n\nfunction umalquraYearLength(year: number): number {\n return UMALQURA_YEAR_START_TABLE[year + 1 - UMALQURA_YEAR_START] - UMALQURA_YEAR_START_TABLE[year - UMALQURA_YEAR_START];\n}\n\n/**\n * The Islamic calendar, also known as the \"Hijri\" calendar, is used throughout much of the Arab world.\n * The Umalqura variant is primarily used in Saudi Arabia. It is a lunar calendar, based on astronomical\n * calculations that predict the sighting of a crescent moon. Month and year lengths vary between years\n * depending on these calculations.\n * Learn more about the available Islamic calendars [here](https://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types).\n */\nexport class IslamicUmalquraCalendar extends IslamicCivilCalendar {\n identifier = 'islamic-umalqura';\n\n constructor() {\n super();\n if (!UMALQURA_MONTHLENGTH) {\n UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob(UMALQURA_DATA), c => c.charCodeAt(0)).buffer);\n }\n\n if (!UMALQURA_YEAR_START_TABLE) {\n UMALQURA_YEAR_START_TABLE = new Uint32Array(UMALQURA_YEAR_END - UMALQURA_YEAR_START + 1);\n\n let yearStart = 0;\n for (let year = UMALQURA_YEAR_START; year <= UMALQURA_YEAR_END; year++) {\n UMALQURA_YEAR_START_TABLE[year - UMALQURA_YEAR_START] = yearStart;\n for (let i = 1; i <= 12; i++) {\n yearStart += umalquraMonthLength(year, i);\n }\n }\n }\n }\n\n fromJulianDay(jd: number): CalendarDate {\n let days = jd - CIVIL_EPOC;\n let startDays = umalquraYearStart(UMALQURA_YEAR_START);\n let endDays = umalquraYearStart(UMALQURA_YEAR_END);\n if (days < startDays || days > endDays) {\n return super.fromJulianDay(jd);\n } else {\n let y = UMALQURA_YEAR_START - 1;\n let m = 1;\n let d = 1;\n while (d > 0) {\n y++;\n d = days - umalquraYearStart(y) + 1;\n let yearLength = umalquraYearLength(y);\n if (d === yearLength) {\n m = 12;\n break;\n } else if (d < yearLength) {\n let monthLength = umalquraMonthLength(y, m);\n m = 1;\n while (d > monthLength) {\n d -= monthLength;\n m++;\n monthLength = umalquraMonthLength(y, m);\n }\n break;\n }\n }\n\n return new CalendarDate(this, y, m, (days - umalquraMonthStart(y, m) + 1));\n }\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n if (date.year < UMALQURA_YEAR_START || date.year > UMALQURA_YEAR_END) {\n return super.toJulianDay(date);\n }\n\n return CIVIL_EPOC + umalquraMonthStart(date.year, date.month) + (date.day - 1);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.year < UMALQURA_YEAR_START || date.year > UMALQURA_YEAR_END) {\n return super.getDaysInMonth(date);\n }\n\n return umalquraMonthLength(date.year, date.month);\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n if (date.year < UMALQURA_YEAR_START || date.year > UMALQURA_YEAR_END) {\n return super.getDaysInYear(date);\n }\n\n return umalquraYearLength(date.year);\n }\n}\n"],"names":[],"version":3,"file":"IslamicCalendar.main.js.map"}