@internationalized/date 3.5.3-nightly.4516 → 3.5.3-nightly.4523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +29 -24
- package/dist/main.js +29 -24
- package/dist/main.js.map +1 -1
- package/dist/module.js +29 -24
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/calendars/PersianCalendar.ts +32 -40
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;ACbhG;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;ACbhG;;;;;;;;;;CAUC;AAQM,SAAS,0CAAI,MAAc,EAAE,SAAiB;IACnD,OAAO,SAAS,YAAY,KAAK,KAAK,CAAC,SAAS;AAClD;AAEO,SAAS,0CAAK,IAAkB;IACrC,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;SAEhF,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;AAE1E;AAEO,SAAS,0CAAa,IAAsB;IACjD,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW;SAE3I,OAAO,IAAI,CAAA,GAAA,yCAAe,EAAE,KAAK,Q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UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IACzG,IAAI,MAAM,SAAS,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EAAE;IAE1G,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB;;","sources":["packages/@internationalized/date/src/index.ts","packages/@internationalized/date/src/CalendarDate.ts","packages/@internationalized/date/src/manipulation.ts","packages/@internationalized/date/src/conversion.ts","packages/@internationalized/date/src/calendars/GregorianCalendar.ts","packages/@internationalized/date/src/utils.ts","packages/@internationalized/date/src/queries.ts","packages/@internationalized/date/src/weekStartData.ts","packages/@internationalized/date/src/string.ts","packages/@internationalized/date/src/calendars/JapaneseCalendar.ts","packages/@internationalized/date/src/calendars/BuddhistCalendar.ts","packages/@internationalized/date/src/calendars/TaiwanCalendar.ts","packages/@internationalized/date/src/calendars/PersianCalendar.ts","packages/@internationalized/date/src/calendars/IndianCalendar.ts","packages/@internationalized/date/src/calendars/IslamicCalendar.ts","packages/@internationalized/date/src/calendars/HebrewCalendar.ts","packages/@internationalized/date/src/calendars/EthiopicCalendar.ts","packages/@internationalized/date/src/createCalendar.ts","packages/@internationalized/date/src/DateFormatter.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\nexport type {\n AnyCalendarDate,\n AnyTime,\n AnyDateTime,\n Calendar,\n DateDuration,\n TimeDuration,\n DateTimeDuration,\n DateFields,\n TimeFields,\n DateField,\n TimeField,\n Disambiguation,\n CycleOptions,\n CycleTimeOptions\n} from './types';\n\nexport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nexport {GregorianCalendar} from './calendars/GregorianCalendar';\nexport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nexport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nexport {TaiwanCalendar} from './calendars/TaiwanCalendar';\nexport {PersianCalendar} from './calendars/PersianCalendar';\nexport {IndianCalendar} from './calendars/IndianCalendar';\nexport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nexport {HebrewCalendar} from './calendars/HebrewCalendar';\nexport {EthiopicCalendar, EthiopicAmeteAlemCalendar, CopticCalendar} from './calendars/EthiopicCalendar';\nexport {createCalendar} from './createCalendar';\nexport {\n toCalendarDate,\n toCalendarDateTime,\n toTime,\n toCalendar,\n toZoned,\n toTimeZone,\n toLocalTimeZone,\n fromDate,\n fromAbsolute\n} from './conversion';\nexport {\n isSameDay,\n isSameMonth,\n isSameYear,\n isEqualDay,\n isEqualMonth,\n isEqualYear,\n isToday,\n getDayOfWeek,\n now,\n today,\n getHoursInDay,\n getLocalTimeZone,\n startOfMonth,\n startOfWeek,\n startOfYear,\n endOfMonth,\n endOfWeek,\n endOfYear,\n getMinimumMonthInYear,\n getMinimumDayInMonth,\n getWeeksInMonth,\n minDate,\n maxDate,\n isWeekend,\n isWeekday\n} from './queries';\nexport {\n parseDate,\n parseDateTime,\n parseTime,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseZonedDateTime,\n parseDuration\n} from './string';\nexport {DateFormatter} from './DateFormatter';\n","/*\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\nimport {add, addTime, addZoned, constrain, constrainTime, cycleDate, cycleTime, cycleZoned, set, setTime, setZoned, subtract, subtractTime, subtractZoned} from './manipulation';\nimport {AnyCalendarDate, AnyTime, Calendar, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {compareDate, compareTime} from './queries';\nimport {dateTimeToString, dateToString, timeToString, zonedDateTimeToString} from './string';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {toCalendarDateTime, toDate, toZoned, zonedToDate} from './conversion';\n\nfunction shiftArgs(args: any[]) {\n let calendar: Calendar = typeof args[0] === 'object'\n ? args.shift()\n : new GregorianCalendar();\n\n let era: string;\n if (typeof args[0] === 'string') {\n era = args.shift();\n } else {\n let eras = calendar.getEras();\n era = eras[eras.length - 1];\n }\n\n let year = args.shift();\n let month = args.shift();\n let day = args.shift();\n\n return [calendar, era, year, month, day];\n}\n\n/** A CalendarDate represents a date without any time components in a specific calendar system. */\nexport class CalendarDate {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.\n // If that behavior is desired, use the AnyCalendarDate interface instead.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n\n constructor(year: number, month: number, day: number);\n constructor(era: string, year: number, month: number, day: number);\n constructor(calendar: Calendar, year: number, month: number, day: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDate {\n if (this.era) {\n return new CalendarDate(this.calendar, this.era, this.year, this.month, this.day);\n } else {\n return new CalendarDate(this.calendar, this.year, this.month, this.day);\n }\n }\n\n /** Returns a new `CalendarDate` with the given duration added to it. */\n add(duration: DateDuration): CalendarDate {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given duration subtracted from it. */\n subtract(duration: DateDuration): CalendarDate {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields): CalendarDate {\n return set(this, fields);\n }\n\n /**\n * Returns a new `CalendarDate` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate {\n return cycleDate(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */\n toDate(timeZone: string): Date {\n return toDate(this, timeZone);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: AnyCalendarDate): number {\n return compareDate(this, b);\n }\n}\n\n/** A Time represents a clock time without any date components. */\nexport class Time {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The hour, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(\n hour: number = 0,\n minute: number = 0,\n second: number = 0,\n millisecond: number = 0\n ) {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n constrainTime(this);\n }\n\n /** Returns a copy of this time. */\n copy(): Time {\n return new Time(this.hour, this.minute, this.second, this.millisecond);\n }\n\n /** Returns a new `Time` with the given duration added to it. */\n add(duration: TimeDuration) {\n return addTime(this, duration);\n }\n\n /** Returns a new `Time` with the given duration subtracted from it. */\n subtract(duration: TimeDuration) {\n return subtractTime(this, duration);\n }\n\n /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: TimeFields) {\n return setTime(this, fields);\n }\n\n /**\n * Returns a new `Time` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: TimeField, amount: number, options?: CycleTimeOptions) {\n return cycleTime(this, field, amount, options);\n }\n\n /** Converts the time to an ISO 8601 formatted string. */\n toString() {\n return timeToString(this);\n }\n\n /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */\n compare(b: AnyTime) {\n return compareTime(this, b);\n }\n}\n\n/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */\nexport class CalendarDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDateTime {\n if (this.era) {\n return new CalendarDateTime(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new CalendarDateTime(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `CalendarDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): CalendarDateTime {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): CalendarDateTime {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields): CalendarDateTime {\n return set(setTime(this, fields), fields);\n }\n\n /**\n * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime {\n switch (field) {\n case 'era':\n case 'year':\n case 'month':\n case 'day':\n return cycleDate(this, field, amount, options);\n default:\n return cycleTime(this, field, amount, options);\n }\n }\n\n /** Converts the date to a native JavaScript Date object in the given time zone. */\n toDate(timeZone: string, disambiguation?: Disambiguation): Date {\n return toDate(this, timeZone, disambiguation);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateTimeToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n let res = compareDate(this, b);\n if (res === 0) {\n return compareTime(this, toCalendarDateTime(b));\n }\n\n return res;\n }\n}\n\n/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */\nexport class ZonedDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n /** The IANA time zone identifier that this date and time is represented in. */\n public readonly timeZone: string;\n /** The UTC offset for this time, in milliseconds. */\n public readonly offset: number;\n\n constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n let timeZone = args.shift();\n let offset = args.shift();\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.timeZone = timeZone;\n this.offset = offset;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): ZonedDateTime {\n if (this.era) {\n return new ZonedDateTime(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new ZonedDateTime(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `ZonedDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration) {\n return addZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration) {\n return subtractZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields, disambiguation?: Disambiguation) {\n return setZoned(this, fields, disambiguation);\n }\n\n /**\n * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions) {\n return cycleZoned(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object. */\n toDate() {\n return zonedToDate(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */\n toString() {\n return zonedDateTimeToString(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string in UTC. */\n toAbsoluteString() {\n return this.toDate().toISOString();\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime) {\n // TODO: Is this a bad idea??\n return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();\n }\n}\n","/*\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\nimport {AnyCalendarDate, AnyDateTime, AnyTime, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, toAbsolute, toCalendar, toCalendarDateTime} from './conversion';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst ONE_HOUR = 3600000;\n\nexport function add(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function add(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration) {\n let mutableDate: Mutable<AnyCalendarDate | AnyDateTime> = date.copy();\n let days = 'hour' in mutableDate ? addTimeFields(mutableDate, duration) : 0;\n\n addYears(mutableDate, duration.years || 0);\n if (mutableDate.calendar.balanceYearMonth) {\n mutableDate.calendar.balanceYearMonth(mutableDate, date);\n }\n\n mutableDate.month += duration.months || 0;\n\n balanceYearMonth(mutableDate);\n constrainMonthDay(mutableDate);\n\n mutableDate.day += (duration.weeks || 0) * 7;\n mutableDate.day += duration.days || 0;\n mutableDate.day += days;\n\n balanceDay(mutableDate);\n\n if (mutableDate.calendar.balanceDate) {\n mutableDate.calendar.balanceDate(mutableDate);\n }\n\n // Constrain in case adding ended up with a date outside the valid range for the calendar system.\n // The behavior here is slightly different than when constraining in the `set` function in that\n // we adjust smaller fields to their minimum/maximum values rather than constraining each field\n // individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.\n if (mutableDate.year < 1) {\n mutableDate.year = 1;\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);\n if (mutableDate.year > maxYear) {\n let isInverseEra = mutableDate.calendar.isInverseEra?.(mutableDate);\n mutableDate.year = maxYear;\n mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);\n mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n if (mutableDate.month < 1) {\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);\n if (mutableDate.month > maxMonth) {\n mutableDate.month = maxMonth;\n mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));\n return mutableDate;\n}\n\nfunction addYears(date: Mutable<AnyCalendarDate>, years: number) {\n if (date.calendar.isInverseEra?.(date)) {\n years = -years;\n }\n\n date.year += years;\n}\n\nfunction balanceYearMonth(date: Mutable<AnyCalendarDate>) {\n while (date.month < 1) {\n addYears(date, -1);\n date.month += date.calendar.getMonthsInYear(date);\n }\n\n let monthsInYear = 0;\n while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {\n date.month -= monthsInYear;\n addYears(date, 1);\n }\n}\n\nfunction balanceDay(date: Mutable<AnyCalendarDate>) {\n while (date.day < 1) {\n date.month--;\n balanceYearMonth(date);\n date.day += date.calendar.getDaysInMonth(date);\n }\n\n while (date.day > date.calendar.getDaysInMonth(date)) {\n date.day -= date.calendar.getDaysInMonth(date);\n date.month++;\n balanceYearMonth(date);\n }\n}\n\nfunction constrainMonthDay(date: Mutable<AnyCalendarDate>) {\n date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));\n date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));\n}\n\nexport function constrain(date: Mutable<AnyCalendarDate>) {\n if (date.calendar.constrainDate) {\n date.calendar.constrainDate(date);\n }\n\n date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));\n constrainMonthDay(date);\n}\n\nexport function invertDuration(duration: DateTimeDuration): DateTimeDuration {\n let inverseDuration = {};\n for (let key in duration) {\n if (typeof duration[key] === 'number') {\n inverseDuration[key] = -duration[key];\n }\n }\n\n return inverseDuration;\n}\n\nexport function subtract(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function subtract(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function subtract(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime {\n return add(date, invertDuration(duration));\n}\n\nexport function set(date: CalendarDateTime, fields: DateFields): CalendarDateTime;\nexport function set(date: CalendarDate, fields: DateFields): CalendarDate;\nexport function set(date: CalendarDate | CalendarDateTime, fields: DateFields) {\n let mutableDate: Mutable<AnyCalendarDate> = date.copy();\n\n if (fields.era != null) {\n mutableDate.era = fields.era;\n }\n\n if (fields.year != null) {\n mutableDate.year = fields.year;\n }\n\n if (fields.month != null) {\n mutableDate.month = fields.month;\n }\n\n if (fields.day != null) {\n mutableDate.day = fields.day;\n }\n\n constrain(mutableDate);\n return mutableDate;\n}\n\nexport function setTime(value: CalendarDateTime, fields: TimeFields): CalendarDateTime;\nexport function setTime(value: Time, fields: TimeFields): Time;\nexport function setTime(value: Time | CalendarDateTime, fields: TimeFields) {\n let mutableValue: Mutable<Time | CalendarDateTime> = value.copy();\n\n if (fields.hour != null) {\n mutableValue.hour = fields.hour;\n }\n\n if (fields.minute != null) {\n mutableValue.minute = fields.minute;\n }\n\n if (fields.second != null) {\n mutableValue.second = fields.second;\n }\n\n if (fields.millisecond != null) {\n mutableValue.millisecond = fields.millisecond;\n }\n\n constrainTime(mutableValue);\n return mutableValue;\n}\n\nfunction balanceTime(time: Mutable<AnyTime>): number {\n time.second += Math.floor(time.millisecond / 1000);\n time.millisecond = nonNegativeMod(time.millisecond, 1000);\n\n time.minute += Math.floor(time.second / 60);\n time.second = nonNegativeMod(time.second, 60);\n\n time.hour += Math.floor(time.minute / 60);\n time.minute = nonNegativeMod(time.minute, 60);\n\n let days = Math.floor(time.hour / 24);\n time.hour = nonNegativeMod(time.hour, 24);\n\n return days;\n}\n\nexport function constrainTime(time: Mutable<AnyTime>) {\n time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));\n time.second = Math.max(0, Math.min(time.second, 59));\n time.minute = Math.max(0, Math.min(time.minute, 59));\n time.hour = Math.max(0, Math.min(time.hour, 23));\n}\n\nfunction nonNegativeMod(a: number, b: number) {\n let result = a % b;\n if (result < 0) {\n result += b;\n }\n return result;\n}\n\nfunction addTimeFields(time: Mutable<AnyTime>, duration: TimeDuration): number {\n time.hour += duration.hours || 0;\n time.minute += duration.minutes || 0;\n time.second += duration.seconds || 0;\n time.millisecond += duration.milliseconds || 0;\n return balanceTime(time);\n}\n\nexport function addTime(time: Time, duration: TimeDuration): Time {\n let res = time.copy();\n addTimeFields(res, duration);\n return res;\n}\n\nexport function subtractTime(time: Time, duration: TimeDuration): Time {\n return addTime(time, invertDuration(duration));\n}\n\nexport function cycleDate(value: CalendarDateTime, field: DateField, amount: number, options?: CycleOptions): CalendarDateTime;\nexport function cycleDate(value: CalendarDate, field: DateField, amount: number, options?: CycleOptions): CalendarDate;\nexport function cycleDate(value: CalendarDate | CalendarDateTime, field: DateField, amount: number, options?: CycleOptions) {\n let mutable: Mutable<CalendarDate | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'era': {\n let eras = value.calendar.getEras();\n let eraIndex = eras.indexOf(value.era);\n if (eraIndex < 0) {\n throw new Error('Invalid era: ' + value.era);\n }\n eraIndex = cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round);\n mutable.era = eras[eraIndex];\n\n // Constrain the year and other fields within the era, so the era doesn't change when we balance below.\n constrain(mutable);\n break;\n }\n case 'year': {\n if (mutable.calendar.isInverseEra?.(mutable)) {\n amount = -amount;\n }\n\n // The year field should not cycle within the era as that can cause weird behavior affecting other fields.\n // We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back\n // we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.\n mutable.year = cycleValue(value.year, amount, -Infinity, 9999, options?.round);\n if (mutable.year === -Infinity) {\n mutable.year = 1;\n }\n\n if (mutable.calendar.balanceYearMonth) {\n mutable.calendar.balanceYearMonth(mutable, value);\n }\n break;\n }\n case 'month':\n mutable.month = cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round);\n break;\n case 'day':\n mutable.day = cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n if (value.calendar.balanceDate) {\n value.calendar.balanceDate(mutable);\n }\n\n constrain(mutable);\n return mutable;\n}\n\nexport function cycleTime(value: CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime;\nexport function cycleTime(value: Time, field: TimeField, amount: number, options?: CycleTimeOptions): Time;\nexport function cycleTime(value: Time | CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions) {\n let mutable: Mutable<Time | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'hour': {\n let hours = value.hour;\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = hours >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n mutable.hour = cycleValue(hours, amount, min, max, options?.round);\n break;\n }\n case 'minute':\n mutable.minute = cycleValue(value.minute, amount, 0, 59, options?.round);\n break;\n case 'second':\n mutable.second = cycleValue(value.second, amount, 0, 59, options?.round);\n break;\n case 'millisecond':\n mutable.millisecond = cycleValue(value.millisecond, amount, 0, 999, options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n return mutable;\n}\n\nfunction cycleValue(value: number, amount: number, min: number, max: number, round = false) {\n if (round) {\n value += Math.sign(amount);\n\n if (value < min) {\n value = max;\n }\n\n let div = Math.abs(amount);\n if (amount > 0) {\n value = Math.ceil(value / div) * div;\n } else {\n value = Math.floor(value / div) * div;\n }\n\n if (value > max) {\n value = min;\n }\n } else {\n value += amount;\n if (value < min) {\n value = max - (min - value - 1);\n } else if (value > max) {\n value = min + (value - max - 1);\n }\n }\n\n return value;\n}\n\nexport function addZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n let ms: number;\n if ((duration.years != null && duration.years !== 0) || (duration.months != null && duration.months !== 0) || (duration.weeks != null && duration.weeks !== 0) || (duration.days != null && duration.days !== 0)) {\n let res = add(toCalendarDateTime(dateTime), {\n years: duration.years,\n months: duration.months,\n weeks: duration.weeks,\n days: duration.days\n });\n\n // Changing the date may change the timezone offset, so we need to recompute\n // using the 'compatible' disambiguation.\n ms = toAbsolute(res, dateTime.timeZone);\n } else {\n // Otherwise, preserve the offset of the original date.\n ms = epochFromDate(dateTime) - dateTime.offset;\n }\n\n // Perform time manipulation in milliseconds rather than on the original time fields to account for DST.\n // For example, adding one hour during a DST transition may result in the hour field staying the same or\n // skipping an hour. This results in the offset field changing value instead of the specified field.\n ms += duration.milliseconds || 0;\n ms += (duration.seconds || 0) * 1000;\n ms += (duration.minutes || 0) * 60 * 1000;\n ms += (duration.hours || 0) * 60 * 60 * 1000;\n\n let res = fromAbsolute(ms, dateTime.timeZone);\n return toCalendar(res, dateTime.calendar);\n}\n\nexport function subtractZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n return addZoned(dateTime, invertDuration(duration));\n}\n\nexport function cycleZoned(dateTime: ZonedDateTime, field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime {\n // For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.\n // For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC\n // offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.\n switch (field) {\n case 'hour': {\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = dateTime.hour >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n\n // The minimum and maximum hour may be affected by daylight saving time.\n // For example, it might jump forward at midnight, and skip 1am.\n // Or it might end at midnight and repeat the 11pm hour. To handle this, we get\n // the possible absolute times for the min and max, and find the maximum range\n // that is within the current day.\n let plainDateTime = toCalendarDateTime(dateTime);\n let minDate = toCalendar(setTime(plainDateTime, {hour: min}), new GregorianCalendar());\n let minAbsolute = [toAbsolute(minDate, dateTime.timeZone, 'earlier'), toAbsolute(minDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === minDate.day)[0];\n\n let maxDate = toCalendar(setTime(plainDateTime, {hour: max}), new GregorianCalendar());\n let maxAbsolute = [toAbsolute(maxDate, dateTime.timeZone, 'earlier'), toAbsolute(maxDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === maxDate.day).pop()!;\n\n // Since hours may repeat, we need to operate on the absolute time in milliseconds.\n // This is done in hours from the Unix epoch so that cycleValue works correctly,\n // and then converted back to milliseconds.\n let ms = epochFromDate(dateTime) - dateTime.offset;\n let hours = Math.floor(ms / ONE_HOUR);\n let remainder = ms % ONE_HOUR;\n ms = cycleValue(\n hours,\n amount,\n Math.floor(minAbsolute / ONE_HOUR),\n Math.floor(maxAbsolute / ONE_HOUR),\n options?.round\n ) * ONE_HOUR + remainder;\n\n // Now compute the new timezone offset, and convert the absolute time back to local time.\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n case 'minute':\n case 'second':\n case 'millisecond':\n // @ts-ignore\n return cycleTime(dateTime, field, amount, options);\n case 'era':\n case 'year':\n case 'month':\n case 'day': {\n let res = cycleDate(toCalendarDateTime(dateTime), field, amount, options);\n let ms = toAbsolute(res, dateTime.timeZone);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n default:\n throw new Error('Unsupported field ' + field);\n }\n}\n\nexport function setZoned(dateTime: ZonedDateTime, fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\n // Set the date/time fields, and recompute the UTC offset to account for DST changes.\n // We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.\n let plainDateTime = toCalendarDateTime(dateTime);\n let res = setTime(set(plainDateTime, fields), fields);\n\n // If the resulting plain date time values are equal, return the original time.\n // We don't want to change the offset when setting the time to the same value.\n if (res.compare(plainDateTime) === 0) {\n return dateTime;\n }\n\n let ms = toAbsolute(res, dateTime.timeZone, disambiguation);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n}\n","/*\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, AnyDateTime, AnyTime, Calendar, DateFields, Disambiguation, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {constrain} from './manipulation';\nimport {getExtendedYear, GregorianCalendar} from './calendars/GregorianCalendar';\nimport {getLocalTimeZone} from './queries';\nimport {Mutable} from './utils';\n\nexport function epochFromDate(date: AnyDateTime) {\n date = toCalendar(date, new GregorianCalendar());\n let year = getExtendedYear(date.era, date.year);\n return epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n}\n\nfunction epochFromParts(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number) {\n // Note: Date.UTC() interprets one and two-digit years as being in the\n // 20th century, so don't use it\n let date = new Date();\n date.setUTCHours(hour, minute, second, millisecond);\n date.setUTCFullYear(year, month - 1, day);\n return date.getTime();\n}\n\nexport function getTimeZoneOffset(ms: number, timeZone: string) {\n // Fast path for UTC.\n if (timeZone === 'UTC') {\n return 0;\n }\n\n // Fast path: for local timezone after 1970, use native Date.\n if (ms > 0 && timeZone === getLocalTimeZone()) {\n return new Date(ms).getTimezoneOffset() * -60 * 1000;\n }\n\n let {year, month, day, hour, minute, second} = getTimeZoneParts(ms, timeZone);\n let utc = epochFromParts(year, month, day, hour, minute, second, 0);\n return utc - Math.floor(ms / 1000) * 1000;\n}\n\nconst formattersByTimeZone = new Map<string, Intl.DateTimeFormat>();\n\nfunction getTimeZoneParts(ms: number, timeZone: string) {\n let formatter = formattersByTimeZone.get(timeZone);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour12: false,\n era: 'short',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n\n formattersByTimeZone.set(timeZone, formatter);\n }\n\n let parts = formatter.formatToParts(new Date(ms));\n let namedParts: {[name: string]: string} = {};\n for (let part of parts) {\n if (part.type !== 'literal') {\n namedParts[part.type] = part.value;\n }\n }\n\n\n return {\n // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253\n year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,\n month: +namedParts.month,\n day: +namedParts.day,\n hour: namedParts.hour === '24' ? 0 : +namedParts.hour, // bugs.chromium.org/p/chromium/issues/detail?id=1045791\n minute: +namedParts.minute,\n second: +namedParts.second\n };\n}\n\nconst DAYMILLIS = 86400000;\n\nexport function possibleAbsolutes(date: CalendarDateTime, timeZone: string): number[] {\n let ms = epochFromDate(date);\n let earlier = ms - getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let later = ms - getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n return getValidWallTimes(date, timeZone, earlier, later);\n}\n\nfunction getValidWallTimes(date: CalendarDateTime, timeZone: string, earlier: number, later: number): number[] {\n let found = earlier === later ? [earlier] : [earlier, later];\n return found.filter(absolute => isValidWallTime(date, timeZone, absolute));\n}\n\nfunction isValidWallTime(date: CalendarDateTime, timeZone: string, absolute: number) {\n let parts = getTimeZoneParts(absolute, timeZone);\n return date.year === parts.year\n && date.month === parts.month\n && date.day === parts.day\n && date.hour === parts.hour\n && date.minute === parts.minute\n && date.second === parts.second;\n}\n\nexport function toAbsolute(date: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): number {\n let dateTime = toCalendarDateTime(date);\n\n // Fast path: if the time zone is UTC, use native Date.\n if (timeZone === 'UTC') {\n return epochFromDate(dateTime);\n }\n\n // Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.\n if (timeZone === getLocalTimeZone() && disambiguation === 'compatible') {\n dateTime = toCalendar(dateTime, new GregorianCalendar());\n\n // Don't use Date constructor here because two-digit years are interpreted in the 20th century.\n let date = new Date();\n let year = getExtendedYear(dateTime.era, dateTime.year);\n date.setFullYear(year, dateTime.month - 1, dateTime.day);\n date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n return date.getTime();\n }\n\n let ms = epochFromDate(dateTime);\n let offsetBefore = getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let offsetAfter = getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n let valid = getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);\n\n if (valid.length === 1) {\n return valid[0];\n }\n\n if (valid.length > 1) {\n switch (disambiguation) {\n // 'compatible' means 'earlier' for \"fall back\" transitions\n case 'compatible':\n case 'earlier':\n return valid[0];\n case 'later':\n return valid[valid.length - 1];\n case 'reject':\n throw new RangeError('Multiple possible absolute times found');\n }\n }\n\n switch (disambiguation) {\n case 'earlier':\n return Math.min(ms - offsetBefore, ms - offsetAfter);\n // 'compatible' means 'later' for \"spring forward\" transitions\n case 'compatible':\n case 'later':\n return Math.max(ms - offsetBefore, ms - offsetAfter);\n case 'reject':\n throw new RangeError('No such absolute time found');\n }\n}\n\nexport function toDate(dateTime: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): Date {\n return new Date(toAbsolute(dateTime, timeZone, disambiguation));\n}\n\n/**\n * Takes a Unix epoch (milliseconds since 1970) and converts it to the provided time zone.\n */\nexport function fromAbsolute(ms: number, timeZone: string): ZonedDateTime {\n let offset = getTimeZoneOffset(ms, timeZone);\n let date = new Date(ms + offset);\n let year = date.getUTCFullYear();\n let month = date.getUTCMonth() + 1;\n let day = date.getUTCDate();\n let hour = date.getUTCHours();\n let minute = date.getUTCMinutes();\n let second = date.getUTCSeconds();\n let millisecond = date.getUTCMilliseconds();\n\n return new ZonedDateTime(year, month, day, timeZone, offset, hour, minute, second, millisecond);\n}\n\n/**\n * Takes a `Date` object and converts it to the provided time zone.\n */\nexport function fromDate(date: Date, timeZone: string): ZonedDateTime {\n return fromAbsolute(date.getTime(), timeZone);\n}\n\nexport function fromDateToLocal(date: Date): ZonedDateTime {\n return fromDate(date, getLocalTimeZone());\n}\n\n/** Converts a value with date components such as a `CalendarDateTime` or `ZonedDateTime` into a `CalendarDate`. */\nexport function toCalendarDate(dateTime: AnyCalendarDate): CalendarDate {\n return new CalendarDate(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);\n}\n\nexport function toDateFields(date: AnyCalendarDate): DateFields {\n return {\n era: date.era,\n year: date.year,\n month: date.month,\n day: date.day\n };\n}\n\nexport function toTimeFields(date: AnyTime): TimeFields {\n return {\n hour: date.hour,\n minute: date.minute,\n second: date.second,\n millisecond: date.millisecond\n };\n}\n\n/**\n * Converts a date value to a `CalendarDateTime`. An optional `Time` value can be passed to set the time\n * of the resulting value, otherwise it will default to midnight.\n */\nexport function toCalendarDateTime(date: CalendarDate | CalendarDateTime | ZonedDateTime, time?: AnyTime): CalendarDateTime {\n let hour = 0, minute = 0, second = 0, millisecond = 0;\n if ('timeZone' in date) {\n ({hour, minute, second, millisecond} = date);\n } else if ('hour' in date && !time) {\n return date;\n }\n\n if (time) {\n ({hour, minute, second, millisecond} = time);\n }\n\n return new CalendarDateTime(\n date.calendar,\n date.era,\n date.year,\n date.month,\n date.day,\n hour,\n minute,\n second,\n millisecond\n );\n}\n\n/** Extracts the time components from a value containing a date and time. */\nexport function toTime(dateTime: CalendarDateTime | ZonedDateTime): Time {\n return new Time(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n}\n\n/** Converts a date from one calendar system to another. */\nexport function toCalendar<T extends AnyCalendarDate>(date: T, calendar: Calendar): T {\n if (date.calendar.identifier === calendar.identifier) {\n return date;\n }\n\n let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));\n let copy: Mutable<T> = date.copy();\n copy.calendar = calendar;\n copy.era = calendarDate.era;\n copy.year = calendarDate.year;\n copy.month = calendarDate.month;\n copy.day = calendarDate.day;\n constrain(copy);\n return copy;\n}\n\n/**\n * Converts a date value to a `ZonedDateTime` in the provided time zone. The `disambiguation` option can be set\n * to control how values that fall on daylight saving time changes are interpreted.\n */\nexport function toZoned(date: CalendarDate | CalendarDateTime | ZonedDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime {\n if (date instanceof ZonedDateTime) {\n if (date.timeZone === timeZone) {\n return date;\n }\n\n return toTimeZone(date, timeZone);\n }\n\n let ms = toAbsolute(date, timeZone, disambiguation);\n return fromAbsolute(ms, timeZone);\n}\n\nexport function zonedToDate(date: ZonedDateTime) {\n let ms = epochFromDate(date) - date.offset;\n return new Date(ms);\n}\n\n/** Converts a `ZonedDateTime` from one time zone to another. */\nexport function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime {\n let ms = epochFromDate(date) - date.offset;\n return toCalendar(fromAbsolute(ms, timeZone), date.calendar);\n}\n\n/** Converts the given `ZonedDateTime` into the user's local time zone. */\nexport function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime {\n return toTimeZone(date, getLocalTimeZone());\n}\n","/*\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 {mod, Mutable} from '../utils';\n\nconst EPOCH = 1721426; // 001/01/03 Julian C.E.\nexport function gregorianToJulianDay(era: string, year: number, month: number, day: number): number {\n year = getExtendedYear(era, year);\n\n let y1 = year - 1;\n let monthOffset = -2;\n if (month <= 2) {\n monthOffset = 0;\n } else if (isLeapYear(year)) {\n monthOffset = -1;\n }\n\n return (\n EPOCH -\n 1 +\n 365 * y1 +\n Math.floor(y1 / 4) -\n Math.floor(y1 / 100) +\n Math.floor(y1 / 400) +\n Math.floor((367 * month - 362) / 12 + monthOffset + day)\n );\n}\n\nexport function isLeapYear(year: number): boolean {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function getExtendedYear(era: string, year: number): number {\n return era === 'BC' ? 1 - year : year;\n}\n\nexport function fromExtendedYear(year: number): [string, number] {\n let era = 'AD';\n if (year <= 0) {\n era = 'BC';\n year = 1 - year;\n }\n\n return [era, year];\n}\n\nconst daysInMonth = {\n standard: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n leapyear: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n};\n\n/**\n * The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.\n * Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.\n */\nexport class GregorianCalendar implements Calendar {\n identifier = 'gregory';\n\n fromJulianDay(jd: number): CalendarDate {\n let jd0 = jd;\n let depoch = jd0 - EPOCH;\n let quadricent = Math.floor(depoch / 146097);\n let dqc = mod(depoch, 146097);\n let cent = Math.floor(dqc / 36524);\n let dcent = mod(dqc, 36524);\n let quad = Math.floor(dcent / 1461);\n let dquad = mod(dcent, 1461);\n let yindex = Math.floor(dquad / 365);\n\n let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);\n let [era, year] = fromExtendedYear(extendedYear);\n let yearDay = jd0 - gregorianToJulianDay(era, year, 1, 1);\n let leapAdj = 2;\n if (jd0 < gregorianToJulianDay(era, year, 3, 1)) {\n leapAdj = 0;\n } else if (isLeapYear(year)) {\n leapAdj = 1;\n }\n let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);\n let day = jd0 - gregorianToJulianDay(era, year, month, 1) + 1;\n\n return new CalendarDate(era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return gregorianToJulianDay(date.era, date.year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return daysInMonth[isLeapYear(date.year) ? 'leapyear' : 'standard'][date.month - 1];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getMonthsInYear(date: AnyCalendarDate): number {\n return 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 366 : 365;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getYearsInEra(date: AnyCalendarDate): number {\n return 9999;\n }\n\n getEras() {\n return ['BC', 'AD'];\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BC';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BC' ? 'AD' : 'BC';\n date.year = 1 - date.year;\n }\n }\n}\n","/*\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\nimport {CalendarDate, CalendarDateTime} from './CalendarDate';\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n};\n\nexport function mod(amount: number, numerator: number): number {\n return amount - numerator * Math.floor(amount / numerator);\n}\n\nexport function copy(date: CalendarDate): Mutable<CalendarDate> {\n if (date.era) {\n return new CalendarDate(date.calendar, date.era, date.year, date.month, date.day);\n } else {\n return new CalendarDate(date.calendar, date.year, date.month, date.day);\n }\n}\n\nexport function copyDateTime(date: CalendarDateTime): Mutable<CalendarDateTime> {\n if (date.era) {\n return new CalendarDateTime(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n } else {\n return new CalendarDateTime(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);\n }\n}\n","/*\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\nimport {AnyCalendarDate, AnyTime} from './types';\nimport {CalendarDate, CalendarDateTime, ZonedDateTime} from './CalendarDate';\nimport {fromAbsolute, toAbsolute, toCalendar, toCalendarDate} from './conversion';\nimport {weekStartData} from './weekStartData';\n\ntype DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */\nexport function isSameDay(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */\nexport function isSameMonth(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n // In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */\nexport function isSameYear(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n a = startOfYear(a);\n b = startOfYear(b);\n return a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the given dates occur on the same day, and are of the same calendar system. */\nexport function isEqualDay(a: DateValue, b: DateValue): boolean {\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, and are of the same calendar system. */\nexport function isEqualMonth(a: DateValue, b: DateValue): boolean {\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, and are of the same calendar system. */\nexport function isEqualYear(a: DateValue, b: DateValue): boolean {\n a = startOfYear(a);\n b = startOfYear(b);\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the date is today in the given time zone. */\nexport function isToday(date: DateValue, timeZone: string): boolean {\n return isSameDay(date, today(timeZone));\n}\n\n/**\n * Returns the day of week for the given date and locale. Days are numbered from zero to six,\n * where zero is the first day of the week in the given locale. For example, in the United States,\n * the first day of the week is Sunday, but in France it is Monday.\n */\nexport function getDayOfWeek(date: DateValue, locale: string): number {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1 - getWeekStart(locale)) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n return dayOfWeek;\n}\n\n/** Returns the current time in the given time zone. */\nexport function now(timeZone: string): ZonedDateTime {\n return fromAbsolute(Date.now(), timeZone);\n}\n\n/** Returns today's date in the given time zone. */\nexport function today(timeZone: string): CalendarDate {\n return toCalendarDate(now(timeZone));\n}\n\nexport function compareDate(a: AnyCalendarDate, b: AnyCalendarDate): number {\n return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);\n}\n\nexport function compareTime(a: AnyTime, b: AnyTime): number {\n return timeToMs(a) - timeToMs(b);\n}\n\nfunction timeToMs(a: AnyTime): number {\n return a.hour * 60 * 60 * 1000 + a.minute * 60 * 1000 + a.second * 1000 + a.millisecond;\n}\n\n/**\n * Returns the number of hours in the given date and time zone.\n * Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.\n */\nexport function getHoursInDay(a: CalendarDate, timeZone: string): number {\n let ms = toAbsolute(a, timeZone);\n let tomorrow = a.add({days: 1});\n let tomorrowMs = toAbsolute(tomorrow, timeZone);\n return (tomorrowMs - ms) / 3600000;\n}\n\nlet localTimeZone: string | null = null;\n\n/** Returns the time zone identifier for the current user. */\nexport function getLocalTimeZone(): string {\n // TODO: invalidate this somehow?\n if (localTimeZone == null) {\n localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return localTimeZone!;\n}\n\n/** Returns the first date of the month for the given date. */\nexport function startOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function startOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function startOfMonth(date: CalendarDate): CalendarDate;\nexport function startOfMonth(date: DateValue): DateValue;\nexport function startOfMonth(date: DateValue): DateValue {\n // Use `subtract` instead of `set` so we don't get constrained in an era.\n return date.subtract({days: date.day - 1});\n}\n\n/** Returns the last date of the month for the given date. */\nexport function endOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function endOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function endOfMonth(date: CalendarDate): CalendarDate;\nexport function endOfMonth(date: DateValue): DateValue;\nexport function endOfMonth(date: DateValue): DateValue {\n return date.add({days: date.calendar.getDaysInMonth(date) - date.day});\n}\n\n/** Returns the first day of the year for the given date. */\nexport function startOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function startOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function startOfYear(date: CalendarDate): CalendarDate;\nexport function startOfYear(date: DateValue): DateValue;\nexport function startOfYear(date: DateValue): DateValue {\n return startOfMonth(date.subtract({months: date.month - 1}));\n}\n\n/** Returns the last day of the year for the given date. */\nexport function endOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function endOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function endOfYear(date: CalendarDate): CalendarDate;\nexport function endOfYear(date: DateValue): DateValue;\nexport function endOfYear(date: DateValue): DateValue {\n return endOfMonth(date.add({months: date.calendar.getMonthsInYear(date) - date.month}));\n}\n\nexport function getMinimumMonthInYear(date: AnyCalendarDate) {\n if (date.calendar.getMinimumMonthInYear) {\n return date.calendar.getMinimumMonthInYear(date);\n }\n\n return 1;\n}\n\nexport function getMinimumDayInMonth(date: AnyCalendarDate) {\n if (date.calendar.getMinimumDayInMonth) {\n return date.calendar.getMinimumDayInMonth(date);\n }\n\n return 1;\n}\n\n/** Returns the first date of the week for the given date and locale. */\nexport function startOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;\nexport function startOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;\nexport function startOfWeek(date: CalendarDate, locale: string): CalendarDate;\nexport function startOfWeek(date: DateValue, locale: string): DateValue;\nexport function startOfWeek(date: DateValue, locale: string): DateValue {\n let dayOfWeek = getDayOfWeek(date, locale);\n return date.subtract({days: dayOfWeek});\n}\n\n/** Returns the last date of the week for the given date and locale. */\nexport function endOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;\nexport function endOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;\nexport function endOfWeek(date: CalendarDate, locale: string): CalendarDate;\nexport function endOfWeek(date: DateValue, locale: string): DateValue {\n return startOfWeek(date, locale).add({days: 6});\n}\n\nconst cachedRegions = new Map<string, string>();\n\nfunction getRegion(locale: string): string | undefined {\n // If the Intl.Locale API is available, use it to get the region for the locale.\n // @ts-ignore\n if (Intl.Locale) {\n // Constructing an Intl.Locale is expensive, so cache the result.\n let region = cachedRegions.get(locale);\n if (!region) {\n // @ts-ignore\n region = new Intl.Locale(locale).maximize().region;\n if (region) {\n cachedRegions.set(locale, region);\n }\n }\n return region;\n }\n\n // If not, just try splitting the string.\n // If the second part of the locale string is 'u',\n // then this is a unicode extension, so ignore it.\n // Otherwise, it should be the region.\n let part = locale.split('-')[1];\n return part === 'u' ? undefined : part;\n}\n\nfunction getWeekStart(locale: string): number {\n // TODO: use Intl.Locale for this once browsers support the weekInfo property\n // https://github.com/tc39/proposal-intl-locale-info\n let region = getRegion(locale);\n return region ? weekStartData[region] || 0 : 0;\n}\n\n/** Returns the number of weeks in the given month and locale. */\nexport function getWeeksInMonth(date: DateValue, locale: string): number {\n let days = date.calendar.getDaysInMonth(date);\n return Math.ceil((getDayOfWeek(startOfMonth(date), locale) + days) / 7);\n}\n\n/** Returns the lesser of the two provider dates. */\nexport function minDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {\n if (a && b) {\n return a.compare(b) <= 0 ? a : b;\n }\n\n return a || b;\n}\n\n/** Returns the greater of the two provider dates. */\nexport function maxDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {\n if (a && b) {\n return a.compare(b) >= 0 ? a : b;\n }\n\n return a || b;\n}\n\nconst WEEKEND_DATA = {\n AF: [4, 5],\n AE: [5, 6],\n BH: [5, 6],\n DZ: [5, 6],\n EG: [5, 6],\n IL: [5, 6],\n IQ: [5, 6],\n IR: [5, 5],\n JO: [5, 6],\n KW: [5, 6],\n LY: [5, 6],\n OM: [5, 6],\n QA: [5, 6],\n SA: [5, 6],\n SD: [5, 6],\n SY: [5, 6],\n YE: [5, 6]\n};\n\n/** Returns whether the given date is on a weekend in the given locale. */\nexport function isWeekend(date: DateValue, locale: string): boolean {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n let region = getRegion(locale);\n // Use Intl.Locale for this once weekInfo is supported.\n // https://github.com/tc39/proposal-intl-locale-info\n let [start, end] = WEEKEND_DATA[region!] || [6, 0];\n return dayOfWeek === start || dayOfWeek === end;\n}\n\n/** Returns whether the given date is on a weekday in the given locale. */\nexport function isWeekday(date: DateValue, locale: string): boolean {\n return !isWeekend(date, locale);\n}\n","/*\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// Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json\n// Locales starting on Sunday have been removed for compression.\nexport const weekStartData = {\n '001': 1,\n AD: 1,\n AE: 6,\n AF: 6,\n AI: 1,\n AL: 1,\n AM: 1,\n AN: 1,\n AR: 1,\n AT: 1,\n AU: 1,\n AX: 1,\n AZ: 1,\n BA: 1,\n BE: 1,\n BG: 1,\n BH: 6,\n BM: 1,\n BN: 1,\n BY: 1,\n CH: 1,\n CL: 1,\n CM: 1,\n CN: 1,\n CR: 1,\n CY: 1,\n CZ: 1,\n DE: 1,\n DJ: 6,\n DK: 1,\n DZ: 6,\n EC: 1,\n EE: 1,\n EG: 6,\n ES: 1,\n FI: 1,\n FJ: 1,\n FO: 1,\n FR: 1,\n GB: 1,\n GE: 1,\n GF: 1,\n GP: 1,\n GR: 1,\n HR: 1,\n HU: 1,\n IE: 1,\n IQ: 6,\n IR: 6,\n IS: 1,\n IT: 1,\n JO: 6,\n KG: 1,\n KW: 6,\n KZ: 1,\n LB: 1,\n LI: 1,\n LK: 1,\n LT: 1,\n LU: 1,\n LV: 1,\n LY: 6,\n MC: 1,\n MD: 1,\n ME: 1,\n MK: 1,\n MN: 1,\n MQ: 1,\n MV: 5,\n MY: 1,\n NL: 1,\n NO: 1,\n NZ: 1,\n OM: 6,\n PL: 1,\n QA: 6,\n RE: 1,\n RO: 1,\n RS: 1,\n RU: 1,\n SD: 6,\n SE: 1,\n SI: 1,\n SK: 1,\n SM: 1,\n SY: 6,\n TJ: 1,\n TM: 1,\n TR: 1,\n UA: 1,\n UY: 1,\n UZ: 1,\n VA: 1,\n VN: 1,\n XK: 1\n};\n","/*\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\nimport {AnyDateTime, DateTimeDuration, Disambiguation} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, possibleAbsolutes, toAbsolute, toCalendar, toCalendarDateTime, toTimeZone} from './conversion';\nimport {getLocalTimeZone} from './queries';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst TIME_RE = /^(\\d{2})(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DATE_TIME_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst ZONED_DATE_TIME_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:([+-]\\d{2})(?::?(\\d{2}))?)?\\[(.*?)\\]$/;\nconst ABSOLUTE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:(?:([+-]\\d{2})(?::?(\\d{2}))?)|Z)$/;\nconst DATE_TIME_DURATION_RE =\n /^((?<negative>-)|\\+)?P((?<years>\\d*)Y)?((?<months>\\d*)M)?((?<weeks>\\d*)W)?((?<days>\\d*)D)?((?<time>T)((?<hours>\\d*[.,]?\\d{1,9})H)?((?<minutes>\\d*[.,]?\\d{1,9})M)?((?<seconds>\\d*[.,]?\\d{1,9})S)?)?$/;\nconst requiredDurationTimeGroups = ['hours', 'minutes', 'seconds'];\nconst requiredDurationGroups = ['years', 'months', 'weeks', 'days', ...requiredDurationTimeGroups];\n\n/** Parses an ISO 8601 time string. */\nexport function parseTime(value: string): Time {\n let m = value.match(TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 time string: ' + value);\n }\n\n return new Time(\n parseNumber(m[1], 0, 23),\n m[2] ? parseNumber(m[2], 0, 59) : 0,\n m[3] ? parseNumber(m[3], 0, 59) : 0,\n m[4] ? parseNumber(m[4], 0, Infinity) * 1000 : 0\n );\n}\n\n/** Parses an ISO 8601 date string, with no time components. */\nexport function parseDate(value: string): CalendarDate {\n let m = value.match(DATE_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date string: ' + value);\n }\n\n let date: Mutable<CalendarDate> = new CalendarDate(\n parseNumber(m[1], 0, 9999),\n parseNumber(m[2], 1, 12),\n 1\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n return date as CalendarDate;\n}\n\n/** Parses an ISO 8601 date and time string, with no time zone. */\nexport function parseDateTime(value: string): CalendarDateTime {\n let m = value.match(DATE_TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<CalendarDateTime> = new CalendarDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n return date as CalendarDateTime;\n}\n\n/**\n * Parses an ISO 8601 date and time string with a time zone extension and optional UTC offset\n * (e.g. \"2021-11-07T00:45[America/Los_Angeles]\" or \"2021-11-07T00:45-07:00[America/Los_Angeles]\").\n * Ambiguous times due to daylight saving time transitions are resolved according to the `disambiguation`\n * parameter.\n */\nexport function parseZonedDateTime(value: string, disambiguation?: Disambiguation): ZonedDateTime {\n let m = value.match(ZONED_DATE_TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n m[10],\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n let plainDateTime = toCalendarDateTime(date as ZonedDateTime);\n\n let ms: number;\n if (m[8]) {\n date.offset = parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000;\n ms = epochFromDate(date as ZonedDateTime) - date.offset;\n\n // Validate offset against parsed date.\n let absolutes = possibleAbsolutes(plainDateTime, date.timeZone);\n if (!absolutes.includes(ms)) {\n throw new Error(`Offset ${offsetToString(date.offset)} is invalid for ${dateTimeToString(date)} in ${date.timeZone}`);\n }\n } else {\n // Convert to absolute and back to fix invalid times due to DST.\n ms = toAbsolute(toCalendarDateTime(plainDateTime), date.timeZone, disambiguation);\n }\n\n return fromAbsolute(ms, date.timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the provided time zone.\n */\nexport function parseAbsolute(value: string, timeZone: string): ZonedDateTime {\n let m = value.match(ABSOLUTE_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n timeZone,\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n if (m[8]) {\n date.offset = parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000;\n }\n\n return toTimeZone(date as ZonedDateTime, timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the user's local time zone.\n */\nexport function parseAbsoluteToLocal(value: string): ZonedDateTime {\n return parseAbsolute(value, getLocalTimeZone());\n}\n\nfunction parseNumber(value: string, min: number, max: number) {\n let val = Number(value);\n if (val < min || val > max) {\n throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);\n }\n\n return val;\n}\n\nexport function timeToString(time: Time): string {\n return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;\n}\n\nexport function dateToString(date: CalendarDate): string {\n let gregorianDate = toCalendar(date, new GregorianCalendar());\n return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;\n}\n\nexport function dateTimeToString(date: AnyDateTime): string {\n // @ts-ignore\n return `${dateToString(date)}T${timeToString(date)}`;\n}\n\nfunction offsetToString(offset: number) {\n let sign = Math.sign(offset) < 0 ? '-' : '+';\n offset = Math.abs(offset);\n let offsetHours = Math.floor(offset / (60 * 60 * 1000));\n let offsetMinutes = (offset % (60 * 60 * 1000)) / (60 * 1000);\n return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;\n}\n\nexport function zonedDateTimeToString(date: ZonedDateTime): string {\n return `${dateTimeToString(date)}${offsetToString(date.offset)}[${date.timeZone}]`;\n}\n\n/**\n * Parses an ISO 8601 duration string (e.g. \"P3Y6M6W4DT12H30M5S\").\n * @param value An ISO 8601 duration string.\n * @returns A DateTimeDuration object.\n */\nexport function parseDuration(value: string): Required<DateTimeDuration> {\n const match = value.match(DATE_TIME_DURATION_RE);\n\n if (!match) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const parseDurationGroup = (\n group: string | undefined,\n isNegative: boolean,\n min: number,\n max: number\n ): number => {\n if (!group) {\n return 0;\n }\n try {\n const sign = isNegative ? -1 : 1;\n return sign * parseNumber(group.replace(',', '.'), min, max);\n } catch {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n };\n\n const isNegative = !!match.groups?.negative;\n\n const hasRequiredGroups = requiredDurationGroups.some(group => match.groups?.[group]);\n\n if (!hasRequiredGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const durationStringIncludesTime = match.groups?.time;\n\n if (durationStringIncludesTime) {\n const hasRequiredDurationTimeGroups = requiredDurationTimeGroups.some(group => match.groups?.[group]);\n if (!hasRequiredDurationTimeGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n }\n\n const duration: Mutable<DateTimeDuration> = {\n years: parseDurationGroup(match.groups?.years, isNegative, 0, 9999),\n months: parseDurationGroup(match.groups?.months, isNegative, 0, 12),\n weeks: parseDurationGroup(match.groups?.weeks, isNegative, 0, Infinity),\n days: parseDurationGroup(match.groups?.days, isNegative, 0, 31),\n hours: parseDurationGroup(match.groups?.hours, isNegative, 0, 23),\n minutes: parseDurationGroup(match.groups?.minutes, isNegative, 0, 59),\n seconds: parseDurationGroup(match.groups?.seconds, isNegative, 0, 59)\n };\n\n if (duration.hours !== undefined && ((duration.hours % 1) !== 0) && (duration.minutes || duration.seconds)) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n if (duration.minutes !== undefined && ((duration.minutes % 1) !== 0) && duration.seconds) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n return duration as Required<DateTimeDuration>;\n}\n","/*\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","/*\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","/*\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","/*\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 {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948321; // 622/03/19 Julian C.E.\n\nfunction isLeapYear(year: number): boolean {\n let y0 = year > 0 ? year - 474 : year - 473;\n let y1 = mod(y0, 2820) + 474;\n\n return mod((y1 + 38) * 31, 128) < 31;\n}\n\nfunction persianToJulianDay(year: number, month: number, day: number): number {\n let y0 = year > 0 ? year - 474 : year - 473;\n let y1 = mod(y0, 2820) + 474;\n let offset = month <= 7 ? 31 * (month - 1) : 30 * (month - 1) + 6;\n\n return (\n PERSIAN_EPOCH -\n 1 +\n 1029983 * Math.floor(y0 / 2820) +\n 365 * (y1 - 1) +\n Math.floor((31 * y1 - 5) / 128) +\n offset +\n day\n );\n}\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let d0 = jd - persianToJulianDay(475, 1, 1);\n let n2820 = Math.floor(d0 / 1029983);\n let d1 = mod(d0, 1029983);\n let y2820 = d1 === 1029982 ? 2820 : Math.floor((128 * d1 + 46878) / 46751);\n let year = 474 + 2820 * n2820 + y2820;\n if (year <= 0) {\n year--;\n }\n\n let yDay = jd - persianToJulianDay(year, 1, 1) + 1;\n let month = yDay <= 186 ? Math.ceil(yDay / 31) : Math.ceil((yDay - 6) / 31);\n let day = jd - persianToJulianDay(year, month, 1) + 1;\n\n return new CalendarDate(this, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return persianToJulianDay(date.year, date.month, date.day);\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n return isLeapYear(date.year) ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n","/*\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","/*\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","/*\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 {mod, Mutable} from '../utils';\n\nconst HEBREW_EPOCH = 347997;\n\n// Hebrew date calculations are performed in terms of days, hours, and\n// \"parts\" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.\nconst HOUR_PARTS = 1080;\nconst DAY_PARTS = 24 * HOUR_PARTS;\n\n// An approximate value for the length of a lunar month.\n// It is used to calculate the approximate year and month of a given\n// absolute date.\nconst MONTH_DAYS = 29;\nconst MONTH_FRACT = 12 * HOUR_PARTS + 793;\nconst MONTH_PARTS = MONTH_DAYS * DAY_PARTS + MONTH_FRACT;\n\nfunction isLeapYear(year: number) {\n return mod(year * 7 + 1, 19) < 7;\n}\n\n// Test for delay of start of new year and to avoid\n// Sunday, Wednesday, and Friday as start of the new year.\nfunction hebrewDelay1(year: number) {\n let months = Math.floor((235 * year - 234) / 19);\n let parts = 12084 + 13753 * months;\n let day = months * 29 + Math.floor(parts / 25920);\n\n if (mod(3 * (day + 1), 7) < 3) {\n day += 1;\n }\n\n return day;\n}\n\n// Check for delay in start of new year due to length of adjacent years\nfunction hebrewDelay2(year: number) {\n let last = hebrewDelay1(year - 1);\n let present = hebrewDelay1(year);\n let next = hebrewDelay1(year + 1);\n\n if (next - present === 356) {\n return 2;\n }\n\n if (present - last === 382) {\n return 1;\n }\n\n return 0;\n}\n\nfunction startOfYear(year: number) {\n return hebrewDelay1(year) + hebrewDelay2(year);\n}\n\nfunction getDaysInYear(year: number) {\n return startOfYear(year + 1) - startOfYear(year);\n}\n\nfunction getYearType(year: number) {\n let yearLength = getDaysInYear(year);\n\n if (yearLength > 380) {\n yearLength -= 30; // Subtract length of leap month.\n }\n\n switch (yearLength) {\n case 353:\n return 0; // deficient\n case 354:\n return 1; // normal\n case 355:\n return 2; // complete\n }\n}\n\nfunction getDaysInMonth(year: number, month: number): number {\n // Normalize month numbers from 1 - 13, even on non-leap years\n if (month >= 6 && !isLeapYear(year)) {\n month++;\n }\n\n // First of all, dispose of fixed-length 29 day months\n if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) {\n return 29;\n }\n\n let yearType = getYearType(year);\n\n // If it's Heshvan, days depend on length of year\n if (month === 2) {\n return yearType === 2 ? 30 : 29;\n }\n\n // Similarly, Kislev varies with the length of year\n if (month === 3) {\n return yearType === 0 ? 29 : 30;\n }\n\n // Adar I only exists in leap years\n if (month === 6) {\n return isLeapYear(year) ? 30 : 0;\n }\n\n return 30;\n}\n\n/**\n * The Hebrew calendar is used in Israel and around the world by the Jewish faith.\n * Years include either 12 or 13 months depending on whether it is a leap year.\n * In leap years, an extra month is inserted at month 6.\n */\nexport class HebrewCalendar implements Calendar {\n identifier = 'hebrew';\n\n fromJulianDay(jd: number): CalendarDate {\n let d = jd - HEBREW_EPOCH;\n let m = (d * DAY_PARTS) / MONTH_PARTS; // Months (approx)\n let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)\n let ys = startOfYear(year); // 1st day of year\n let dayOfYear = Math.floor(d - ys);\n\n // Because of the postponement rules, it's possible to guess wrong. Fix it.\n while (dayOfYear < 1) {\n year--;\n ys = startOfYear(year);\n dayOfYear = Math.floor(d - ys);\n }\n\n // Now figure out which month we're in, and the date within that month\n let month = 1;\n let monthStart = 0;\n while (monthStart < dayOfYear) {\n monthStart += getDaysInMonth(year, month);\n month++;\n }\n\n month--;\n monthStart -= getDaysInMonth(year, month);\n\n let day = dayOfYear - monthStart;\n return new CalendarDate(this, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let jd = startOfYear(date.year);\n for (let month = 1; month < date.month; month++) {\n jd += getDaysInMonth(date.year, month);\n }\n\n return jd + date.day + HEBREW_EPOCH;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 13 : 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return getDaysInYear(date.year);\n }\n\n getYearsInEra(): number {\n // 6239 gregorian\n return 9999;\n }\n\n getEras() {\n return ['AM'];\n }\n\n balanceYearMonth(date: Mutable<AnyCalendarDate>, previousDate: AnyCalendarDate) {\n // Keep date in the same month when switching between leap years and non leap years\n if (previousDate.year !== date.year) {\n if (isLeapYear(previousDate.year) && !isLeapYear(date.year) && previousDate.month > 6) {\n date.month--;\n } else if (!isLeapYear(previousDate.year) && isLeapYear(date.year) && previousDate.month > 6) {\n date.month++;\n }\n }\n }\n}\n","/*\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","/*\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\nimport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nimport {Calendar} from './types';\nimport {CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar} from './calendars/EthiopicCalendar';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {HebrewCalendar} from './calendars/HebrewCalendar';\nimport {IndianCalendar} from './calendars/IndianCalendar';\nimport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nimport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nimport {PersianCalendar} from './calendars/PersianCalendar';\nimport {TaiwanCalendar} from './calendars/TaiwanCalendar';\n\n/** Creates a `Calendar` instance from a Unicode calendar identifier string. */\nexport function createCalendar(name: string): Calendar {\n switch (name) {\n case 'buddhist':\n return new BuddhistCalendar();\n case 'ethiopic':\n return new EthiopicCalendar();\n case 'ethioaa':\n return new EthiopicAmeteAlemCalendar();\n case 'coptic':\n return new CopticCalendar();\n case 'hebrew':\n return new HebrewCalendar();\n case 'indian':\n return new IndianCalendar();\n case 'islamic-civil':\n return new IslamicCivilCalendar();\n case 'islamic-tbla':\n return new IslamicTabularCalendar();\n case 'islamic-umalqura':\n return new IslamicUmalquraCalendar();\n case 'japanese':\n return new JapaneseCalendar();\n case 'persian':\n return new PersianCalendar();\n case 'roc':\n return new TaiwanCalendar();\n case 'gregory':\n default:\n return new GregorianCalendar();\n }\n}\n","/*\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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {\n hourCycle?: Intl.DateTimeFormatOptions['hourCycle']\n}\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;ACbhG;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;ACbhG;;;;;;;;;;CAUC;AAQM,SAAS,0CAAI,MAAc,EAAE,SAAiB;IACnD,OAAO,SAAS,YAAY,KAAK,KAAK,CAAC,SAAS;AAClD;AAEO,SAAS,0CAAK,IAAkB;IACrC,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;SAEhF,OAAO,IAAI,CAAA,GAAA,yCAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG;AAE1E;AAEO,SAAS,0CAAa,IAAsB;IACjD,IAAI,KAAK,GAAG,EACV,OAAO,IAAI,CAAA,GAAA,yCAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,KAAK,MAAM,E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ACxB,OAAO;IAGT,IAAI,QAAQ,KAAK,QAAQ,IACvB,OAAO;IAGT,IAAI,QAAQ,MAAM,QAAQ,IACxB,OAAO;IAGT,MAAM,IAAI,MAAM;AAClB;;","sources":["packages/@internationalized/date/src/index.ts","packages/@internationalized/date/src/CalendarDate.ts","packages/@internationalized/date/src/manipulation.ts","packages/@internationalized/date/src/conversion.ts","packages/@internationalized/date/src/calendars/GregorianCalendar.ts","packages/@internationalized/date/src/utils.ts","packages/@internationalized/date/src/queries.ts","packages/@internationalized/date/src/weekStartData.ts","packages/@internationalized/date/src/string.ts","packages/@internationalized/date/src/calendars/JapaneseCalendar.ts","packages/@internationalized/date/src/calendars/BuddhistCalendar.ts","packages/@internationalized/date/src/calendars/TaiwanCalendar.ts","packages/@internationalized/date/src/calendars/PersianCalendar.ts","packages/@internationalized/date/src/calendars/IndianCalendar.ts","packages/@internationalized/date/src/calendars/IslamicCalendar.ts","packages/@internationalized/date/src/calendars/HebrewCalendar.ts","packages/@internationalized/date/src/calendars/EthiopicCalendar.ts","packages/@internationalized/date/src/createCalendar.ts","packages/@internationalized/date/src/DateFormatter.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\nexport type {\n AnyCalendarDate,\n AnyTime,\n AnyDateTime,\n Calendar,\n DateDuration,\n TimeDuration,\n DateTimeDuration,\n DateFields,\n TimeFields,\n DateField,\n TimeField,\n Disambiguation,\n CycleOptions,\n CycleTimeOptions\n} from './types';\n\nexport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nexport {GregorianCalendar} from './calendars/GregorianCalendar';\nexport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nexport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nexport {TaiwanCalendar} from './calendars/TaiwanCalendar';\nexport {PersianCalendar} from './calendars/PersianCalendar';\nexport {IndianCalendar} from './calendars/IndianCalendar';\nexport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nexport {HebrewCalendar} from './calendars/HebrewCalendar';\nexport {EthiopicCalendar, EthiopicAmeteAlemCalendar, CopticCalendar} from './calendars/EthiopicCalendar';\nexport {createCalendar} from './createCalendar';\nexport {\n toCalendarDate,\n toCalendarDateTime,\n toTime,\n toCalendar,\n toZoned,\n toTimeZone,\n toLocalTimeZone,\n fromDate,\n fromAbsolute\n} from './conversion';\nexport {\n isSameDay,\n isSameMonth,\n isSameYear,\n isEqualDay,\n isEqualMonth,\n isEqualYear,\n isToday,\n getDayOfWeek,\n now,\n today,\n getHoursInDay,\n getLocalTimeZone,\n startOfMonth,\n startOfWeek,\n startOfYear,\n endOfMonth,\n endOfWeek,\n endOfYear,\n getMinimumMonthInYear,\n getMinimumDayInMonth,\n getWeeksInMonth,\n minDate,\n maxDate,\n isWeekend,\n isWeekday\n} from './queries';\nexport {\n parseDate,\n parseDateTime,\n parseTime,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseZonedDateTime,\n parseDuration\n} from './string';\nexport {DateFormatter} from './DateFormatter';\n","/*\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\nimport {add, addTime, addZoned, constrain, constrainTime, cycleDate, cycleTime, cycleZoned, set, setTime, setZoned, subtract, subtractTime, subtractZoned} from './manipulation';\nimport {AnyCalendarDate, AnyTime, Calendar, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {compareDate, compareTime} from './queries';\nimport {dateTimeToString, dateToString, timeToString, zonedDateTimeToString} from './string';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {toCalendarDateTime, toDate, toZoned, zonedToDate} from './conversion';\n\nfunction shiftArgs(args: any[]) {\n let calendar: Calendar = typeof args[0] === 'object'\n ? args.shift()\n : new GregorianCalendar();\n\n let era: string;\n if (typeof args[0] === 'string') {\n era = args.shift();\n } else {\n let eras = calendar.getEras();\n era = eras[eras.length - 1];\n }\n\n let year = args.shift();\n let month = args.shift();\n let day = args.shift();\n\n return [calendar, era, year, month, day];\n}\n\n/** A CalendarDate represents a date without any time components in a specific calendar system. */\nexport class CalendarDate {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.\n // If that behavior is desired, use the AnyCalendarDate interface instead.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n\n constructor(year: number, month: number, day: number);\n constructor(era: string, year: number, month: number, day: number);\n constructor(calendar: Calendar, year: number, month: number, day: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDate {\n if (this.era) {\n return new CalendarDate(this.calendar, this.era, this.year, this.month, this.day);\n } else {\n return new CalendarDate(this.calendar, this.year, this.month, this.day);\n }\n }\n\n /** Returns a new `CalendarDate` with the given duration added to it. */\n add(duration: DateDuration): CalendarDate {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given duration subtracted from it. */\n subtract(duration: DateDuration): CalendarDate {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields): CalendarDate {\n return set(this, fields);\n }\n\n /**\n * Returns a new `CalendarDate` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField, amount: number, options?: CycleOptions): CalendarDate {\n return cycleDate(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */\n toDate(timeZone: string): Date {\n return toDate(this, timeZone);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: AnyCalendarDate): number {\n return compareDate(this, b);\n }\n}\n\n/** A Time represents a clock time without any date components. */\nexport class Time {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The hour, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(\n hour: number = 0,\n minute: number = 0,\n second: number = 0,\n millisecond: number = 0\n ) {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond;\n constrainTime(this);\n }\n\n /** Returns a copy of this time. */\n copy(): Time {\n return new Time(this.hour, this.minute, this.second, this.millisecond);\n }\n\n /** Returns a new `Time` with the given duration added to it. */\n add(duration: TimeDuration) {\n return addTime(this, duration);\n }\n\n /** Returns a new `Time` with the given duration subtracted from it. */\n subtract(duration: TimeDuration) {\n return subtractTime(this, duration);\n }\n\n /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: TimeFields) {\n return setTime(this, fields);\n }\n\n /**\n * Returns a new `Time` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: TimeField, amount: number, options?: CycleTimeOptions) {\n return cycleTime(this, field, amount, options);\n }\n\n /** Converts the time to an ISO 8601 formatted string. */\n toString() {\n return timeToString(this);\n }\n\n /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */\n compare(b: AnyTime) {\n return compareTime(this, b);\n }\n}\n\n/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */\nexport class CalendarDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n\n constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): CalendarDateTime {\n if (this.era) {\n return new CalendarDateTime(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new CalendarDateTime(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `CalendarDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): CalendarDateTime {\n return add(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): CalendarDateTime {\n return subtract(this, duration);\n }\n\n /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields): CalendarDateTime {\n return set(setTime(this, fields), fields);\n }\n\n /**\n * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime {\n switch (field) {\n case 'era':\n case 'year':\n case 'month':\n case 'day':\n return cycleDate(this, field, amount, options);\n default:\n return cycleTime(this, field, amount, options);\n }\n }\n\n /** Converts the date to a native JavaScript Date object in the given time zone. */\n toDate(timeZone: string, disambiguation?: Disambiguation): Date {\n return toDate(this, timeZone, disambiguation);\n }\n\n /** Converts the date to an ISO 8601 formatted string. */\n toString(): string {\n return dateTimeToString(this);\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n let res = compareDate(this, b);\n if (res === 0) {\n return compareTime(this, toCalendarDateTime(b));\n }\n\n return res;\n }\n}\n\n/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */\nexport class ZonedDateTime {\n // This prevents TypeScript from allowing other types with the same fields to match.\n // @ts-ignore\n #type;\n /** The calendar system associated with this date, e.g. Gregorian. */\n public readonly calendar: Calendar;\n /** The calendar era for this date, e.g. \"BC\" or \"AD\". */\n public readonly era: string;\n /** The year of this date within the era. */\n public readonly year: number;\n /**\n * The month number within the year. Note that some calendar systems such as Hebrew\n * may have a variable number of months per year. Therefore, month numbers may not\n * always correspond to the same month names in different years.\n */\n public readonly month: number;\n /** The day number within the month. */\n public readonly day: number;\n /** The hour in the day, numbered from 0 to 23. */\n public readonly hour: number;\n /** The minute in the hour. */\n public readonly minute: number;\n /** The second in the minute. */\n public readonly second: number;\n /** The millisecond in the second. */\n public readonly millisecond: number;\n /** The IANA time zone identifier that this date and time is represented in. */\n public readonly timeZone: string;\n /** The UTC offset for this time, in milliseconds. */\n public readonly offset: number;\n\n constructor(year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(calendar: Calendar, era: string, year: number, month: number, day: number, timeZone: string, offset: number, hour?: number, minute?: number, second?: number, millisecond?: number);\n constructor(...args: any[]) {\n let [calendar, era, year, month, day] = shiftArgs(args);\n let timeZone = args.shift();\n let offset = args.shift();\n this.calendar = calendar;\n this.era = era;\n this.year = year;\n this.month = month;\n this.day = day;\n this.timeZone = timeZone;\n this.offset = offset;\n this.hour = args.shift() || 0;\n this.minute = args.shift() || 0;\n this.second = args.shift() || 0;\n this.millisecond = args.shift() || 0;\n\n constrain(this);\n }\n\n /** Returns a copy of this date. */\n copy(): ZonedDateTime {\n if (this.era) {\n return new ZonedDateTime(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n } else {\n return new ZonedDateTime(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);\n }\n }\n\n /** Returns a new `ZonedDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration) {\n return addZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration) {\n return subtractZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */\n set(fields: DateFields & TimeFields, disambiguation?: Disambiguation) {\n return setZoned(this, fields, disambiguation);\n }\n\n /**\n * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.\n * When the resulting value reaches the limits of the field, it wraps around.\n */\n cycle(field: DateField | TimeField, amount: number, options?: CycleTimeOptions) {\n return cycleZoned(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object. */\n toDate() {\n return zonedToDate(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */\n toString() {\n return zonedDateTimeToString(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string in UTC. */\n toAbsoluteString() {\n return this.toDate().toISOString();\n }\n\n /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime) {\n // TODO: Is this a bad idea??\n return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();\n }\n}\n","/*\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\nimport {AnyCalendarDate, AnyDateTime, AnyTime, CycleOptions, CycleTimeOptions, DateDuration, DateField, DateFields, DateTimeDuration, Disambiguation, TimeDuration, TimeField, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, toAbsolute, toCalendar, toCalendarDateTime} from './conversion';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst ONE_HOUR = 3600000;\n\nexport function add(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function add(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime;\nexport function add(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration) {\n let mutableDate: Mutable<AnyCalendarDate | AnyDateTime> = date.copy();\n let days = 'hour' in mutableDate ? addTimeFields(mutableDate, duration) : 0;\n\n addYears(mutableDate, duration.years || 0);\n if (mutableDate.calendar.balanceYearMonth) {\n mutableDate.calendar.balanceYearMonth(mutableDate, date);\n }\n\n mutableDate.month += duration.months || 0;\n\n balanceYearMonth(mutableDate);\n constrainMonthDay(mutableDate);\n\n mutableDate.day += (duration.weeks || 0) * 7;\n mutableDate.day += duration.days || 0;\n mutableDate.day += days;\n\n balanceDay(mutableDate);\n\n if (mutableDate.calendar.balanceDate) {\n mutableDate.calendar.balanceDate(mutableDate);\n }\n\n // Constrain in case adding ended up with a date outside the valid range for the calendar system.\n // The behavior here is slightly different than when constraining in the `set` function in that\n // we adjust smaller fields to their minimum/maximum values rather than constraining each field\n // individually. This matches the general behavior of `add` vs `set` regarding how fields are balanced.\n if (mutableDate.year < 1) {\n mutableDate.year = 1;\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);\n if (mutableDate.year > maxYear) {\n let isInverseEra = mutableDate.calendar.isInverseEra?.(mutableDate);\n mutableDate.year = maxYear;\n mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);\n mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n if (mutableDate.month < 1) {\n mutableDate.month = 1;\n mutableDate.day = 1;\n }\n\n let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);\n if (mutableDate.month > maxMonth) {\n mutableDate.month = maxMonth;\n mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);\n }\n\n mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));\n return mutableDate;\n}\n\nfunction addYears(date: Mutable<AnyCalendarDate>, years: number) {\n if (date.calendar.isInverseEra?.(date)) {\n years = -years;\n }\n\n date.year += years;\n}\n\nfunction balanceYearMonth(date: Mutable<AnyCalendarDate>) {\n while (date.month < 1) {\n addYears(date, -1);\n date.month += date.calendar.getMonthsInYear(date);\n }\n\n let monthsInYear = 0;\n while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {\n date.month -= monthsInYear;\n addYears(date, 1);\n }\n}\n\nfunction balanceDay(date: Mutable<AnyCalendarDate>) {\n while (date.day < 1) {\n date.month--;\n balanceYearMonth(date);\n date.day += date.calendar.getDaysInMonth(date);\n }\n\n while (date.day > date.calendar.getDaysInMonth(date)) {\n date.day -= date.calendar.getDaysInMonth(date);\n date.month++;\n balanceYearMonth(date);\n }\n}\n\nfunction constrainMonthDay(date: Mutable<AnyCalendarDate>) {\n date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));\n date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));\n}\n\nexport function constrain(date: Mutable<AnyCalendarDate>) {\n if (date.calendar.constrainDate) {\n date.calendar.constrainDate(date);\n }\n\n date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));\n constrainMonthDay(date);\n}\n\nexport function invertDuration(duration: DateTimeDuration): DateTimeDuration {\n let inverseDuration = {};\n for (let key in duration) {\n if (typeof duration[key] === 'number') {\n inverseDuration[key] = -duration[key];\n }\n }\n\n return inverseDuration;\n}\n\nexport function subtract(date: CalendarDateTime, duration: DateTimeDuration): CalendarDateTime;\nexport function subtract(date: CalendarDate, duration: DateDuration): CalendarDate;\nexport function subtract(date: CalendarDate | CalendarDateTime, duration: DateTimeDuration): CalendarDate | CalendarDateTime {\n return add(date, invertDuration(duration));\n}\n\nexport function set(date: CalendarDateTime, fields: DateFields): CalendarDateTime;\nexport function set(date: CalendarDate, fields: DateFields): CalendarDate;\nexport function set(date: CalendarDate | CalendarDateTime, fields: DateFields) {\n let mutableDate: Mutable<AnyCalendarDate> = date.copy();\n\n if (fields.era != null) {\n mutableDate.era = fields.era;\n }\n\n if (fields.year != null) {\n mutableDate.year = fields.year;\n }\n\n if (fields.month != null) {\n mutableDate.month = fields.month;\n }\n\n if (fields.day != null) {\n mutableDate.day = fields.day;\n }\n\n constrain(mutableDate);\n return mutableDate;\n}\n\nexport function setTime(value: CalendarDateTime, fields: TimeFields): CalendarDateTime;\nexport function setTime(value: Time, fields: TimeFields): Time;\nexport function setTime(value: Time | CalendarDateTime, fields: TimeFields) {\n let mutableValue: Mutable<Time | CalendarDateTime> = value.copy();\n\n if (fields.hour != null) {\n mutableValue.hour = fields.hour;\n }\n\n if (fields.minute != null) {\n mutableValue.minute = fields.minute;\n }\n\n if (fields.second != null) {\n mutableValue.second = fields.second;\n }\n\n if (fields.millisecond != null) {\n mutableValue.millisecond = fields.millisecond;\n }\n\n constrainTime(mutableValue);\n return mutableValue;\n}\n\nfunction balanceTime(time: Mutable<AnyTime>): number {\n time.second += Math.floor(time.millisecond / 1000);\n time.millisecond = nonNegativeMod(time.millisecond, 1000);\n\n time.minute += Math.floor(time.second / 60);\n time.second = nonNegativeMod(time.second, 60);\n\n time.hour += Math.floor(time.minute / 60);\n time.minute = nonNegativeMod(time.minute, 60);\n\n let days = Math.floor(time.hour / 24);\n time.hour = nonNegativeMod(time.hour, 24);\n\n return days;\n}\n\nexport function constrainTime(time: Mutable<AnyTime>) {\n time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));\n time.second = Math.max(0, Math.min(time.second, 59));\n time.minute = Math.max(0, Math.min(time.minute, 59));\n time.hour = Math.max(0, Math.min(time.hour, 23));\n}\n\nfunction nonNegativeMod(a: number, b: number) {\n let result = a % b;\n if (result < 0) {\n result += b;\n }\n return result;\n}\n\nfunction addTimeFields(time: Mutable<AnyTime>, duration: TimeDuration): number {\n time.hour += duration.hours || 0;\n time.minute += duration.minutes || 0;\n time.second += duration.seconds || 0;\n time.millisecond += duration.milliseconds || 0;\n return balanceTime(time);\n}\n\nexport function addTime(time: Time, duration: TimeDuration): Time {\n let res = time.copy();\n addTimeFields(res, duration);\n return res;\n}\n\nexport function subtractTime(time: Time, duration: TimeDuration): Time {\n return addTime(time, invertDuration(duration));\n}\n\nexport function cycleDate(value: CalendarDateTime, field: DateField, amount: number, options?: CycleOptions): CalendarDateTime;\nexport function cycleDate(value: CalendarDate, field: DateField, amount: number, options?: CycleOptions): CalendarDate;\nexport function cycleDate(value: CalendarDate | CalendarDateTime, field: DateField, amount: number, options?: CycleOptions) {\n let mutable: Mutable<CalendarDate | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'era': {\n let eras = value.calendar.getEras();\n let eraIndex = eras.indexOf(value.era);\n if (eraIndex < 0) {\n throw new Error('Invalid era: ' + value.era);\n }\n eraIndex = cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round);\n mutable.era = eras[eraIndex];\n\n // Constrain the year and other fields within the era, so the era doesn't change when we balance below.\n constrain(mutable);\n break;\n }\n case 'year': {\n if (mutable.calendar.isInverseEra?.(mutable)) {\n amount = -amount;\n }\n\n // The year field should not cycle within the era as that can cause weird behavior affecting other fields.\n // We need to also allow values < 1 so that decrementing goes to the previous era. If we get -Infinity back\n // we know we wrapped around after reaching 9999 (the maximum), so set the year back to 1.\n mutable.year = cycleValue(value.year, amount, -Infinity, 9999, options?.round);\n if (mutable.year === -Infinity) {\n mutable.year = 1;\n }\n\n if (mutable.calendar.balanceYearMonth) {\n mutable.calendar.balanceYearMonth(mutable, value);\n }\n break;\n }\n case 'month':\n mutable.month = cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round);\n break;\n case 'day':\n mutable.day = cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n if (value.calendar.balanceDate) {\n value.calendar.balanceDate(mutable);\n }\n\n constrain(mutable);\n return mutable;\n}\n\nexport function cycleTime(value: CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions): CalendarDateTime;\nexport function cycleTime(value: Time, field: TimeField, amount: number, options?: CycleTimeOptions): Time;\nexport function cycleTime(value: Time | CalendarDateTime, field: TimeField, amount: number, options?: CycleTimeOptions) {\n let mutable: Mutable<Time | CalendarDateTime> = value.copy();\n\n switch (field) {\n case 'hour': {\n let hours = value.hour;\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = hours >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n mutable.hour = cycleValue(hours, amount, min, max, options?.round);\n break;\n }\n case 'minute':\n mutable.minute = cycleValue(value.minute, amount, 0, 59, options?.round);\n break;\n case 'second':\n mutable.second = cycleValue(value.second, amount, 0, 59, options?.round);\n break;\n case 'millisecond':\n mutable.millisecond = cycleValue(value.millisecond, amount, 0, 999, options?.round);\n break;\n default:\n throw new Error('Unsupported field ' + field);\n }\n\n return mutable;\n}\n\nfunction cycleValue(value: number, amount: number, min: number, max: number, round = false) {\n if (round) {\n value += Math.sign(amount);\n\n if (value < min) {\n value = max;\n }\n\n let div = Math.abs(amount);\n if (amount > 0) {\n value = Math.ceil(value / div) * div;\n } else {\n value = Math.floor(value / div) * div;\n }\n\n if (value > max) {\n value = min;\n }\n } else {\n value += amount;\n if (value < min) {\n value = max - (min - value - 1);\n } else if (value > max) {\n value = min + (value - max - 1);\n }\n }\n\n return value;\n}\n\nexport function addZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n let ms: number;\n if ((duration.years != null && duration.years !== 0) || (duration.months != null && duration.months !== 0) || (duration.weeks != null && duration.weeks !== 0) || (duration.days != null && duration.days !== 0)) {\n let res = add(toCalendarDateTime(dateTime), {\n years: duration.years,\n months: duration.months,\n weeks: duration.weeks,\n days: duration.days\n });\n\n // Changing the date may change the timezone offset, so we need to recompute\n // using the 'compatible' disambiguation.\n ms = toAbsolute(res, dateTime.timeZone);\n } else {\n // Otherwise, preserve the offset of the original date.\n ms = epochFromDate(dateTime) - dateTime.offset;\n }\n\n // Perform time manipulation in milliseconds rather than on the original time fields to account for DST.\n // For example, adding one hour during a DST transition may result in the hour field staying the same or\n // skipping an hour. This results in the offset field changing value instead of the specified field.\n ms += duration.milliseconds || 0;\n ms += (duration.seconds || 0) * 1000;\n ms += (duration.minutes || 0) * 60 * 1000;\n ms += (duration.hours || 0) * 60 * 60 * 1000;\n\n let res = fromAbsolute(ms, dateTime.timeZone);\n return toCalendar(res, dateTime.calendar);\n}\n\nexport function subtractZoned(dateTime: ZonedDateTime, duration: DateTimeDuration): ZonedDateTime {\n return addZoned(dateTime, invertDuration(duration));\n}\n\nexport function cycleZoned(dateTime: ZonedDateTime, field: DateField | TimeField, amount: number, options?: CycleTimeOptions): ZonedDateTime {\n // For date fields, we want the time to remain consistent and the UTC offset to potentially change to account for DST changes.\n // For time fields, we want the time to change by the amount given. This may result in the hour field staying the same, but the UTC\n // offset changing in the case of a backward DST transition, or skipping an hour in the case of a forward DST transition.\n switch (field) {\n case 'hour': {\n let min = 0;\n let max = 23;\n if (options?.hourCycle === 12) {\n let isPM = dateTime.hour >= 12;\n min = isPM ? 12 : 0;\n max = isPM ? 23 : 11;\n }\n\n // The minimum and maximum hour may be affected by daylight saving time.\n // For example, it might jump forward at midnight, and skip 1am.\n // Or it might end at midnight and repeat the 11pm hour. To handle this, we get\n // the possible absolute times for the min and max, and find the maximum range\n // that is within the current day.\n let plainDateTime = toCalendarDateTime(dateTime);\n let minDate = toCalendar(setTime(plainDateTime, {hour: min}), new GregorianCalendar());\n let minAbsolute = [toAbsolute(minDate, dateTime.timeZone, 'earlier'), toAbsolute(minDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === minDate.day)[0];\n\n let maxDate = toCalendar(setTime(plainDateTime, {hour: max}), new GregorianCalendar());\n let maxAbsolute = [toAbsolute(maxDate, dateTime.timeZone, 'earlier'), toAbsolute(maxDate, dateTime.timeZone, 'later')]\n .filter(ms => fromAbsolute(ms, dateTime.timeZone).day === maxDate.day).pop()!;\n\n // Since hours may repeat, we need to operate on the absolute time in milliseconds.\n // This is done in hours from the Unix epoch so that cycleValue works correctly,\n // and then converted back to milliseconds.\n let ms = epochFromDate(dateTime) - dateTime.offset;\n let hours = Math.floor(ms / ONE_HOUR);\n let remainder = ms % ONE_HOUR;\n ms = cycleValue(\n hours,\n amount,\n Math.floor(minAbsolute / ONE_HOUR),\n Math.floor(maxAbsolute / ONE_HOUR),\n options?.round\n ) * ONE_HOUR + remainder;\n\n // Now compute the new timezone offset, and convert the absolute time back to local time.\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n case 'minute':\n case 'second':\n case 'millisecond':\n // @ts-ignore\n return cycleTime(dateTime, field, amount, options);\n case 'era':\n case 'year':\n case 'month':\n case 'day': {\n let res = cycleDate(toCalendarDateTime(dateTime), field, amount, options);\n let ms = toAbsolute(res, dateTime.timeZone);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n }\n default:\n throw new Error('Unsupported field ' + field);\n }\n}\n\nexport function setZoned(dateTime: ZonedDateTime, fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\n // Set the date/time fields, and recompute the UTC offset to account for DST changes.\n // We also need to validate by converting back to a local time in case hours are skipped during forward DST transitions.\n let plainDateTime = toCalendarDateTime(dateTime);\n let res = setTime(set(plainDateTime, fields), fields);\n\n // If the resulting plain date time values are equal, return the original time.\n // We don't want to change the offset when setting the time to the same value.\n if (res.compare(plainDateTime) === 0) {\n return dateTime;\n }\n\n let ms = toAbsolute(res, dateTime.timeZone, disambiguation);\n return toCalendar(fromAbsolute(ms, dateTime.timeZone), dateTime.calendar);\n}\n","/*\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, AnyDateTime, AnyTime, Calendar, DateFields, Disambiguation, TimeFields} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {constrain} from './manipulation';\nimport {getExtendedYear, GregorianCalendar} from './calendars/GregorianCalendar';\nimport {getLocalTimeZone} from './queries';\nimport {Mutable} from './utils';\n\nexport function epochFromDate(date: AnyDateTime) {\n date = toCalendar(date, new GregorianCalendar());\n let year = getExtendedYear(date.era, date.year);\n return epochFromParts(year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n}\n\nfunction epochFromParts(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number) {\n // Note: Date.UTC() interprets one and two-digit years as being in the\n // 20th century, so don't use it\n let date = new Date();\n date.setUTCHours(hour, minute, second, millisecond);\n date.setUTCFullYear(year, month - 1, day);\n return date.getTime();\n}\n\nexport function getTimeZoneOffset(ms: number, timeZone: string) {\n // Fast path for UTC.\n if (timeZone === 'UTC') {\n return 0;\n }\n\n // Fast path: for local timezone after 1970, use native Date.\n if (ms > 0 && timeZone === getLocalTimeZone()) {\n return new Date(ms).getTimezoneOffset() * -60 * 1000;\n }\n\n let {year, month, day, hour, minute, second} = getTimeZoneParts(ms, timeZone);\n let utc = epochFromParts(year, month, day, hour, minute, second, 0);\n return utc - Math.floor(ms / 1000) * 1000;\n}\n\nconst formattersByTimeZone = new Map<string, Intl.DateTimeFormat>();\n\nfunction getTimeZoneParts(ms: number, timeZone: string) {\n let formatter = formattersByTimeZone.get(timeZone);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour12: false,\n era: 'short',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n });\n\n formattersByTimeZone.set(timeZone, formatter);\n }\n\n let parts = formatter.formatToParts(new Date(ms));\n let namedParts: {[name: string]: string} = {};\n for (let part of parts) {\n if (part.type !== 'literal') {\n namedParts[part.type] = part.value;\n }\n }\n\n\n return {\n // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253\n year: namedParts.era === 'BC' || namedParts.era === 'B' ? -namedParts.year + 1 : +namedParts.year,\n month: +namedParts.month,\n day: +namedParts.day,\n hour: namedParts.hour === '24' ? 0 : +namedParts.hour, // bugs.chromium.org/p/chromium/issues/detail?id=1045791\n minute: +namedParts.minute,\n second: +namedParts.second\n };\n}\n\nconst DAYMILLIS = 86400000;\n\nexport function possibleAbsolutes(date: CalendarDateTime, timeZone: string): number[] {\n let ms = epochFromDate(date);\n let earlier = ms - getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let later = ms - getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n return getValidWallTimes(date, timeZone, earlier, later);\n}\n\nfunction getValidWallTimes(date: CalendarDateTime, timeZone: string, earlier: number, later: number): number[] {\n let found = earlier === later ? [earlier] : [earlier, later];\n return found.filter(absolute => isValidWallTime(date, timeZone, absolute));\n}\n\nfunction isValidWallTime(date: CalendarDateTime, timeZone: string, absolute: number) {\n let parts = getTimeZoneParts(absolute, timeZone);\n return date.year === parts.year\n && date.month === parts.month\n && date.day === parts.day\n && date.hour === parts.hour\n && date.minute === parts.minute\n && date.second === parts.second;\n}\n\nexport function toAbsolute(date: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): number {\n let dateTime = toCalendarDateTime(date);\n\n // Fast path: if the time zone is UTC, use native Date.\n if (timeZone === 'UTC') {\n return epochFromDate(dateTime);\n }\n\n // Fast path: if the time zone is the local timezone and disambiguation is compatible, use native Date.\n if (timeZone === getLocalTimeZone() && disambiguation === 'compatible') {\n dateTime = toCalendar(dateTime, new GregorianCalendar());\n\n // Don't use Date constructor here because two-digit years are interpreted in the 20th century.\n let date = new Date();\n let year = getExtendedYear(dateTime.era, dateTime.year);\n date.setFullYear(year, dateTime.month - 1, dateTime.day);\n date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n return date.getTime();\n }\n\n let ms = epochFromDate(dateTime);\n let offsetBefore = getTimeZoneOffset(ms - DAYMILLIS, timeZone);\n let offsetAfter = getTimeZoneOffset(ms + DAYMILLIS, timeZone);\n let valid = getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);\n\n if (valid.length === 1) {\n return valid[0];\n }\n\n if (valid.length > 1) {\n switch (disambiguation) {\n // 'compatible' means 'earlier' for \"fall back\" transitions\n case 'compatible':\n case 'earlier':\n return valid[0];\n case 'later':\n return valid[valid.length - 1];\n case 'reject':\n throw new RangeError('Multiple possible absolute times found');\n }\n }\n\n switch (disambiguation) {\n case 'earlier':\n return Math.min(ms - offsetBefore, ms - offsetAfter);\n // 'compatible' means 'later' for \"spring forward\" transitions\n case 'compatible':\n case 'later':\n return Math.max(ms - offsetBefore, ms - offsetAfter);\n case 'reject':\n throw new RangeError('No such absolute time found');\n }\n}\n\nexport function toDate(dateTime: CalendarDate | CalendarDateTime, timeZone: string, disambiguation: Disambiguation = 'compatible'): Date {\n return new Date(toAbsolute(dateTime, timeZone, disambiguation));\n}\n\n/**\n * Takes a Unix epoch (milliseconds since 1970) and converts it to the provided time zone.\n */\nexport function fromAbsolute(ms: number, timeZone: string): ZonedDateTime {\n let offset = getTimeZoneOffset(ms, timeZone);\n let date = new Date(ms + offset);\n let year = date.getUTCFullYear();\n let month = date.getUTCMonth() + 1;\n let day = date.getUTCDate();\n let hour = date.getUTCHours();\n let minute = date.getUTCMinutes();\n let second = date.getUTCSeconds();\n let millisecond = date.getUTCMilliseconds();\n\n return new ZonedDateTime(year, month, day, timeZone, offset, hour, minute, second, millisecond);\n}\n\n/**\n * Takes a `Date` object and converts it to the provided time zone.\n */\nexport function fromDate(date: Date, timeZone: string): ZonedDateTime {\n return fromAbsolute(date.getTime(), timeZone);\n}\n\nexport function fromDateToLocal(date: Date): ZonedDateTime {\n return fromDate(date, getLocalTimeZone());\n}\n\n/** Converts a value with date components such as a `CalendarDateTime` or `ZonedDateTime` into a `CalendarDate`. */\nexport function toCalendarDate(dateTime: AnyCalendarDate): CalendarDate {\n return new CalendarDate(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);\n}\n\nexport function toDateFields(date: AnyCalendarDate): DateFields {\n return {\n era: date.era,\n year: date.year,\n month: date.month,\n day: date.day\n };\n}\n\nexport function toTimeFields(date: AnyTime): TimeFields {\n return {\n hour: date.hour,\n minute: date.minute,\n second: date.second,\n millisecond: date.millisecond\n };\n}\n\n/**\n * Converts a date value to a `CalendarDateTime`. An optional `Time` value can be passed to set the time\n * of the resulting value, otherwise it will default to midnight.\n */\nexport function toCalendarDateTime(date: CalendarDate | CalendarDateTime | ZonedDateTime, time?: AnyTime): CalendarDateTime {\n let hour = 0, minute = 0, second = 0, millisecond = 0;\n if ('timeZone' in date) {\n ({hour, minute, second, millisecond} = date);\n } else if ('hour' in date && !time) {\n return date;\n }\n\n if (time) {\n ({hour, minute, second, millisecond} = time);\n }\n\n return new CalendarDateTime(\n date.calendar,\n date.era,\n date.year,\n date.month,\n date.day,\n hour,\n minute,\n second,\n millisecond\n );\n}\n\n/** Extracts the time components from a value containing a date and time. */\nexport function toTime(dateTime: CalendarDateTime | ZonedDateTime): Time {\n return new Time(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);\n}\n\n/** Converts a date from one calendar system to another. */\nexport function toCalendar<T extends AnyCalendarDate>(date: T, calendar: Calendar): T {\n if (date.calendar.identifier === calendar.identifier) {\n return date;\n }\n\n let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));\n let copy: Mutable<T> = date.copy();\n copy.calendar = calendar;\n copy.era = calendarDate.era;\n copy.year = calendarDate.year;\n copy.month = calendarDate.month;\n copy.day = calendarDate.day;\n constrain(copy);\n return copy;\n}\n\n/**\n * Converts a date value to a `ZonedDateTime` in the provided time zone. The `disambiguation` option can be set\n * to control how values that fall on daylight saving time changes are interpreted.\n */\nexport function toZoned(date: CalendarDate | CalendarDateTime | ZonedDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime {\n if (date instanceof ZonedDateTime) {\n if (date.timeZone === timeZone) {\n return date;\n }\n\n return toTimeZone(date, timeZone);\n }\n\n let ms = toAbsolute(date, timeZone, disambiguation);\n return fromAbsolute(ms, timeZone);\n}\n\nexport function zonedToDate(date: ZonedDateTime) {\n let ms = epochFromDate(date) - date.offset;\n return new Date(ms);\n}\n\n/** Converts a `ZonedDateTime` from one time zone to another. */\nexport function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime {\n let ms = epochFromDate(date) - date.offset;\n return toCalendar(fromAbsolute(ms, timeZone), date.calendar);\n}\n\n/** Converts the given `ZonedDateTime` into the user's local time zone. */\nexport function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime {\n return toTimeZone(date, getLocalTimeZone());\n}\n","/*\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 {mod, Mutable} from '../utils';\n\nconst EPOCH = 1721426; // 001/01/03 Julian C.E.\nexport function gregorianToJulianDay(era: string, year: number, month: number, day: number): number {\n year = getExtendedYear(era, year);\n\n let y1 = year - 1;\n let monthOffset = -2;\n if (month <= 2) {\n monthOffset = 0;\n } else if (isLeapYear(year)) {\n monthOffset = -1;\n }\n\n return (\n EPOCH -\n 1 +\n 365 * y1 +\n Math.floor(y1 / 4) -\n Math.floor(y1 / 100) +\n Math.floor(y1 / 400) +\n Math.floor((367 * month - 362) / 12 + monthOffset + day)\n );\n}\n\nexport function isLeapYear(year: number): boolean {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function getExtendedYear(era: string, year: number): number {\n return era === 'BC' ? 1 - year : year;\n}\n\nexport function fromExtendedYear(year: number): [string, number] {\n let era = 'AD';\n if (year <= 0) {\n era = 'BC';\n year = 1 - year;\n }\n\n return [era, year];\n}\n\nconst daysInMonth = {\n standard: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n leapyear: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n};\n\n/**\n * The Gregorian calendar is the most commonly used calendar system in the world. It supports two eras: BC, and AD.\n * Years always contain 12 months, and 365 or 366 days depending on whether it is a leap year.\n */\nexport class GregorianCalendar implements Calendar {\n identifier = 'gregory';\n\n fromJulianDay(jd: number): CalendarDate {\n let jd0 = jd;\n let depoch = jd0 - EPOCH;\n let quadricent = Math.floor(depoch / 146097);\n let dqc = mod(depoch, 146097);\n let cent = Math.floor(dqc / 36524);\n let dcent = mod(dqc, 36524);\n let quad = Math.floor(dcent / 1461);\n let dquad = mod(dcent, 1461);\n let yindex = Math.floor(dquad / 365);\n\n let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);\n let [era, year] = fromExtendedYear(extendedYear);\n let yearDay = jd0 - gregorianToJulianDay(era, year, 1, 1);\n let leapAdj = 2;\n if (jd0 < gregorianToJulianDay(era, year, 3, 1)) {\n leapAdj = 0;\n } else if (isLeapYear(year)) {\n leapAdj = 1;\n }\n let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);\n let day = jd0 - gregorianToJulianDay(era, year, month, 1) + 1;\n\n return new CalendarDate(era, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n return gregorianToJulianDay(date.era, date.year, date.month, date.day);\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return daysInMonth[isLeapYear(date.year) ? 'leapyear' : 'standard'][date.month - 1];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getMonthsInYear(date: AnyCalendarDate): number {\n return 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 366 : 365;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getYearsInEra(date: AnyCalendarDate): number {\n return 9999;\n }\n\n getEras() {\n return ['BC', 'AD'];\n }\n\n isInverseEra(date: AnyCalendarDate): boolean {\n return date.era === 'BC';\n }\n\n balanceDate(date: Mutable<AnyCalendarDate>) {\n if (date.year <= 0) {\n date.era = date.era === 'BC' ? 'AD' : 'BC';\n date.year = 1 - date.year;\n }\n }\n}\n","/*\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\nimport {CalendarDate, CalendarDateTime} from './CalendarDate';\n\nexport type Mutable<T> = {\n -readonly[P in keyof T]: T[P]\n};\n\nexport function mod(amount: number, numerator: number): number {\n return amount - numerator * Math.floor(amount / numerator);\n}\n\nexport function copy(date: CalendarDate): Mutable<CalendarDate> {\n if (date.era) {\n return new CalendarDate(date.calendar, date.era, date.year, date.month, date.day);\n } else {\n return new CalendarDate(date.calendar, date.year, date.month, date.day);\n }\n}\n\nexport function copyDateTime(date: CalendarDateTime): Mutable<CalendarDateTime> {\n if (date.era) {\n return new CalendarDateTime(date.calendar, date.era, date.year, date.month, date.day, date.hour, date.minute, date.second, date.millisecond);\n } else {\n return new CalendarDateTime(date.calendar, date.year, date.month, date.day, date.hour, date.minute, date.second);\n }\n}\n","/*\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\nimport {AnyCalendarDate, AnyTime} from './types';\nimport {CalendarDate, CalendarDateTime, ZonedDateTime} from './CalendarDate';\nimport {fromAbsolute, toAbsolute, toCalendar, toCalendarDate} from './conversion';\nimport {weekStartData} from './weekStartData';\n\ntype DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Returns whether the given dates occur on the same day, regardless of the time or calendar system. */\nexport function isSameDay(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, using the calendar system of the first date. */\nexport function isSameMonth(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n // In the Japanese calendar, months can span multiple eras/years, so only compare the first of the month.\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, using the calendar system of the first date. */\nexport function isSameYear(a: DateValue, b: DateValue): boolean {\n b = toCalendar(b, a.calendar);\n a = startOfYear(a);\n b = startOfYear(b);\n return a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the given dates occur on the same day, and are of the same calendar system. */\nexport function isEqualDay(a: DateValue, b: DateValue): boolean {\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;\n}\n\n/** Returns whether the given dates occur in the same month, and are of the same calendar system. */\nexport function isEqualMonth(a: DateValue, b: DateValue): boolean {\n a = startOfMonth(a);\n b = startOfMonth(b);\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year && a.month === b.month;\n}\n\n/** Returns whether the given dates occur in the same year, and are of the same calendar system. */\nexport function isEqualYear(a: DateValue, b: DateValue): boolean {\n a = startOfYear(a);\n b = startOfYear(b);\n return a.calendar.identifier === b.calendar.identifier && a.era === b.era && a.year === b.year;\n}\n\n/** Returns whether the date is today in the given time zone. */\nexport function isToday(date: DateValue, timeZone: string): boolean {\n return isSameDay(date, today(timeZone));\n}\n\n/**\n * Returns the day of week for the given date and locale. Days are numbered from zero to six,\n * where zero is the first day of the week in the given locale. For example, in the United States,\n * the first day of the week is Sunday, but in France it is Monday.\n */\nexport function getDayOfWeek(date: DateValue, locale: string): number {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1 - getWeekStart(locale)) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n return dayOfWeek;\n}\n\n/** Returns the current time in the given time zone. */\nexport function now(timeZone: string): ZonedDateTime {\n return fromAbsolute(Date.now(), timeZone);\n}\n\n/** Returns today's date in the given time zone. */\nexport function today(timeZone: string): CalendarDate {\n return toCalendarDate(now(timeZone));\n}\n\nexport function compareDate(a: AnyCalendarDate, b: AnyCalendarDate): number {\n return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);\n}\n\nexport function compareTime(a: AnyTime, b: AnyTime): number {\n return timeToMs(a) - timeToMs(b);\n}\n\nfunction timeToMs(a: AnyTime): number {\n return a.hour * 60 * 60 * 1000 + a.minute * 60 * 1000 + a.second * 1000 + a.millisecond;\n}\n\n/**\n * Returns the number of hours in the given date and time zone.\n * Usually this is 24, but it could be 23 or 25 if the date is on a daylight saving transition.\n */\nexport function getHoursInDay(a: CalendarDate, timeZone: string): number {\n let ms = toAbsolute(a, timeZone);\n let tomorrow = a.add({days: 1});\n let tomorrowMs = toAbsolute(tomorrow, timeZone);\n return (tomorrowMs - ms) / 3600000;\n}\n\nlet localTimeZone: string | null = null;\n\n/** Returns the time zone identifier for the current user. */\nexport function getLocalTimeZone(): string {\n // TODO: invalidate this somehow?\n if (localTimeZone == null) {\n localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n return localTimeZone!;\n}\n\n/** Returns the first date of the month for the given date. */\nexport function startOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function startOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function startOfMonth(date: CalendarDate): CalendarDate;\nexport function startOfMonth(date: DateValue): DateValue;\nexport function startOfMonth(date: DateValue): DateValue {\n // Use `subtract` instead of `set` so we don't get constrained in an era.\n return date.subtract({days: date.day - 1});\n}\n\n/** Returns the last date of the month for the given date. */\nexport function endOfMonth(date: ZonedDateTime): ZonedDateTime;\nexport function endOfMonth(date: CalendarDateTime): CalendarDateTime;\nexport function endOfMonth(date: CalendarDate): CalendarDate;\nexport function endOfMonth(date: DateValue): DateValue;\nexport function endOfMonth(date: DateValue): DateValue {\n return date.add({days: date.calendar.getDaysInMonth(date) - date.day});\n}\n\n/** Returns the first day of the year for the given date. */\nexport function startOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function startOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function startOfYear(date: CalendarDate): CalendarDate;\nexport function startOfYear(date: DateValue): DateValue;\nexport function startOfYear(date: DateValue): DateValue {\n return startOfMonth(date.subtract({months: date.month - 1}));\n}\n\n/** Returns the last day of the year for the given date. */\nexport function endOfYear(date: ZonedDateTime): ZonedDateTime;\nexport function endOfYear(date: CalendarDateTime): CalendarDateTime;\nexport function endOfYear(date: CalendarDate): CalendarDate;\nexport function endOfYear(date: DateValue): DateValue;\nexport function endOfYear(date: DateValue): DateValue {\n return endOfMonth(date.add({months: date.calendar.getMonthsInYear(date) - date.month}));\n}\n\nexport function getMinimumMonthInYear(date: AnyCalendarDate) {\n if (date.calendar.getMinimumMonthInYear) {\n return date.calendar.getMinimumMonthInYear(date);\n }\n\n return 1;\n}\n\nexport function getMinimumDayInMonth(date: AnyCalendarDate) {\n if (date.calendar.getMinimumDayInMonth) {\n return date.calendar.getMinimumDayInMonth(date);\n }\n\n return 1;\n}\n\n/** Returns the first date of the week for the given date and locale. */\nexport function startOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;\nexport function startOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;\nexport function startOfWeek(date: CalendarDate, locale: string): CalendarDate;\nexport function startOfWeek(date: DateValue, locale: string): DateValue;\nexport function startOfWeek(date: DateValue, locale: string): DateValue {\n let dayOfWeek = getDayOfWeek(date, locale);\n return date.subtract({days: dayOfWeek});\n}\n\n/** Returns the last date of the week for the given date and locale. */\nexport function endOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;\nexport function endOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;\nexport function endOfWeek(date: CalendarDate, locale: string): CalendarDate;\nexport function endOfWeek(date: DateValue, locale: string): DateValue {\n return startOfWeek(date, locale).add({days: 6});\n}\n\nconst cachedRegions = new Map<string, string>();\n\nfunction getRegion(locale: string): string | undefined {\n // If the Intl.Locale API is available, use it to get the region for the locale.\n // @ts-ignore\n if (Intl.Locale) {\n // Constructing an Intl.Locale is expensive, so cache the result.\n let region = cachedRegions.get(locale);\n if (!region) {\n // @ts-ignore\n region = new Intl.Locale(locale).maximize().region;\n if (region) {\n cachedRegions.set(locale, region);\n }\n }\n return region;\n }\n\n // If not, just try splitting the string.\n // If the second part of the locale string is 'u',\n // then this is a unicode extension, so ignore it.\n // Otherwise, it should be the region.\n let part = locale.split('-')[1];\n return part === 'u' ? undefined : part;\n}\n\nfunction getWeekStart(locale: string): number {\n // TODO: use Intl.Locale for this once browsers support the weekInfo property\n // https://github.com/tc39/proposal-intl-locale-info\n let region = getRegion(locale);\n return region ? weekStartData[region] || 0 : 0;\n}\n\n/** Returns the number of weeks in the given month and locale. */\nexport function getWeeksInMonth(date: DateValue, locale: string): number {\n let days = date.calendar.getDaysInMonth(date);\n return Math.ceil((getDayOfWeek(startOfMonth(date), locale) + days) / 7);\n}\n\n/** Returns the lesser of the two provider dates. */\nexport function minDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {\n if (a && b) {\n return a.compare(b) <= 0 ? a : b;\n }\n\n return a || b;\n}\n\n/** Returns the greater of the two provider dates. */\nexport function maxDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {\n if (a && b) {\n return a.compare(b) >= 0 ? a : b;\n }\n\n return a || b;\n}\n\nconst WEEKEND_DATA = {\n AF: [4, 5],\n AE: [5, 6],\n BH: [5, 6],\n DZ: [5, 6],\n EG: [5, 6],\n IL: [5, 6],\n IQ: [5, 6],\n IR: [5, 5],\n JO: [5, 6],\n KW: [5, 6],\n LY: [5, 6],\n OM: [5, 6],\n QA: [5, 6],\n SA: [5, 6],\n SD: [5, 6],\n SY: [5, 6],\n YE: [5, 6]\n};\n\n/** Returns whether the given date is on a weekend in the given locale. */\nexport function isWeekend(date: DateValue, locale: string): boolean {\n let julian = date.calendar.toJulianDay(date);\n\n // If julian is negative, then julian % 7 will be negative, so we adjust\n // accordingly. Julian day 0 is Monday.\n let dayOfWeek = Math.ceil(julian + 1) % 7;\n if (dayOfWeek < 0) {\n dayOfWeek += 7;\n }\n\n let region = getRegion(locale);\n // Use Intl.Locale for this once weekInfo is supported.\n // https://github.com/tc39/proposal-intl-locale-info\n let [start, end] = WEEKEND_DATA[region!] || [6, 0];\n return dayOfWeek === start || dayOfWeek === end;\n}\n\n/** Returns whether the given date is on a weekday in the given locale. */\nexport function isWeekday(date: DateValue, locale: string): boolean {\n return !isWeekend(date, locale);\n}\n","/*\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// Data from https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json\n// Locales starting on Sunday have been removed for compression.\nexport const weekStartData = {\n '001': 1,\n AD: 1,\n AE: 6,\n AF: 6,\n AI: 1,\n AL: 1,\n AM: 1,\n AN: 1,\n AR: 1,\n AT: 1,\n AU: 1,\n AX: 1,\n AZ: 1,\n BA: 1,\n BE: 1,\n BG: 1,\n BH: 6,\n BM: 1,\n BN: 1,\n BY: 1,\n CH: 1,\n CL: 1,\n CM: 1,\n CN: 1,\n CR: 1,\n CY: 1,\n CZ: 1,\n DE: 1,\n DJ: 6,\n DK: 1,\n DZ: 6,\n EC: 1,\n EE: 1,\n EG: 6,\n ES: 1,\n FI: 1,\n FJ: 1,\n FO: 1,\n FR: 1,\n GB: 1,\n GE: 1,\n GF: 1,\n GP: 1,\n GR: 1,\n HR: 1,\n HU: 1,\n IE: 1,\n IQ: 6,\n IR: 6,\n IS: 1,\n IT: 1,\n JO: 6,\n KG: 1,\n KW: 6,\n KZ: 1,\n LB: 1,\n LI: 1,\n LK: 1,\n LT: 1,\n LU: 1,\n LV: 1,\n LY: 6,\n MC: 1,\n MD: 1,\n ME: 1,\n MK: 1,\n MN: 1,\n MQ: 1,\n MV: 5,\n MY: 1,\n NL: 1,\n NO: 1,\n NZ: 1,\n OM: 6,\n PL: 1,\n QA: 6,\n RE: 1,\n RO: 1,\n RS: 1,\n RU: 1,\n SD: 6,\n SE: 1,\n SI: 1,\n SK: 1,\n SM: 1,\n SY: 6,\n TJ: 1,\n TM: 1,\n TR: 1,\n UA: 1,\n UY: 1,\n UZ: 1,\n VA: 1,\n VN: 1,\n XK: 1\n};\n","/*\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\nimport {AnyDateTime, DateTimeDuration, Disambiguation} from './types';\nimport {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from './CalendarDate';\nimport {epochFromDate, fromAbsolute, possibleAbsolutes, toAbsolute, toCalendar, toCalendarDateTime, toTimeZone} from './conversion';\nimport {getLocalTimeZone} from './queries';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {Mutable} from './utils';\n\nconst TIME_RE = /^(\\d{2})(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DATE_TIME_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?$/;\nconst ZONED_DATE_TIME_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:([+-]\\d{2})(?::?(\\d{2}))?)?\\[(.*?)\\]$/;\nconst ABSOLUTE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}))?(?::(\\d{2}))?(?::(\\d{2}))?(\\.\\d+)?(?:(?:([+-]\\d{2})(?::?(\\d{2}))?)|Z)$/;\nconst DATE_TIME_DURATION_RE =\n /^((?<negative>-)|\\+)?P((?<years>\\d*)Y)?((?<months>\\d*)M)?((?<weeks>\\d*)W)?((?<days>\\d*)D)?((?<time>T)((?<hours>\\d*[.,]?\\d{1,9})H)?((?<minutes>\\d*[.,]?\\d{1,9})M)?((?<seconds>\\d*[.,]?\\d{1,9})S)?)?$/;\nconst requiredDurationTimeGroups = ['hours', 'minutes', 'seconds'];\nconst requiredDurationGroups = ['years', 'months', 'weeks', 'days', ...requiredDurationTimeGroups];\n\n/** Parses an ISO 8601 time string. */\nexport function parseTime(value: string): Time {\n let m = value.match(TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 time string: ' + value);\n }\n\n return new Time(\n parseNumber(m[1], 0, 23),\n m[2] ? parseNumber(m[2], 0, 59) : 0,\n m[3] ? parseNumber(m[3], 0, 59) : 0,\n m[4] ? parseNumber(m[4], 0, Infinity) * 1000 : 0\n );\n}\n\n/** Parses an ISO 8601 date string, with no time components. */\nexport function parseDate(value: string): CalendarDate {\n let m = value.match(DATE_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date string: ' + value);\n }\n\n let date: Mutable<CalendarDate> = new CalendarDate(\n parseNumber(m[1], 0, 9999),\n parseNumber(m[2], 1, 12),\n 1\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n return date as CalendarDate;\n}\n\n/** Parses an ISO 8601 date and time string, with no time zone. */\nexport function parseDateTime(value: string): CalendarDateTime {\n let m = value.match(DATE_TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<CalendarDateTime> = new CalendarDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n return date as CalendarDateTime;\n}\n\n/**\n * Parses an ISO 8601 date and time string with a time zone extension and optional UTC offset\n * (e.g. \"2021-11-07T00:45[America/Los_Angeles]\" or \"2021-11-07T00:45-07:00[America/Los_Angeles]\").\n * Ambiguous times due to daylight saving time transitions are resolved according to the `disambiguation`\n * parameter.\n */\nexport function parseZonedDateTime(value: string, disambiguation?: Disambiguation): ZonedDateTime {\n let m = value.match(ZONED_DATE_TIME_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n m[10],\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n let plainDateTime = toCalendarDateTime(date as ZonedDateTime);\n\n let ms: number;\n if (m[8]) {\n date.offset = parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000;\n ms = epochFromDate(date as ZonedDateTime) - date.offset;\n\n // Validate offset against parsed date.\n let absolutes = possibleAbsolutes(plainDateTime, date.timeZone);\n if (!absolutes.includes(ms)) {\n throw new Error(`Offset ${offsetToString(date.offset)} is invalid for ${dateTimeToString(date)} in ${date.timeZone}`);\n }\n } else {\n // Convert to absolute and back to fix invalid times due to DST.\n ms = toAbsolute(toCalendarDateTime(plainDateTime), date.timeZone, disambiguation);\n }\n\n return fromAbsolute(ms, date.timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the provided time zone.\n */\nexport function parseAbsolute(value: string, timeZone: string): ZonedDateTime {\n let m = value.match(ABSOLUTE_RE);\n if (!m) {\n throw new Error('Invalid ISO 8601 date time string: ' + value);\n }\n\n let date: Mutable<ZonedDateTime> = new ZonedDateTime(\n parseNumber(m[1], 1, 9999),\n parseNumber(m[2], 1, 12),\n 1,\n timeZone,\n 0,\n m[4] ? parseNumber(m[4], 0, 23) : 0,\n m[5] ? parseNumber(m[5], 0, 59) : 0,\n m[6] ? parseNumber(m[6], 0, 59) : 0,\n m[7] ? parseNumber(m[7], 0, Infinity) * 1000 : 0\n );\n\n date.day = parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));\n\n if (m[8]) {\n date.offset = parseNumber(m[8], -23, 23) * 60 * 60 * 1000 + parseNumber(m[9] ?? '0', 0, 59) * 60 * 1000;\n }\n\n return toTimeZone(date as ZonedDateTime, timeZone);\n}\n\n/**\n * Parses an ISO 8601 date and time string with a UTC offset (e.g. \"2021-11-07T07:45:00Z\"\n * or \"2021-11-07T07:45:00-07:00\"). The result is converted to the user's local time zone.\n */\nexport function parseAbsoluteToLocal(value: string): ZonedDateTime {\n return parseAbsolute(value, getLocalTimeZone());\n}\n\nfunction parseNumber(value: string, min: number, max: number) {\n let val = Number(value);\n if (val < min || val > max) {\n throw new RangeError(`Value out of range: ${min} <= ${val} <= ${max}`);\n }\n\n return val;\n}\n\nexport function timeToString(time: Time): string {\n return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;\n}\n\nexport function dateToString(date: CalendarDate): string {\n let gregorianDate = toCalendar(date, new GregorianCalendar());\n return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;\n}\n\nexport function dateTimeToString(date: AnyDateTime): string {\n // @ts-ignore\n return `${dateToString(date)}T${timeToString(date)}`;\n}\n\nfunction offsetToString(offset: number) {\n let sign = Math.sign(offset) < 0 ? '-' : '+';\n offset = Math.abs(offset);\n let offsetHours = Math.floor(offset / (60 * 60 * 1000));\n let offsetMinutes = (offset % (60 * 60 * 1000)) / (60 * 1000);\n return `${sign}${String(offsetHours).padStart(2, '0')}:${String(offsetMinutes).padStart(2, '0')}`;\n}\n\nexport function zonedDateTimeToString(date: ZonedDateTime): string {\n return `${dateTimeToString(date)}${offsetToString(date.offset)}[${date.timeZone}]`;\n}\n\n/**\n * Parses an ISO 8601 duration string (e.g. \"P3Y6M6W4DT12H30M5S\").\n * @param value An ISO 8601 duration string.\n * @returns A DateTimeDuration object.\n */\nexport function parseDuration(value: string): Required<DateTimeDuration> {\n const match = value.match(DATE_TIME_DURATION_RE);\n\n if (!match) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const parseDurationGroup = (\n group: string | undefined,\n isNegative: boolean,\n min: number,\n max: number\n ): number => {\n if (!group) {\n return 0;\n }\n try {\n const sign = isNegative ? -1 : 1;\n return sign * parseNumber(group.replace(',', '.'), min, max);\n } catch {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n };\n\n const isNegative = !!match.groups?.negative;\n\n const hasRequiredGroups = requiredDurationGroups.some(group => match.groups?.[group]);\n\n if (!hasRequiredGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n\n const durationStringIncludesTime = match.groups?.time;\n\n if (durationStringIncludesTime) {\n const hasRequiredDurationTimeGroups = requiredDurationTimeGroups.some(group => match.groups?.[group]);\n if (!hasRequiredDurationTimeGroups) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value}`);\n }\n }\n\n const duration: Mutable<DateTimeDuration> = {\n years: parseDurationGroup(match.groups?.years, isNegative, 0, 9999),\n months: parseDurationGroup(match.groups?.months, isNegative, 0, 12),\n weeks: parseDurationGroup(match.groups?.weeks, isNegative, 0, Infinity),\n days: parseDurationGroup(match.groups?.days, isNegative, 0, 31),\n hours: parseDurationGroup(match.groups?.hours, isNegative, 0, 23),\n minutes: parseDurationGroup(match.groups?.minutes, isNegative, 0, 59),\n seconds: parseDurationGroup(match.groups?.seconds, isNegative, 0, 59)\n };\n\n if (duration.hours !== undefined && ((duration.hours % 1) !== 0) && (duration.minutes || duration.seconds)) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n if (duration.minutes !== undefined && ((duration.minutes % 1) !== 0) && duration.seconds) {\n throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);\n }\n\n return duration as Required<DateTimeDuration>;\n}\n","/*\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","/*\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","/*\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","/*\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 {mod} from '../utils';\n\nconst PERSIAN_EPOCH = 1948320;\n\n// Number of days from the start of the year to the start of each month.\nconst MONTH_START = [\n 0, // Farvardin\n 31, // Ordibehesht\n 62, // Khordad\n 93, // Tir\n 124, // Mordad\n 155, // Shahrivar\n 186, // Mehr\n 216, // Aban\n 246, // Azar\n 276, // Dey\n 306, // Bahman\n 336 // Esfand\n];\n\n/**\n * The Persian calendar is the main calendar used in Iran and Afghanistan. It has 12 months\n * in each year, the first 6 of which have 31 days, and the next 5 have 30 days. The 12th month\n * has either 29 or 30 days depending on whether it is a leap year. The Persian year starts\n * around the March equinox.\n */\nexport class PersianCalendar implements Calendar {\n identifier = 'persian';\n\n fromJulianDay(jd: number): CalendarDate {\n let daysSinceEpoch = jd - PERSIAN_EPOCH;\n let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);\n let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);\n let dayOfYear = daysSinceEpoch - farvardin1;\n let month = dayOfYear < 216\n ? Math.floor(dayOfYear / 31)\n : Math.floor((dayOfYear - 6) / 30);\n let day = dayOfYear - MONTH_START[month] + 1;\n return new CalendarDate(this, year, month + 1, day);\n }\n\n toJulianDay(date: AnyCalendarDate): number {\n let jd = PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);\n jd += MONTH_START[date.month - 1];\n jd += date.day;\n return jd;\n }\n\n getMonthsInYear(): number {\n return 12;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n if (date.month <= 6) {\n return 31;\n }\n\n if (date.month <= 11) {\n return 30;\n }\n\n let isLeapYear = mod(25 * date.year + 11, 33) < 8;\n return isLeapYear ? 30 : 29;\n }\n\n getEras() {\n return ['AP'];\n }\n\n getYearsInEra(): number {\n // 9378-10-10 persian is 9999-12-31 gregorian.\n // Round down to 9377 to set the maximum full year.\n return 9377;\n }\n}\n","/*\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","/*\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","/*\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 {mod, Mutable} from '../utils';\n\nconst HEBREW_EPOCH = 347997;\n\n// Hebrew date calculations are performed in terms of days, hours, and\n// \"parts\" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.\nconst HOUR_PARTS = 1080;\nconst DAY_PARTS = 24 * HOUR_PARTS;\n\n// An approximate value for the length of a lunar month.\n// It is used to calculate the approximate year and month of a given\n// absolute date.\nconst MONTH_DAYS = 29;\nconst MONTH_FRACT = 12 * HOUR_PARTS + 793;\nconst MONTH_PARTS = MONTH_DAYS * DAY_PARTS + MONTH_FRACT;\n\nfunction isLeapYear(year: number) {\n return mod(year * 7 + 1, 19) < 7;\n}\n\n// Test for delay of start of new year and to avoid\n// Sunday, Wednesday, and Friday as start of the new year.\nfunction hebrewDelay1(year: number) {\n let months = Math.floor((235 * year - 234) / 19);\n let parts = 12084 + 13753 * months;\n let day = months * 29 + Math.floor(parts / 25920);\n\n if (mod(3 * (day + 1), 7) < 3) {\n day += 1;\n }\n\n return day;\n}\n\n// Check for delay in start of new year due to length of adjacent years\nfunction hebrewDelay2(year: number) {\n let last = hebrewDelay1(year - 1);\n let present = hebrewDelay1(year);\n let next = hebrewDelay1(year + 1);\n\n if (next - present === 356) {\n return 2;\n }\n\n if (present - last === 382) {\n return 1;\n }\n\n return 0;\n}\n\nfunction startOfYear(year: number) {\n return hebrewDelay1(year) + hebrewDelay2(year);\n}\n\nfunction getDaysInYear(year: number) {\n return startOfYear(year + 1) - startOfYear(year);\n}\n\nfunction getYearType(year: number) {\n let yearLength = getDaysInYear(year);\n\n if (yearLength > 380) {\n yearLength -= 30; // Subtract length of leap month.\n }\n\n switch (yearLength) {\n case 353:\n return 0; // deficient\n case 354:\n return 1; // normal\n case 355:\n return 2; // complete\n }\n}\n\nfunction getDaysInMonth(year: number, month: number): number {\n // Normalize month numbers from 1 - 13, even on non-leap years\n if (month >= 6 && !isLeapYear(year)) {\n month++;\n }\n\n // First of all, dispose of fixed-length 29 day months\n if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) {\n return 29;\n }\n\n let yearType = getYearType(year);\n\n // If it's Heshvan, days depend on length of year\n if (month === 2) {\n return yearType === 2 ? 30 : 29;\n }\n\n // Similarly, Kislev varies with the length of year\n if (month === 3) {\n return yearType === 0 ? 29 : 30;\n }\n\n // Adar I only exists in leap years\n if (month === 6) {\n return isLeapYear(year) ? 30 : 0;\n }\n\n return 30;\n}\n\n/**\n * The Hebrew calendar is used in Israel and around the world by the Jewish faith.\n * Years include either 12 or 13 months depending on whether it is a leap year.\n * In leap years, an extra month is inserted at month 6.\n */\nexport class HebrewCalendar implements Calendar {\n identifier = 'hebrew';\n\n fromJulianDay(jd: number): CalendarDate {\n let d = jd - HEBREW_EPOCH;\n let m = (d * DAY_PARTS) / MONTH_PARTS; // Months (approx)\n let year = Math.floor((19 * m + 234) / 235) + 1; // Years (approx)\n let ys = startOfYear(year); // 1st day of year\n let dayOfYear = Math.floor(d - ys);\n\n // Because of the postponement rules, it's possible to guess wrong. Fix it.\n while (dayOfYear < 1) {\n year--;\n ys = startOfYear(year);\n dayOfYear = Math.floor(d - ys);\n }\n\n // Now figure out which month we're in, and the date within that month\n let month = 1;\n let monthStart = 0;\n while (monthStart < dayOfYear) {\n monthStart += getDaysInMonth(year, month);\n month++;\n }\n\n month--;\n monthStart -= getDaysInMonth(year, month);\n\n let day = dayOfYear - monthStart;\n return new CalendarDate(this, year, month, day);\n }\n\n toJulianDay(date: AnyCalendarDate) {\n let jd = startOfYear(date.year);\n for (let month = 1; month < date.month; month++) {\n jd += getDaysInMonth(date.year, month);\n }\n\n return jd + date.day + HEBREW_EPOCH;\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return getDaysInMonth(date.year, date.month);\n }\n\n getMonthsInYear(date: AnyCalendarDate): number {\n return isLeapYear(date.year) ? 13 : 12;\n }\n\n getDaysInYear(date: AnyCalendarDate): number {\n return getDaysInYear(date.year);\n }\n\n getYearsInEra(): number {\n // 6239 gregorian\n return 9999;\n }\n\n getEras() {\n return ['AM'];\n }\n\n balanceYearMonth(date: Mutable<AnyCalendarDate>, previousDate: AnyCalendarDate) {\n // Keep date in the same month when switching between leap years and non leap years\n if (previousDate.year !== date.year) {\n if (isLeapYear(previousDate.year) && !isLeapYear(date.year) && previousDate.month > 6) {\n date.month--;\n } else if (!isLeapYear(previousDate.year) && isLeapYear(date.year) && previousDate.month > 6) {\n date.month++;\n }\n }\n }\n}\n","/*\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","/*\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\nimport {BuddhistCalendar} from './calendars/BuddhistCalendar';\nimport {Calendar} from './types';\nimport {CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar} from './calendars/EthiopicCalendar';\nimport {GregorianCalendar} from './calendars/GregorianCalendar';\nimport {HebrewCalendar} from './calendars/HebrewCalendar';\nimport {IndianCalendar} from './calendars/IndianCalendar';\nimport {IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar} from './calendars/IslamicCalendar';\nimport {JapaneseCalendar} from './calendars/JapaneseCalendar';\nimport {PersianCalendar} from './calendars/PersianCalendar';\nimport {TaiwanCalendar} from './calendars/TaiwanCalendar';\n\n/** Creates a `Calendar` instance from a Unicode calendar identifier string. */\nexport function createCalendar(name: string): Calendar {\n switch (name) {\n case 'buddhist':\n return new BuddhistCalendar();\n case 'ethiopic':\n return new EthiopicCalendar();\n case 'ethioaa':\n return new EthiopicAmeteAlemCalendar();\n case 'coptic':\n return new CopticCalendar();\n case 'hebrew':\n return new HebrewCalendar();\n case 'indian':\n return new IndianCalendar();\n case 'islamic-civil':\n return new IslamicCivilCalendar();\n case 'islamic-tbla':\n return new IslamicTabularCalendar();\n case 'islamic-umalqura':\n return new IslamicUmalquraCalendar();\n case 'japanese':\n return new JapaneseCalendar();\n case 'persian':\n return new PersianCalendar();\n case 'roc':\n return new TaiwanCalendar();\n case 'gregory':\n default:\n return new GregorianCalendar();\n }\n}\n","/*\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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\ninterface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {\n hourCycle?: Intl.DateTimeFormatOptions['hourCycle']\n}\n\ninterface DateRangeFormatPart extends Intl.DateTimeFormatPart {\n source: 'startRange' | 'endRange' | 'shared'\n}\n\n/** A wrapper around Intl.DateTimeFormat that fixes various browser bugs, and polyfills new features. */\nexport class DateFormatter implements Intl.DateTimeFormat {\n private formatter: Intl.DateTimeFormat;\n private options: Intl.DateTimeFormatOptions;\n private resolvedHourCycle: Intl.DateTimeFormatOptions['hourCycle'];\n\n constructor(locale: string, options: Intl.DateTimeFormatOptions = {}) {\n this.formatter = getCachedDateFormatter(locale, options);\n this.options = options;\n }\n\n /** Formats a date as a string according to the locale and format options passed to the constructor. */\n format(value: Date): string {\n return this.formatter.format(value);\n }\n\n /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */\n formatToParts(value: Date): Intl.DateTimeFormatPart[] {\n return this.formatter.formatToParts(value);\n }\n\n /** Formats a date range as a string. */\n formatRange(start: Date, end: Date): string {\n // @ts-ignore\n if (typeof this.formatter.formatRange === 'function') {\n // @ts-ignore\n return this.formatter.formatRange(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n // Very basic fallback for old browsers.\n return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;\n }\n\n /** Formats a date range as an array of parts. */\n formatRangeToParts(start: Date, end: Date): DateRangeFormatPart[] {\n // @ts-ignore\n if (typeof this.formatter.formatRangeToParts === 'function') {\n // @ts-ignore\n return this.formatter.formatRangeToParts(start, end);\n }\n\n if (end < start) {\n throw new RangeError('End date must be >= start date');\n }\n\n let startParts = this.formatter.formatToParts(start);\n let endParts = this.formatter.formatToParts(end);\n return [\n ...startParts.map(p => ({...p, source: 'startRange'} as DateRangeFormatPart)),\n {type: 'literal', value: ' – ', source: 'shared'},\n ...endParts.map(p => ({...p, source: 'endRange'} as DateRangeFormatPart))\n ];\n }\n\n /** Returns the resolved formatting options based on the values passed to the constructor. */\n resolvedOptions(): ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;\n if (hasBuggyResolvedHourCycle()) {\n if (!this.resolvedHourCycle) {\n this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);\n }\n resolvedOptions.hourCycle = this.resolvedHourCycle;\n resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';\n }\n\n // Safari uses a different name for the Ethiopic (Amete Alem) calendar.\n // https://bugs.webkit.org/show_bug.cgi?id=241564\n if (resolvedOptions.calendar === 'ethiopic-amete-alem') {\n resolvedOptions.calendar = 'ethioaa';\n }\n\n return resolvedOptions;\n }\n}\n\n// There are multiple bugs involving the hour12 and hourCycle options in various browser engines.\n// - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)\n// rather than h23 (00:00 - 23:59). Same can happen with hour12: true in French, which Chrome resolves to h11 (00:00 - 11:59)\n// rather than h12 (12:00 - 11:59).\n// - WebKit returns an incorrect hourCycle resolved option in the French locale due to incorrect parsing of 'h' literal\n// in the resolved pattern. It also formats incorrectly when specifying the hourCycle option for the same reason. [3]\n// [1] https://bugs.chromium.org/p/chromium/issues/detail?id=1045791\n// [2] https://github.com/tc39/ecma402/issues/402\n// [3] https://bugs.webkit.org/show_bug.cgi?id=229313\n\n// https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802\nconst hour12Preferences = {\n true: {\n // Only Japanese uses the h11 style for 12 hour time. All others use h12.\n ja: 'h11'\n },\n false: {\n // All locales use h23 for 24 hour time. None use h24.\n }\n};\n\nfunction getCachedDateFormatter(locale: string, options: Intl.DateTimeFormatOptions = {}): Intl.DateTimeFormat {\n // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.\n // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.\n if (typeof options.hour12 === 'boolean' && hasBuggyHour12Behavior()) {\n options = {...options};\n let pref = hour12Preferences[String(options.hour12)][locale.split('-')[0]];\n let defaultHourCycle = options.hour12 ? 'h12' : 'h23';\n options.hourCycle = pref ?? defaultHourCycle;\n delete options.hour12;\n }\n\n let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n if (formatterCache.has(cacheKey)) {\n return formatterCache.get(cacheKey)!;\n }\n\n let numberFormatter = new Intl.DateTimeFormat(locale, options);\n formatterCache.set(cacheKey, numberFormatter);\n return numberFormatter;\n}\n\nlet _hasBuggyHour12Behavior: boolean | null = null;\nfunction hasBuggyHour12Behavior() {\n if (_hasBuggyHour12Behavior == null) {\n _hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n hour12: false\n }).format(new Date(2020, 2, 3, 0)) === '24';\n }\n\n return _hasBuggyHour12Behavior;\n}\n\nlet _hasBuggyResolvedHourCycle: boolean | null = null;\nfunction hasBuggyResolvedHourCycle() {\n if (_hasBuggyResolvedHourCycle == null) {\n _hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';\n }\n\n return _hasBuggyResolvedHourCycle;\n}\n\nfunction getResolvedHourCycle(locale: string, options: Intl.DateTimeFormatOptions) {\n if (!options.timeStyle && !options.hour) {\n return undefined;\n }\n\n // Work around buggy results in resolved hourCycle and hour12 options in WebKit.\n // Format the minimum possible hour and maximum possible hour in a day and parse the results.\n locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');\n locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';\n let formatter = getCachedDateFormatter(locale, {\n ...options,\n timeZone: undefined // use local timezone\n });\n\n let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value, 10);\n let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value, 10);\n\n if (min === 0 && max === 23) {\n return 'h23';\n }\n\n if (min === 24 && max === 23) {\n return 'h24';\n }\n\n if (min === 0 && max === 11) {\n return 'h11';\n }\n\n if (min === 12 && max === 11) {\n return 'h12';\n }\n\n throw new Error('Unexpected hour cycle result');\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|