@internationalized/date 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;6BAzBf,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;QA1BV,qBACL,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;6BAzBf,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,CAAC;;QA1BV,qBACL,aAAa;;AA0Bf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\n\nconst BUDDHIST_ERA_START = -543;\n\n/**\n * The Buddhist calendar is the same as the Gregorian calendar, but counts years\n * starting from the birth of Buddha in 543 BC (Gregorian). It supports only one\n * era, identified as 'BE'.\n */\nexport class BuddhistCalendar extends GregorianCalendar {\n identifier = 'buddhist';\n\n fromJulianDay(jd: number): CalendarDate {\n let gregorianDate = super.fromJulianDay(jd);\n let year = getExtendedYear(gregorianDate.era, gregorianDate.year);\n return new CalendarDate(\n this,\n year - BUDDHIST_ERA_START,\n gregorianDate.month,\n gregorianDate.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate() {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAC5E,OACE,MAAwB,wCAAwC;OAC9D,MAAM,KAAgB,4BAA4B;OAClD,KAAK,KAAK,CAAC,OAAO,GAAI,yBAAyB;OAC/C,KAAM,CAAA,QAAQ,EAAQ,uCAAuC;IAA/C,IACd,MAAM,EAAgB,6CAA6C;;AAEzE;AAEA,SAAS,oCAAc,KAAa,EAAE,EAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,IAAK,CAAA,KAAK,KAAI,IAAM;IAC3C,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,oCAAc,OAAO,MAAM,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K,GAAG,KAAK,QAAQ,OAAO;IACrC;;6BAnDA,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.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';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,o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K,OACf,OAAO,IAAI;QAGb,OAAO,qCAAe,MAAM,KAAK,KAAK;IACxC;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,QAAQ,OAAO;YACvC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAU;QACR,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.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';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAC5E,OACE,MAAwB,wCAAwC;OAC9D,MAAM,KAAgB,4BAA4B;OAClD,KAAK,KAAK,CAAC,OAAO,GAAI,yBAAyB;OAC/C,KAAM,CAAA,QAAQ,EAAQ,uCAAuC;IAA/C,IACd,MAAM,EAAgB,6CAA6C;;AAEzE;AAEA,SAAS,oCAAc,KAAa,EAAE,EAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,IAAK,CAAA,KAAK,KAAI,IAAM;IAC3C,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC,AAAC,CAAA,KAAK,oCAAc,OAAO,MAAM,GAAG,EAAC,IAAK;IACrE,IAAI,MAAM,KAAK,IAAI,oCAAc,OAAO,MAAM,OAAO;IACrD,OAAO;QAAC;QAAM;QAAO;KAAI;AAC3B;AAEA,SAAS,iCAAW,IAAY;IAC9B,OAAO,KAAK,KAAK,CAAC,AAAC,OAAO,IAAK;AACjC;AAEA,SAAS,qCAAe,IAAY,EAAE,KAAa;IACjD,4EAA4E;IAC5E,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,sBAAsB;IACtB,IAAI,QAAQ,OAAO,GACjB,wBAAwB;IACxB,OAAO;SAEP,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I,GAAG,oCAAc,oCAAc;QACrD,IAAI,MAAM;QACV,IAAI,QAAQ,GAAG;YACb,MAAM;YACN,OAAO,IAAI;QACb;QAEA,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,OAAO;IAClD;IAEA,YAAY,IAAqB,EAAE;QACjC,IAAI,OAAO,KAAK,IAAI;QACpB,IAAI,KAAK,GAAG,KAAK,OACf,OAAO,IAAI;QAGb,OAAO,oCAAc,oCAAc,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,OAAO,KAAK,IAAI;QACpB,IAAI,KAAK,GAAG,KAAK,OACf,OAAO,IAAI;QAGb,OAAO,qCAAe,MAAM,KAAK,KAAK;IACxC;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,KAAK,IAAI,IAAI,GAAG;YAClB,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,QAAQ,OAAO;YACvC,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI;QAC3B;IACF;IAEA,UAAU;QACR,OAAO;YAAC;YAAO;SAAK;IACtB;IAEA,cAAc,IAAqB,EAAU;QAC3C,6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;6BAnDA,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.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';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;AAMhG,MAAM,uCAAiB;AACvB,MAAM,qCAAe;AAErB,oDAAoD;AACpD,iBAAiB;AACjB,MAAM,2CAAqB;AAE3B,SAAS,oCAAc,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAC5E,OACE,MAAwB,wCAAwC;OAC9D,MAAM,KAAgB,4BAA4B;OAClD,KAAK,KAAK,CAAC,OAAO,GAAI,yBAAyB;OAC/C,KAAM,CAAA,QAAQ,EAAQ,uCAAuC;IAA/C,IACd,MAAM,EAAgB,6CAA6C;;AAEzE;AAEA,SAAS,oCAAc,KAAa,EAAE,EAAU;IAC9C,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,IAAK,CAAA,KAAK,KAAI,IAAM;IAC3C,IAAI,QAAQ,IAAI,KAAK,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6CAA6C;QAC7C,6CAA6C;QAC7C,oDAAoD;QACpD,OAAO,KAAK,GAAG,KAAK,QAAQ,OAAO;IACrC;;QApDK,qBACL,aAAa;;AAoDf","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.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';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the extra month always has six days in the year before\n // a Julian Leap Year.\n if (month % 13 !== 0) {\n // not intercalary month\n return 30;\n } else {\n // intercalary month 5 days + possible leap day\n return getLeapDay(year) + 5;\n }\n}\n\n/**\n * The Ethiopic calendar system is the official calendar used in Ethiopia.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'AA' and 'AM'.\n */\nexport class EthiopicCalendar implements Calendar {\n identifier = 'ethiopic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n let era = 'AM';\n if (year <= 0) {\n era = 'AA';\n year += AMETE_MIHRET_DELTA;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'AA') {\n year -= AMETE_MIHRET_DELTA;\n }\n\n return ceToJulianDay(ETHIOPIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(): number {\n return 13;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return 365 + getLeapDay(date.year);\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-31 gregorian is 9992-20-02 ethiopic.\n // Round down to 9991 for the last full year.\n // AA 9999-01-01 ethiopic is 4506-09-30 gregorian.\n return date.era === 'AA' ? 9999 : 9991;\n }\n\n getEras() {\n return ['AA', 'AM'];\n }\n}\n\n/**\n * The Ethiopic (Amete Alem) calendar is the same as the modern Ethiopic calendar,\n * except years were measured from a different epoch. Only one era is supported: 'AA'.\n */\nexport class EthiopicAmeteAlemCalendar extends EthiopicCalendar {\n identifier = 'ethioaa'; // also known as 'ethiopic-amete-alem' in ICU\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(ETHIOPIC_EPOCH, jd);\n year += AMETE_MIHRET_DELTA;\n return new CalendarDate(this, 'AA', year, month, day);\n }\n\n getEras() {\n return ['AA'];\n }\n\n getYearsInEra(): number {\n // 9999-13-04 ethioaa is the maximum date, which is equivalent to 4506-09-29 gregorian.\n return 9999;\n }\n}\n\n/**\n * The Coptic calendar is similar to the Ethiopic calendar.\n * It includes 12 months of 30 days each, plus 5 or 6 intercalary days depending\n * on whether it is a leap year. Two eras are supported: 'BCE' and 'CE'.\n */\nexport class CopticCalendar extends EthiopicCalendar {\n identifier = 'coptic';\n\n fromJulianDay(jd: number): CalendarDate {\n let [year, month, day] = julianDayToCE(COPTIC_EPOCH, jd);\n let era = 'CE';\n if (year <= 0) {\n era = 'BCE';\n year = 1 - year;\n }\n\n return new CalendarDate(this, era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return ceToJulianDay(COPTIC_EPOCH, year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n let year = date.year;\n if (date.era === 'BCE') {\n year = 1 - year;\n }\n\n return getDaysInMonth(year, date.month);\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BCE';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BCE' ? 'CE' : 'BCE';\n date.year = 1 - date.year;\n }\n }\n\n getEras() {\n return ['BCE', 'CE'];\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // 9999-12-30 gregorian is 9716-02-20 coptic.\n // Round down to 9715 for the last full year.\n // BCE 9999-01-01 coptic is BC 9716-06-15 gregorian.\n return date.era === 'BCE' ? 9999 : 9715;\n }\n}\n"],"names":[],"version":3,"file":"EthiopicCalendar.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,mBAAmB;AACnB,MAAM,yCAA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mB,EAAE,KAAK,MAAM,GAAG;QAC1C,OAAO;YACL,YAAY;YACZ,KAAK,CAAA,GAAA,8CAAmB,EAAE,KAAK,MAAM,GAAG;QAC1C;QAEA,IAAI,KAAK,KAAK,KAAK,GACjB,OAAO,KAAK,KAAK,GAAG,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,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;;6BAhGf,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"}
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,EAAE,KAAK,IAAI,EAAE,GAAG;QAE7D,IAAI;QACJ,IAAI,OAAO,yCAAmB;YAC5B,gDAAgD;YAChD;YAEA,uDAAuD;YACvD,YAAY,CAAA,GAAA,oCAAS,EAAE,KAAK,IAAI,GAAG,KAAK,KAAK;YAC7C,QAAQ,YAAa,MAAW,KAAU;QAC5C,OAAO;YACL,8BAA8B;YAC9B,YAAY,CAAA,GAAA,oCAAS,EAAE,KAAK,IAAI,IAAI,KAAK;YACzC,QAAQ;QACV;QAEA,IAAI;QACJ,IAAI;QACJ,IAAI,OAAO,WAAW;YACpB,cAAc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QACR,OAAO;YAAC;SAAO;IACjB;IAEA,cAAc,CAAC;;QAjGV,qBACL,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"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,mBAAmB;AACnB,MAAM,yCAAmB;AAEzB,gEAAgE;AAChE,MAAM,0CAAoB;AAOnB,MAAM,kDAAuB,CAAA,GAAA,yCAA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AAmB,EAAE,KAAK,MAAM,GAAG;QAC1C;QAEA,IAAI,KAAK,KAAK,KAAK,GACjB,OAAO,KAAK,KAAK,GAAG,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;;6BAhGf,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"}
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;QACnB,IAAI,aAAa,KAAK,IAAI,GAAG;QAE7B,iDAAiD;QACjD,IAAI,OAAO,KAAK,CAAA,GAAA,yCAAmB,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,GAAG;QAE7D,IAAI;QACJ,IAAI,OAAO,yCAAmB;YAC5B,gDAAgD;YAChD;YAEA,uDAAuD;YACvD,YAAY,CAAA,GAAA,yCAAS,EAAE,KAAK,IAAI,GAAG,KAAK,KAAK;YAC7C,QAAQ,YAAa,MAAW,KAAU;QAC5C,OAAO;YACL,8BAA8B;YAC9B,YAAY,CAAA,GAAA,yCAAS,EAAE,KAAK,IAAI,IAAI,KAAK;YACzC,QAAQ;QACV;QAEA,IAAI;QACJ,IAAI;QACJ,IAAI,OAAO,WAAW;YACpB,cAAc;YACd,YAAY,OAAO;QACrB,OAAO;YACL,IAAI,OAAO,OAAO;YAClB,IAAI,OAAQ,KAAS;gBACnB,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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"}
@@ -1 +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,SAAS,yCAAmB,KAAa,EAAE,IAAY,EAAE,KAAa,E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AAM;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"}
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,SAAS,yCAAmB,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IACjF,OAAO,MACL,KAAK,IAAI,CAAC,OAAQ,CAAA,QAAQ,CAAA,KAC1B,AAAC,CAAA,OAAO,CAAA,IAAK,MACb,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAG,IAAK,MAC7B,QAAQ;AACZ;AAEA,SAAS,yCAAmB,QAAkB,EAAE,KAAa,EAAE,EAAU;IACvE,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,CAAA,KAAM,CAAA,KAAK,KAAI,IAAK,KAAI,IAAK;IACpD,IAAI,QAAQ,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,AAA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Y;QAG3B,OAAO,mCAAa,yCAAmB,KAAK,IAAI,EAAE,KAAK,KAAK,IAAK,CAAA,KAAK,GAAG,GAAG,CAAA;IAC9E;IAEA,eAAe,IAAqB,EAAU;QAC5C,IAAI,KAAK,IAAI,GAAG,6CAAuB,KAAK,IAAI,GAAG,yCACjD,OAAO,KAAK,CAAC,eAAe;QAG9B,OAAO,0CAAoB,KAAK,IAAI,EAAE,KAAK,KAAK;IAClD;IAEA,cAAc,IAAqB,EAAU;QAC3C,IAAI,KAAK,IAAI,GAAG,6CAAuB,KAAK,IAAI,GAAG,yCACjD,OAAO,KAAK,CAAC,cAAc;QAG7B,OAAO,yCAAmB,KAAK,IAAI;IACrC;IA1EA,aAAc;QACZ,KAAK,SAHP,aAAa;QAIX,IAAI,CAAC,4CACH,6CAAuB,IAAI,YAAY,WAAW,IAAI,CAAC,KAAK,sCAAgB,CAAA,IAAK,EAAE,UAAU,CAAC,IAAI,MAAM;QAG1G,IAAI,CAAC,iDAA2B;YAC9B,kDAA4B,IAAI,YAAY,0CAAoB,4CAAsB;YAEtF,IAAI,YAAY;YAChB,IAAK,IAAI,OAAO,2CAAqB,QAAQ,yCAAmB,OAAQ;gBACtE,+CAAyB,CAAC,OAAO,0CAAoB,GAAG;gBACxD,IAAK,IAAI,IAAI,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"}
@@ -1 +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,SAAS,yCAAmB,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IACjF,OAAO,MACL,KAAK,IAAI,CAAC,OAAQ,CAAA,QAAQ,CAAA,KAC1B,AAAC,CAAA,OAAO,CAAA,IAAK,MACb,KAAK,KAAK,CAAC,AAAC,CAAA,IAAI,KAAK,IAAG,IAAK,MAC7B,QAAQ;AACZ;AAEA,SAAS,yCAAmB,QAAkB,EAAE,KAAa,EAAE,EAAU;IACvE,IAAI,OAAO,KAAK,KAAK,CAAC,AAAC,CAAA,KAAM,CAAA,KAAK,KAAI,IAAK,KAAI,IAAK;IACpD,IAAI,QAAQ,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,AAAC,CAAA,KAAM,CAAA,KAAK,yCAAmB,OAAO,MAAM,GAAG,EAAC,CAAC,IAAK,QAAQ;IACjG,IAAI,MAAM,KAAK,yCAAmB,OAAO,MAAM,OAAO,KAAK;IAE3D,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,UAAU,MAAM,OAAO;AACjD;AAEA,SAAS,iCAAW,IAAY;IAC9B,OAAO,AAAC,CAAA,KAAK,KAAK,IAAG,IAAK,KAAK;AACjC;AASO,MAAM;IAGX,cAAc,EAAU,EAAgB;QACtC,OAAO,yCAAmB,IAAI,EAAE,kCAAY;IAC9C;IAEA,YAAY,IA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AG7B,OAAO,yCAAmB,KAAK,IAAI;IACrC;IA1EA,aAAc;QACZ,KAAK,SAHP,aAAa;QAIX,IAAI,CAAC,4CACH,6CAAuB,IAAI,YAAY,WAAW,IAAI,CAAC,KAAK,sCAAgB,CAAA,IAAK,EAAE,UAAU,CAAC,IAAI,MAAM;QAG1G,IAAI,CAAC,iDAA2B;YAC9B,kDAA4B,IAAI,YAAY,0CAAoB,4CAAsB;YAEtF,IAAI,YAAY;YAChB,IAAK,IAAI,OAAO,2CAAqB,QAAQ,yCAAmB,OAAQ;gBACtE,+CAAyB,CAAC,OAAO,0CAAoB,GAAG;gBACxD,IAAK,IAAI,IAAI,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.module.js.map"}
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,SA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I,IAAI,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.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAE;CAAC;AACjG,MAAM,sCAAgB;IAAC;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;CAAC;AAClF,MAAM,oCAAc;IAAC;IAAM;IAAM;IAAM;IAAM;CAAK;AAClD,MAAM,kCAAY;IAAC;IAAS;IAAU;IAAS;IAAU;CAAQ;AAEjE,SAAS,+CAAyB,IAAqB;IACrD,MAAM,MAAM,sCAAgB,SAAS,CAAC,CAAC,CAAC,MAAM,O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KAAK,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,EAAE,EACvE;QAGF,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,sBAAsB,IAAqB,EAAU;QACnD,IAAI,QAAQ,kCAAY;QACxB,OAAO,QAAQ,KAAK,CAAC,EAAE,GAAG;IAC5B;IAEA,qBAAqB,IAAqB,EAAU;QAClD,IAAI,QAAQ,kCAAY;QACxB,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;6BAhGA,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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 the TC39 Temporal proposal.\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 {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\n }\n\n return idx - 1;\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let eraAddend = ERA_ADDENDS[ERA_NAMES.indexOf(date.era)];\n if (!eraAddend) {\n throw new Error('Unknown era: ' + date.era);\n }\n\n return new CalendarDate(\n date.year + eraAddend,\n date.month,\n date.day\n );\n}\n\n/**\n * The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.\n * Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.\n * Note that eras before 1868 (Gregorian) are not currently supported by this implementation.\n */\nexport class JapaneseCalendar extends GregorianCalendar {\n identifier = 'japanese';\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let era = findEraFromGregorianDate(date);\n\n return new CalendarDate(\n this,\n ERA_NAMES[era],\n date.year - ERA_ADDENDS[era],\n date.month,\n date.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let gregorianDate = toGregorian(date);\n let era = findEraFromGregorianDate(gregorianDate);\n\n if (ERA_NAMES[era] !== date.era) {\n date.era = ERA_NAMES[era];\n date.year = gregorianDate.year - ERA_ADDENDS[era];\n }\n\n // Constrain in case we went before the first supported era.\n this.constrainDate(date);\n }\n\n constrainDate(date: Mutable<AnyCalendarDate>) {\n let idx = ERA_NAMES.indexOf(date.era);\n let end = ERA_END_DATES[idx];\n if (end != null) {\n let [endYear, endMonth, endDay] = end;\n\n // Constrain the year to the maximum possible value in the era.\n // Then constrain the month and day fields within that.\n let maxYear = endYear - ERA_ADDENDS[idx];\n date.year = Math.max(1, Math.min(maxYear, date.year));\n if (date.year === maxYear) {\n date.month = Math.min(endMonth, date.month);\n\n if (date.month === endMonth) {\n date.day = Math.min(endDay, date.day);\n }\n }\n }\n\n if (date.year === 1 && idx >= 0) {\n let [, startMonth, startDay] = ERA_START_DATES[idx];\n date.month = Math.max(startMonth, date.month);\n\n if (date.month === startMonth) {\n date.day = Math.max(startDay, date.day);\n }\n }\n }\n\n getEras() {\n return ERA_NAMES;\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // Get the number of years in the era, taking into account the date's month and day fields.\n let era = ERA_NAMES.indexOf(date.era);\n let cur = ERA_START_DATES[era];\n let next = ERA_START_DATES[era + 1];\n if (next == null) {\n // 9999 gregorian is the maximum year allowed.\n return 9999 - cur[0] + 1;\n }\n\n let years = next[0] - cur[0];\n\n if (date.month < next[1] || (date.month === next[1] && date.day < next[2])) {\n years++;\n }\n\n return years;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getMinimumMonthInYear(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start ? start[1] : 1;\n }\n\n getMinimumDayInMonth(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start && date.month === start[1] ? start[2] : 1;\n }\n}\n\nfunction getMinimums(date: AnyCalendarDate) {\n if (date.year === 1) {\n let idx = ERA_NAMES.indexOf(date.era);\n return ERA_START_DATES[idx];\n }\n}\n"],"names":[],"version":3,"file":"JapaneseCalendar.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;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AAG,CAAC,UAAU,KAAK,GAAG;QAE1C;IACF;IAEA,UAAU;QACR,OAAO;IACT;IAEA,cAAc,IAAqB,EAAU;QAC3C,2FAA2F;QAC3F,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,IAAI,MAAM,qCAAe,CAAC,IAAI;QAC9B,IAAI,OAAO,qCAAe,CAAC,MAAM,EAAE;QACnC,IAAI,QAAQ,MACV,8CAA8C;QAC9C,OAAO,OAAO,GAAG,CAAC,EAAE,GAAG;QAGzB,IAAI,QAAQ,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE;QAE5B,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,EAAE,IAAK,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,EAAE,EACvE;QAGF,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,sBAAsB,IAAqB,EAAU;QACnD,IAAI,QAAQ,kCAAY;QACxB,OAAO,QAAQ,KAAK,CAAC,EAAE,GAAG;IAC5B;IAEA,qBAAqB,IAAqB,EAAU;QAClD,IAAI,QAAQ,kCAAY;QACxB,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;QAjGK,qBACL,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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 the TC39 Temporal proposal.\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 {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\n }\n\n return idx - 1;\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let eraAddend = ERA_ADDENDS[ERA_NAMES.indexOf(date.era)];\n if (!eraAddend) {\n throw new Error('Unknown era: ' + date.era);\n }\n\n return new CalendarDate(\n date.year + eraAddend,\n date.month,\n date.day\n );\n}\n\n/**\n * The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.\n * Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.\n * Note that eras before 1868 (Gregorian) are not currently supported by this implementation.\n */\nexport class JapaneseCalendar extends GregorianCalendar {\n identifier = 'japanese';\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let era = findEraFromGregorianDate(date);\n\n return new CalendarDate(\n this,\n ERA_NAMES[era],\n date.year - ERA_ADDENDS[era],\n date.month,\n date.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let gregorianDate = toGregorian(date);\n let era = findEraFromGregorianDate(gregorianDate);\n\n if (ERA_NAMES[era] !== date.era) {\n date.era = ERA_NAMES[era];\n date.year = gregorianDate.year - ERA_ADDENDS[era];\n }\n\n // Constrain in case we went before the first supported era.\n this.constrainDate(date);\n }\n\n constrainDate(date: Mutable<AnyCalendarDate>) {\n let idx = ERA_NAMES.indexOf(date.era);\n let end = ERA_END_DATES[idx];\n if (end != null) {\n let [endYear, endMonth, endDay] = end;\n\n // Constrain the year to the maximum possible value in the era.\n // Then constrain the month and day fields within that.\n let maxYear = endYear - ERA_ADDENDS[idx];\n date.year = Math.max(1, Math.min(maxYear, date.year));\n if (date.year === maxYear) {\n date.month = Math.min(endMonth, date.month);\n\n if (date.month === endMonth) {\n date.day = Math.min(endDay, date.day);\n }\n }\n }\n\n if (date.year === 1 && idx >= 0) {\n let [, startMonth, startDay] = ERA_START_DATES[idx];\n date.month = Math.max(startMonth, date.month);\n\n if (date.month === startMonth) {\n date.day = Math.max(startDay, date.day);\n }\n }\n }\n\n getEras() {\n return ERA_NAMES;\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // Get the number of years in the era, taking into account the date's month and day fields.\n let era = ERA_NAMES.indexOf(date.era);\n let cur = ERA_START_DATES[era];\n let next = ERA_START_DATES[era + 1];\n if (next == null) {\n // 9999 gregorian is the maximum year allowed.\n return 9999 - cur[0] + 1;\n }\n\n let years = next[0] - cur[0];\n\n if (date.month < next[1] || (date.month === next[1] && date.day < next[2])) {\n years++;\n }\n\n return years;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getMinimumMonthInYear(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start ? start[1] : 1;\n }\n\n getMinimumDayInMonth(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start && date.month === start[1] ? start[2] : 1;\n }\n}\n\nfunction getMinimums(date: AnyCalendarDate) {\n if (date.year === 1) {\n let idx = ERA_NAMES.indexOf(date.era);\n return ERA_START_DATES[idx];\n }\n}\n"],"names":[],"version":3,"file":"JapaneseCalendar.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAE;CAAC;AACjG,MAAM,sCAAgB;IAAC;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;CAAC;AAClF,MAAM,oCAAc;IAAC;IAAM;IAAM;IAAM;IAAM;CAAK;AAClD,MAAM,kCAAY;IAAC;IAAS;IAAU;IAAS;IAAU;CAAQ;AAEjE,SAAS,+CAAyB,IAAqB;IACrD,MAAM,MAAM,sCAAgB,SAAS,CAAC,CAAC,CAAC,MAAM,OAAO,IAAI;QACvD,IAAI,KAAK,IAAI,GAAG,MACd,OAAO;QAGT,IAAI,KAAK,IAAI,KAAK,QAAQ,KAAK,KAAK,GAAG,OACrC,OAAO;QAGT,IAAI,KAAK,IAAI,KAAK,QAAQ,KAAK,KAAK,KAAK,SAAS,KAAK,GAAG,GAAG,KAC3D,OAAO;QAGT,OAAO;IACT;IAEA,IAAI,QAAQ,IACV,OAAO,sCAAgB,MAAM,GAAG;IAGlC,IAAI,QAAQ,GACV,OAAO;IAGT,OAAO,MAAM;AACf;AAEA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AAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;6BAhGA,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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 the TC39 Temporal proposal.\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 {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\n }\n\n return idx - 1;\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let eraAddend = ERA_ADDENDS[ERA_NAMES.indexOf(date.era)];\n if (!eraAddend) {\n throw new Error('Unknown era: ' + date.era);\n }\n\n return new CalendarDate(\n date.year + eraAddend,\n date.month,\n date.day\n );\n}\n\n/**\n * The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.\n * Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.\n * Note that eras before 1868 (Gregorian) are not currently supported by this implementation.\n */\nexport class JapaneseCalendar extends GregorianCalendar {\n identifier = 'japanese';\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let era = findEraFromGregorianDate(date);\n\n return new CalendarDate(\n this,\n ERA_NAMES[era],\n date.year - ERA_ADDENDS[era],\n date.month,\n date.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let gregorianDate = toGregorian(date);\n let era = findEraFromGregorianDate(gregorianDate);\n\n if (ERA_NAMES[era] !== date.era) {\n date.era = ERA_NAMES[era];\n date.year = gregorianDate.year - ERA_ADDENDS[era];\n }\n\n // Constrain in case we went before the first supported era.\n this.constrainDate(date);\n }\n\n constrainDate(date: Mutable<AnyCalendarDate>) {\n let idx = ERA_NAMES.indexOf(date.era);\n let end = ERA_END_DATES[idx];\n if (end != null) {\n let [endYear, endMonth, endDay] = end;\n\n // Constrain the year to the maximum possible value in the era.\n // Then constrain the month and day fields within that.\n let maxYear = endYear - ERA_ADDENDS[idx];\n date.year = Math.max(1, Math.min(maxYear, date.year));\n if (date.year === maxYear) {\n date.month = Math.min(endMonth, date.month);\n\n if (date.month === endMonth) {\n date.day = Math.min(endDay, date.day);\n }\n }\n }\n\n if (date.year === 1 && idx >= 0) {\n let [, startMonth, startDay] = ERA_START_DATES[idx];\n date.month = Math.max(startMonth, date.month);\n\n if (date.month === startMonth) {\n date.day = Math.max(startDay, date.day);\n }\n }\n }\n\n getEras() {\n return ERA_NAMES;\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // Get the number of years in the era, taking into account the date's month and day fields.\n let era = ERA_NAMES.indexOf(date.era);\n let cur = ERA_START_DATES[era];\n let next = ERA_START_DATES[era + 1];\n if (next == null) {\n // 9999 gregorian is the maximum year allowed.\n return 9999 - cur[0] + 1;\n }\n\n let years = next[0] - cur[0];\n\n if (date.month < next[1] || (date.month === next[1] && date.day < next[2])) {\n years++;\n }\n\n return years;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getMinimumMonthInYear(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start ? start[1] : 1;\n }\n\n getMinimumDayInMonth(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start && date.month === start[1] ? start[2] : 1;\n }\n}\n\nfunction getMinimums(date: AnyCalendarDate) {\n if (date.year === 1) {\n let idx = ERA_NAMES.indexOf(date.era);\n return ERA_START_DATES[idx];\n }\n}\n"],"names":[],"version":3,"file":"JapaneseCalendar.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAE;CAAC;AACjG,MAAM,sCAAgB;IAAC;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;CAAC;AAClF,MAAM,oCAAc;IAAC;IAAM;IAAM;IAAM;IAAM;CAAK;AAClD,MAAM,kCAAY;IAAC;IAAS;IAAU;IAAS;IAA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AAC,EAAE,GAAG,GAAG,CAAC,EAAE;QAE5B,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,EAAE,IAAK,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,EAAE,EACvE;QAGF,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,sBAAsB,IAAqB,EAAU;QACnD,IAAI,QAAQ,kCAAY;QACxB,OAAO,QAAQ,KAAK,CAAC,EAAE,GAAG;IAC5B;IAEA,qBAAqB,IAAqB,EAAU;QAClD,IAAI,QAAQ,kCAAY;QACxB,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;QAjGK,qBACL,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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 the TC39 Temporal proposal.\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 {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\n }\n\n return idx - 1;\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let eraAddend = ERA_ADDENDS[ERA_NAMES.indexOf(date.era)];\n if (!eraAddend) {\n throw new Error('Unknown era: ' + date.era);\n }\n\n return new CalendarDate(\n date.year + eraAddend,\n date.month,\n date.day\n );\n}\n\n/**\n * The Japanese calendar is based on the Gregorian calendar, but with eras for the reign of each Japanese emperor.\n * Whenever a new emperor ascends to the throne, a new era begins and the year starts again from 1.\n * Note that eras before 1868 (Gregorian) are not currently supported by this implementation.\n */\nexport class JapaneseCalendar extends GregorianCalendar {\n identifier = 'japanese';\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let era = findEraFromGregorianDate(date);\n\n return new CalendarDate(\n this,\n ERA_NAMES[era],\n date.year - ERA_ADDENDS[era],\n date.month,\n date.day\n );\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let gregorianDate = toGregorian(date);\n let era = findEraFromGregorianDate(gregorianDate);\n\n if (ERA_NAMES[era] !== date.era) {\n date.era = ERA_NAMES[era];\n date.year = gregorianDate.year - ERA_ADDENDS[era];\n }\n\n // Constrain in case we went before the first supported era.\n this.constrainDate(date);\n }\n\n constrainDate(date: Mutable<AnyCalendarDate>) {\n let idx = ERA_NAMES.indexOf(date.era);\n let end = ERA_END_DATES[idx];\n if (end != null) {\n let [endYear, endMonth, endDay] = end;\n\n // Constrain the year to the maximum possible value in the era.\n // Then constrain the month and day fields within that.\n let maxYear = endYear - ERA_ADDENDS[idx];\n date.year = Math.max(1, Math.min(maxYear, date.year));\n if (date.year === maxYear) {\n date.month = Math.min(endMonth, date.month);\n\n if (date.month === endMonth) {\n date.day = Math.min(endDay, date.day);\n }\n }\n }\n\n if (date.year === 1 && idx >= 0) {\n let [, startMonth, startDay] = ERA_START_DATES[idx];\n date.month = Math.max(startMonth, date.month);\n\n if (date.month === startMonth) {\n date.day = Math.max(startDay, date.day);\n }\n }\n }\n\n getEras() {\n return ERA_NAMES;\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n // Get the number of years in the era, taking into account the date's month and day fields.\n let era = ERA_NAMES.indexOf(date.era);\n let cur = ERA_START_DATES[era];\n let next = ERA_START_DATES[era + 1];\n if (next == null) {\n // 9999 gregorian is the maximum year allowed.\n return 9999 - cur[0] + 1;\n }\n\n let years = next[0] - cur[0];\n\n if (date.month < next[1] || (date.month === next[1] && date.day < next[2])) {\n years++;\n }\n\n return years;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getMinimumMonthInYear(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start ? start[1] : 1;\n }\n\n getMinimumDayInMonth(date: AnyCalendarDate): number {\n let start = getMinimums(date);\n return start && date.month === start[1] ? start[2] : 1;\n }\n}\n\nfunction getMinimums(date: AnyCalendarDate) {\n if (date.year === 1) {\n let idx = ERA_NAMES.indexOf(date.era);\n return ERA_START_DATES[idx];\n }\n}\n"],"names":[],"version":3,"file":"JapaneseCalendar.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAU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AE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,2CAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAa,MAAO,oBAAoB;;;AAkC1C;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AA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ights 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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAOhG,MAAM,yCAAmB;AAEzB,SAAS,oCAAc,IAAqB;IAC1C,OAAO,KAAK,GAAG,KAAK,WAChB,KAAK,IAAI,GAAG,yCACZ,IAAI,KAAK,IAAI,GAAG;AACtB;AAEA,SAAS,wCAAkB,IAAY;IACrC,IAAI,IAAI,OAAO;IACf,IAAI,IAAI,GACN,OAAO;QAAC;QAAU;KAAE;SAEpB,OAAO;QAAC;QAAiB,IAAI;KAAE;AAEnC;AAOO,MAAM,kDAAuB,CAAA,GAAA,yCAAgB;IAGlD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI;QACtD,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB;QACpC,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,IAAI,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;IAC/D;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAU;QACR,OAAO;YAAC;YAAiB;SAAS;IACpC;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,CAAC,KAAK,KAAK,GAAG,wCAAkB,oCAAc;QAClD,KAAK,GAAG,GAAG;QACX,KAAK,IAAI,GAAG;IACd;IAEA,aAAa,IAAqB,EAAW;QAC3C,OAAO,KAAK,GAAG,KAAK;IACtB;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAc,IAAqB,EAAU;QAC3C,OAAO,KAAK,GAAG,KAAK,kBAAkB,OAAO,OAAO;IACtD;;QAlCK,qBACL,aAAa,MAAO,oBAAoB;;;AAkC1C;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,yCAAe,EAAE,oCAAc;IACjD,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/TaiwanCalendar.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, getExtendedYear, GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst TAIWAN_ERA_START = 1911;\n\nfunction gregorianYear(date: AnyCalendarDate) {\n return date.era === 'minguo'\n ? date.year + TAIWAN_ERA_START\n : 1 - date.year + TAIWAN_ERA_START;\n}\n\nfunction gregorianToTaiwan(year: number): [string, number] {\n let y = year - TAIWAN_ERA_START;\n if (y > 0) {\n return ['minguo', y];\n } else {\n return ['before_minguo', 1 - y];\n }\n}\n\n/**\n * The Taiwanese calendar is the same as the Gregorian calendar, but years\n * are numbered starting from 1912 (Gregorian). Two eras are supported:\n * 'before_minguo' and 'minguo'.\n */\nexport class TaiwanCalendar extends GregorianCalendar {\n identifier = 'roc'; // Republic of China\n\n fromJulianDay(jd: number): CalendarDate {\n let date = super.fromJulianDay(jd);\n let extendedYear = getExtendedYear(date.era, date.year);\n let [era, year] = gregorianToTaiwan(extendedYear);\n return new CalendarDate(this, era, year, date.month, date.day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras() {\n return ['before_minguo', 'minguo'];\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n let [era, year] = gregorianToTaiwan(gregorianYear(date));\n date.era = era;\n date.year = year;\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'before_minguo';\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n getYearsInEra(date: AnyCalendarDate): number {\n return date.era === 'before_minguo' ? 9999 : 9999 - TAIWAN_ERA_START;\n }\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(gregorianYear(date));\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"TaiwanCalendar.module.js.map"}
@@ -78,11 +78,21 @@ function $1f0f7ebf1ae6c530$export$ea840f5a6dda8147(a, b) {
78
78
  function $1f0f7ebf1ae6c530$export$629b0a497aa65267(date, timeZone) {
79
79
  return $1f0f7ebf1ae6c530$export$ea39ec197993aef0(date, $1f0f7ebf1ae6c530$export$d0bdf45af03a6ea3(timeZone));
80
80
  }
81
- function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale) {
81
+ const $1f0f7ebf1ae6c530$var$DAY_MAP = {
82
+ sun: 0,
83
+ mon: 1,
84
+ tue: 2,
85
+ wed: 3,
86
+ thu: 4,
87
+ fri: 5,
88
+ sat: 6
89
+ };
90
+ function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
82
91
  let julian = date.calendar.toJulianDay(date);
83
92
  // If julian is negative, then julian % 7 will be negative, so we adjust
84
93
  // accordingly. Julian day 0 is Monday.
85
- let dayOfWeek = Math.ceil(julian + 1 - $1f0f7ebf1ae6c530$var$getWeekStart(locale)) % 7;
94
+ let weekStart = firstDayOfWeek ? $1f0f7ebf1ae6c530$var$DAY_MAP[firstDayOfWeek] : $1f0f7ebf1ae6c530$var$getWeekStart(locale);
95
+ let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
86
96
  if (dayOfWeek < 0) dayOfWeek += 7;
87
97
  return dayOfWeek;
88
98
  }
@@ -144,14 +154,14 @@ function $1f0f7ebf1ae6c530$export$b2f4953d301981d5(date) {
144
154
  if (date.calendar.getMinimumDayInMonth) return date.calendar.getMinimumDayInMonth(date);
145
155
  return 1;
146
156
  }
147
- function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale) {
148
- let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale);
157
+ function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek) {
158
+ let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
149
159
  return date.subtract({
150
160
  days: dayOfWeek
151
161
  });
152
162
  }
153
- function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale) {
154
- return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale).add({
163
+ function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale, firstDayOfWeek) {
164
+ return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek).add({
155
165
  days: 6
156
166
  });
157
167
  }
@@ -182,9 +192,9 @@ function $1f0f7ebf1ae6c530$var$getWeekStart(locale) {
182
192
  let region = $1f0f7ebf1ae6c530$var$getRegion(locale);
183
193
  return region ? (0, $4d88eff242b38a9e$exports.weekStartData)[region] || 0 : 0;
184
194
  }
185
- function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale) {
195
+ function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale, firstDayOfWeek) {
186
196
  let days = date.calendar.getDaysInMonth(date);
187
- return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale) + days) / 7);
197
+ return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale, firstDayOfWeek) + days) / 7);
188
198
  }
189
199
  function $1f0f7ebf1ae6c530$export$5c333a116e949cdd(a, b) {
190
200
  if (a && b) return a.compare(b) <= 0 ? a : b;