@internationalized/date 3.12.0 → 3.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/index.cjs +113 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.js +45 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +45 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/private/CalendarDate.cjs +272 -0
  8. package/dist/private/CalendarDate.cjs.map +1 -0
  9. package/dist/private/CalendarDate.js +282 -0
  10. package/dist/private/CalendarDate.js.map +1 -0
  11. package/dist/private/CalendarDate.mjs +264 -0
  12. package/dist/private/CalendarDate.mjs.map +1 -0
  13. package/dist/{DateFormatter.main.js → private/DateFormatter.cjs} +31 -28
  14. package/dist/private/DateFormatter.cjs.map +1 -0
  15. package/dist/{DateFormatter.module.js → private/DateFormatter.js} +27 -24
  16. package/dist/private/DateFormatter.js.map +1 -0
  17. package/dist/{DateFormatter.mjs → private/DateFormatter.mjs} +31 -28
  18. package/dist/private/DateFormatter.mjs.map +1 -0
  19. package/dist/{BuddhistCalendar.main.js → private/calendars/BuddhistCalendar.cjs} +13 -13
  20. package/dist/{BuddhistCalendar.main.js.map → private/calendars/BuddhistCalendar.cjs.map} +1 -1
  21. package/dist/{BuddhistCalendar.module.js → private/calendars/BuddhistCalendar.js} +13 -13
  22. package/dist/{BuddhistCalendar.module.js.map → private/calendars/BuddhistCalendar.js.map} +1 -1
  23. package/dist/{BuddhistCalendar.mjs → private/calendars/BuddhistCalendar.mjs} +13 -13
  24. package/dist/private/calendars/BuddhistCalendar.mjs.map +1 -0
  25. package/dist/{EthiopicCalendar.main.js → private/calendars/EthiopicCalendar.cjs} +37 -37
  26. package/dist/private/calendars/EthiopicCalendar.cjs.map +1 -0
  27. package/dist/{EthiopicCalendar.module.js → private/calendars/EthiopicCalendar.js} +35 -35
  28. package/dist/private/calendars/EthiopicCalendar.js.map +1 -0
  29. package/dist/{EthiopicCalendar.mjs → private/calendars/EthiopicCalendar.mjs} +35 -35
  30. package/dist/private/calendars/EthiopicCalendar.mjs.map +1 -0
  31. package/dist/{GregorianCalendar.main.js → private/calendars/GregorianCalendar.cjs} +31 -31
  32. package/dist/private/calendars/GregorianCalendar.cjs.map +1 -0
  33. package/dist/{GregorianCalendar.module.js → private/calendars/GregorianCalendar.js} +27 -27
  34. package/dist/private/calendars/GregorianCalendar.js.map +1 -0
  35. package/dist/{GregorianCalendar.mjs → private/calendars/GregorianCalendar.mjs} +27 -27
  36. package/dist/private/calendars/GregorianCalendar.mjs.map +1 -0
  37. package/dist/{HebrewCalendar.main.js → private/calendars/HebrewCalendar.cjs} +44 -44
  38. package/dist/private/calendars/HebrewCalendar.cjs.map +1 -0
  39. package/dist/{HebrewCalendar.module.js → private/calendars/HebrewCalendar.js} +44 -44
  40. package/dist/private/calendars/HebrewCalendar.js.map +1 -0
  41. package/dist/{HebrewCalendar.mjs → private/calendars/HebrewCalendar.mjs} +44 -44
  42. package/dist/private/calendars/HebrewCalendar.mjs.map +1 -0
  43. package/dist/{IndianCalendar.main.js → private/calendars/IndianCalendar.cjs} +20 -20
  44. package/dist/private/calendars/IndianCalendar.cjs.map +1 -0
  45. package/dist/{IndianCalendar.module.js → private/calendars/IndianCalendar.js} +20 -20
  46. package/dist/private/calendars/IndianCalendar.js.map +1 -0
  47. package/dist/{IndianCalendar.mjs → private/calendars/IndianCalendar.mjs} +20 -20
  48. package/dist/private/calendars/IndianCalendar.mjs.map +1 -0
  49. package/dist/private/calendars/IslamicCalendar.cjs +168 -0
  50. package/dist/private/calendars/IslamicCalendar.cjs.map +1 -0
  51. package/dist/private/calendars/IslamicCalendar.js +161 -0
  52. package/dist/private/calendars/IslamicCalendar.js.map +1 -0
  53. package/dist/private/calendars/IslamicCalendar.mjs +161 -0
  54. package/dist/private/calendars/IslamicCalendar.mjs.map +1 -0
  55. package/dist/{JapaneseCalendar.main.js → private/calendars/JapaneseCalendar.cjs} +37 -37
  56. package/dist/private/calendars/JapaneseCalendar.cjs.map +1 -0
  57. package/dist/{JapaneseCalendar.module.js → private/calendars/JapaneseCalendar.js} +37 -37
  58. package/dist/private/calendars/JapaneseCalendar.js.map +1 -0
  59. package/dist/{JapaneseCalendar.mjs → private/calendars/JapaneseCalendar.mjs} +37 -37
  60. package/dist/private/calendars/JapaneseCalendar.mjs.map +1 -0
  61. package/dist/{PersianCalendar.main.js → private/calendars/PersianCalendar.cjs} +13 -13
  62. package/dist/private/calendars/PersianCalendar.cjs.map +1 -0
  63. package/dist/{PersianCalendar.module.js → private/calendars/PersianCalendar.js} +13 -13
  64. package/dist/private/calendars/PersianCalendar.js.map +1 -0
  65. package/dist/{PersianCalendar.mjs → private/calendars/PersianCalendar.mjs} +13 -13
  66. package/dist/private/calendars/PersianCalendar.mjs.map +1 -0
  67. package/dist/{TaiwanCalendar.main.js → private/calendars/TaiwanCalendar.cjs} +20 -20
  68. package/dist/{TaiwanCalendar.main.js.map → private/calendars/TaiwanCalendar.cjs.map} +1 -1
  69. package/dist/private/calendars/TaiwanCalendar.js +75 -0
  70. package/dist/{TaiwanCalendar.module.js.map → private/calendars/TaiwanCalendar.js.map} +1 -1
  71. package/dist/{TaiwanCalendar.mjs → private/calendars/TaiwanCalendar.mjs} +20 -20
  72. package/dist/private/calendars/TaiwanCalendar.mjs.map +1 -0
  73. package/dist/{conversion.main.js → private/conversion.cjs} +85 -85
  74. package/dist/private/conversion.cjs.map +1 -0
  75. package/dist/{conversion.module.js → private/conversion.js} +71 -71
  76. package/dist/private/conversion.js.map +1 -0
  77. package/dist/{conversion.mjs → private/conversion.mjs} +71 -71
  78. package/dist/private/conversion.mjs.map +1 -0
  79. package/dist/private/createCalendar.cjs +69 -0
  80. package/dist/private/createCalendar.cjs.map +1 -0
  81. package/dist/private/createCalendar.js +64 -0
  82. package/dist/private/createCalendar.js.map +1 -0
  83. package/dist/private/createCalendar.mjs +64 -0
  84. package/dist/private/createCalendar.mjs.map +1 -0
  85. package/dist/{manipulation.main.js → private/manipulation.cjs} +106 -109
  86. package/dist/private/manipulation.cjs.map +1 -0
  87. package/dist/{manipulation.mjs → private/manipulation.js} +88 -88
  88. package/dist/private/manipulation.js.map +1 -0
  89. package/dist/{manipulation.module.js → private/manipulation.mjs} +93 -96
  90. package/dist/private/manipulation.mjs.map +1 -0
  91. package/dist/private/queries.cjs +359 -0
  92. package/dist/private/queries.cjs.map +1 -0
  93. package/dist/private/queries.js +326 -0
  94. package/dist/private/queries.js.map +1 -0
  95. package/dist/private/queries.mjs +324 -0
  96. package/dist/private/queries.mjs.map +1 -0
  97. package/dist/private/string.cjs +181 -0
  98. package/dist/private/string.cjs.map +1 -0
  99. package/dist/{string.mjs → private/string.js} +64 -64
  100. package/dist/private/string.js.map +1 -0
  101. package/dist/private/string.mjs +166 -0
  102. package/dist/private/string.mjs.map +1 -0
  103. package/dist/{utils.main.js → private/utils.cjs} +3 -3
  104. package/dist/{utils.main.js.map → private/utils.cjs.map} +1 -1
  105. package/dist/{utils.module.js → private/utils.js} +3 -3
  106. package/dist/{utils.module.js.map → private/utils.js.map} +1 -1
  107. package/dist/{utils.mjs → private/utils.mjs} +3 -3
  108. package/dist/private/utils.mjs.map +1 -0
  109. package/dist/{weekStartData.main.js → private/weekStartData.cjs} +3 -3
  110. package/dist/{weekStartData.main.js.map → private/weekStartData.cjs.map} +1 -1
  111. package/dist/{weekStartData.module.js → private/weekStartData.js} +3 -3
  112. package/dist/{weekStartData.module.js.map → private/weekStartData.js.map} +1 -1
  113. package/dist/{weekStartData.mjs → private/weekStartData.mjs} +3 -3
  114. package/dist/private/weekStartData.mjs.map +1 -0
  115. package/dist/types/src/CalendarDate.d.ts +207 -0
  116. package/dist/types/src/DateFormatter.d.ts +24 -0
  117. package/dist/types/src/calendars/BuddhistCalendar.d.ts +16 -0
  118. package/dist/types/src/calendars/EthiopicCalendar.d.ts +45 -0
  119. package/dist/types/src/calendars/GregorianCalendar.d.ts +26 -0
  120. package/dist/types/src/calendars/HebrewCalendar.d.ts +21 -0
  121. package/dist/types/src/calendars/IndianCalendar.d.ts +17 -0
  122. package/dist/types/src/calendars/IslamicCalendar.d.ts +51 -0
  123. package/dist/types/src/calendars/JapaneseCalendar.d.ts +22 -0
  124. package/dist/types/src/calendars/PersianCalendar.d.ts +19 -0
  125. package/dist/types/src/calendars/TaiwanCalendar.d.ts +19 -0
  126. package/dist/types/src/conversion.d.ts +45 -0
  127. package/dist/types/src/createCalendar.d.ts +3 -0
  128. package/dist/types/src/index.d.ts +17 -0
  129. package/dist/types/src/manipulation.d.ts +25 -0
  130. package/dist/types/src/queries.d.ts +93 -0
  131. package/dist/types/src/string.d.ts +36 -0
  132. package/dist/types/src/types.d.ts +136 -0
  133. package/dist/types/src/utils.d.ts +4 -0
  134. package/dist/types/src/weekStartData.d.ts +97 -0
  135. package/package.json +33 -18
  136. package/src/CalendarDate.ts +215 -35
  137. package/src/DateFormatter.ts +36 -16
  138. package/src/calendars/BuddhistCalendar.ts +1 -6
  139. package/src/calendars/EthiopicCalendar.ts +6 -5
  140. package/src/calendars/GregorianCalendar.ts +11 -4
  141. package/src/calendars/HebrewCalendar.ts +8 -4
  142. package/src/calendars/IndianCalendar.ts +8 -3
  143. package/src/calendars/IslamicCalendar.ts +40 -25
  144. package/src/calendars/JapaneseCalendar.ts +18 -10
  145. package/src/calendars/PersianCalendar.ts +2 -4
  146. package/src/calendars/TaiwanCalendar.ts +2 -9
  147. package/src/conversion.ts +98 -25
  148. package/src/createCalendar.ts +10 -2
  149. package/src/index.ts +11 -2
  150. package/src/manipulation.ts +133 -30
  151. package/src/queries.ts +57 -15
  152. package/src/string.ts +52 -25
  153. package/src/types.ts +73 -51
  154. package/src/utils.ts +1 -1
  155. package/dist/CalendarDate.main.js +0 -260
  156. package/dist/CalendarDate.main.js.map +0 -1
  157. package/dist/CalendarDate.mjs +0 -252
  158. package/dist/CalendarDate.module.js +0 -252
  159. package/dist/CalendarDate.module.js.map +0 -1
  160. package/dist/DateFormatter.main.js.map +0 -1
  161. package/dist/DateFormatter.module.js.map +0 -1
  162. package/dist/EthiopicCalendar.main.js.map +0 -1
  163. package/dist/EthiopicCalendar.module.js.map +0 -1
  164. package/dist/GregorianCalendar.main.js.map +0 -1
  165. package/dist/GregorianCalendar.module.js.map +0 -1
  166. package/dist/HebrewCalendar.main.js.map +0 -1
  167. package/dist/HebrewCalendar.module.js.map +0 -1
  168. package/dist/IndianCalendar.main.js.map +0 -1
  169. package/dist/IndianCalendar.module.js.map +0 -1
  170. package/dist/IslamicCalendar.main.js +0 -168
  171. package/dist/IslamicCalendar.main.js.map +0 -1
  172. package/dist/IslamicCalendar.mjs +0 -161
  173. package/dist/IslamicCalendar.module.js +0 -161
  174. package/dist/IslamicCalendar.module.js.map +0 -1
  175. package/dist/JapaneseCalendar.main.js.map +0 -1
  176. package/dist/JapaneseCalendar.module.js.map +0 -1
  177. package/dist/PersianCalendar.main.js.map +0 -1
  178. package/dist/PersianCalendar.module.js.map +0 -1
  179. package/dist/TaiwanCalendar.module.js +0 -75
  180. package/dist/conversion.main.js.map +0 -1
  181. package/dist/conversion.module.js.map +0 -1
  182. package/dist/createCalendar.main.js +0 -69
  183. package/dist/createCalendar.main.js.map +0 -1
  184. package/dist/createCalendar.mjs +0 -64
  185. package/dist/createCalendar.module.js +0 -64
  186. package/dist/createCalendar.module.js.map +0 -1
  187. package/dist/import.mjs +0 -45
  188. package/dist/main.js +0 -113
  189. package/dist/main.js.map +0 -1
  190. package/dist/manipulation.main.js.map +0 -1
  191. package/dist/manipulation.module.js.map +0 -1
  192. package/dist/module.js +0 -45
  193. package/dist/module.js.map +0 -1
  194. package/dist/queries.main.js +0 -361
  195. package/dist/queries.main.js.map +0 -1
  196. package/dist/queries.mjs +0 -326
  197. package/dist/queries.module.js +0 -326
  198. package/dist/queries.module.js.map +0 -1
  199. package/dist/string.main.js +0 -190
  200. package/dist/string.main.js.map +0 -1
  201. package/dist/string.module.js +0 -175
  202. package/dist/string.module.js.map +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,GAAG,EACR,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW;IAGtB;IAEA,uEAAuE,GACvE,IAAI,QAA0B,EAAiB;QAC7C,OAAO,CAAA,GAAA,yCAAO,EAAE,IAAI,EAAE;IACxB;IAEA,8EAA8E,GAC9E,SAAS,QAA0B,EAAiB;QAClD,OAAO,CAAA,GAAA,yCAAY,EAAE,IAAI,EAAE;IAC7B;IAEA;;;GAGC,GACD,IAAI,MAA+B,EAAE,cAA+B,EAAiB;QACnF,OAAO,CAAA,GAAA,yCAAO,EAAE,IAAI,EAAE,QAAQ;IAChC;IAEA;;;GAGC,GACD,MAAM,KAA4B,EAAE,MAAc,EAAE,OAA0B,EAAiB;QAC7F,OAAO,CAAA,GAAA,yCAAS,EAAE,IAAI,EAAE,OAAO,QAAQ;IACzC;IAEA,0DAA0D,GAC1D,SAAe;QACb,OAAO,CAAA,GAAA,wCAAU,EAAE,IAAI;IACzB;IAEA;;;GAGC,GACD,WAAmB;QACjB,OAAO,CAAA,GAAA,yCAAoB,EAAE,IAAI;IACnC;IAEA,8DAA8D,GAC9D,mBAA2B;QACzB,OAAO,IAAI,CAAC,MAAM,GAAG,WAAW;IAClC;IAEA;;;GAGC,GACD,QAAQ,CAAkD,EAAU;QAClE,6BAA6B;QAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,OAAO,KAAK,CAAA,GAAA,yCAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAC7E;AACF","sources":["packages/@internationalized/date/src/CalendarDate.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\nimport {\n add,\n addTime,\n addZoned,\n constrain,\n constrainTime,\n cycleDate,\n cycleTime,\n cycleZoned,\n set,\n setTime,\n setZoned,\n subtract,\n subtractTime,\n subtractZoned\n} from './manipulation';\nimport {\n AnyCalendarDate,\n AnyTime,\n Calendar,\n CycleOptions,\n CycleTimeOptions,\n DateDuration,\n DateField,\n DateFields,\n DateTimeDuration,\n Disambiguation,\n TimeDuration,\n TimeField,\n TimeFields\n} 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\nexport type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\nfunction shiftArgs(args: any[]) {\n let calendar: Calendar = typeof args[0] === 'object' ? args.shift() : 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 /**\n * Returns a new `CalendarDate` with the given fields set to the provided values. Other fields\n * will be constrained accordingly.\n */\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 /**\n * Converts the date to a native JavaScript Date object, with the time set to midnight in the\n * given time zone.\n */\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 /**\n * Compares this date with another. A negative result indicates that this date is before the given\n * one, and a positive date indicates that it is after.\n */\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(hour: number = 0, minute: number = 0, second: number = 0, millisecond: number = 0) {\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): Time {\n return addTime(this, duration);\n }\n\n /** Returns a new `Time` with the given duration subtracted from it. */\n subtract(duration: TimeDuration): Time {\n return subtractTime(this, duration);\n }\n\n /**\n * Returns a new `Time` with the given fields set to the provided values. Other fields will be\n * constrained accordingly.\n */\n set(fields: TimeFields): Time {\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): Time {\n return cycleTime(this, field, amount, options);\n }\n\n /** Converts the time to an ISO 8601 formatted string. */\n toString(): string {\n return timeToString(this);\n }\n\n /**\n * Compares this time with another. A negative result indicates that this time is before the given\n * one, and a positive time indicates that it is after.\n */\n compare(b: AnyTime): number {\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(\n year: number,\n month: number,\n day: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n era: string,\n year: number,\n month: number,\n day: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n calendar: Calendar,\n year: number,\n month: number,\n day: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n calendar: Calendar,\n era: string,\n year: number,\n month: number,\n day: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\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(\n this.calendar,\n this.era,\n this.year,\n this.month,\n this.day,\n this.hour,\n this.minute,\n this.second,\n this.millisecond\n );\n } else {\n return new CalendarDateTime(\n this.calendar,\n this.year,\n this.month,\n this.day,\n this.hour,\n this.minute,\n this.second,\n this.millisecond\n );\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 /**\n * Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields\n * will be constrained accordingly.\n */\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(\n field: DateField | TimeField,\n amount: number,\n options?: CycleTimeOptions\n ): 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 /**\n * Compares this date with another. A negative result indicates that this date is before the given\n * one, and a positive date indicates that it is after.\n */\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(\n year: number,\n month: number,\n day: number,\n timeZone: string,\n offset: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n era: string,\n year: number,\n month: number,\n day: number,\n timeZone: string,\n offset: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n calendar: Calendar,\n year: number,\n month: number,\n day: number,\n timeZone: string,\n offset: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\n constructor(\n calendar: Calendar,\n era: string,\n year: number,\n month: number,\n day: number,\n timeZone: string,\n offset: number,\n hour?: number,\n minute?: number,\n second?: number,\n millisecond?: number\n );\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(\n this.calendar,\n this.era,\n this.year,\n this.month,\n this.day,\n this.timeZone,\n this.offset,\n this.hour,\n this.minute,\n this.second,\n this.millisecond\n );\n } else {\n return new ZonedDateTime(\n this.calendar,\n this.year,\n this.month,\n this.day,\n this.timeZone,\n this.offset,\n this.hour,\n this.minute,\n this.second,\n this.millisecond\n );\n }\n }\n\n /** Returns a new `ZonedDateTime` with the given duration added to it. */\n add(duration: DateTimeDuration): ZonedDateTime {\n return addZoned(this, duration);\n }\n\n /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */\n subtract(duration: DateTimeDuration): ZonedDateTime {\n return subtractZoned(this, duration);\n }\n\n /**\n * Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields\n * will be constrained accordingly.\n */\n set(fields: DateFields & TimeFields, disambiguation?: Disambiguation): ZonedDateTime {\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): ZonedDateTime {\n return cycleZoned(this, field, amount, options);\n }\n\n /** Converts the date to a native JavaScript Date object. */\n toDate(): Date {\n return zonedToDate(this);\n }\n\n /**\n * Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone\n * identifier.\n */\n toString(): string {\n return zonedDateTimeToString(this);\n }\n\n /** Converts the date to an ISO 8601 formatted string in UTC. */\n toAbsoluteString(): string {\n return this.toDate().toISOString();\n }\n\n /**\n * Compares this date with another. A negative result indicates that this date is before the given\n * one, and a positive date indicates that it is after.\n */\n compare(b: CalendarDate | CalendarDateTime | ZonedDateTime): number {\n // TODO: Is this a bad idea??\n return this.toDate().getTime() - toZoned(b, this.timeZone).toDate().getTime();\n }\n}\n"],"names":[],"version":3,"file":"CalendarDate.mjs.map"}
@@ -3,7 +3,7 @@ function $parcel$export(e, n, v, s) {
3
3
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
4
  }
5
5
 
6
- $parcel$export(module.exports, "DateFormatter", () => $8f23a04ae90a588b$export$ad991b66133851cf);
6
+ $parcel$export(module.exports, "DateFormatter", function () { return $10afcf45c4831ff7$export$ad991b66133851cf; });
7
7
  /*
8
8
  * Copyright 2020 Adobe. All rights reserved.
9
9
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -14,9 +14,16 @@ $parcel$export(module.exports, "DateFormatter", () => $8f23a04ae90a588b$export$a
14
14
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
15
  * OF ANY KIND, either express or implied. See the License for the specific language
16
16
  * governing permissions and limitations under the License.
17
- */ let $8f23a04ae90a588b$var$formatterCache = new Map();
18
- class $8f23a04ae90a588b$export$ad991b66133851cf {
19
- /** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
17
+ */ let $10afcf45c4831ff7$var$formatterCache = new Map();
18
+ class $10afcf45c4831ff7$export$ad991b66133851cf {
19
+ constructor(locale, options = {}){
20
+ this.formatter = $10afcf45c4831ff7$var$getCachedDateFormatter(locale, options);
21
+ this.options = options;
22
+ }
23
+ /**
24
+ * Formats a date as a string according to the locale and format options passed to the
25
+ * constructor.
26
+ */ format(value) {
20
27
  return this.formatter.format(value);
21
28
  }
22
29
  /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
@@ -55,8 +62,8 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
55
62
  }
56
63
  /** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
57
64
  let resolvedOptions = this.formatter.resolvedOptions();
58
- if ($8f23a04ae90a588b$var$hasBuggyResolvedHourCycle()) {
59
- if (!this.resolvedHourCycle) this.resolvedHourCycle = $8f23a04ae90a588b$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
65
+ if ($10afcf45c4831ff7$var$hasBuggyResolvedHourCycle()) {
66
+ if (!this.resolvedHourCycle) this.resolvedHourCycle = $10afcf45c4831ff7$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
60
67
  resolvedOptions.hourCycle = this.resolvedHourCycle;
61
68
  resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
62
69
  }
@@ -65,10 +72,6 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
65
72
  if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
66
73
  return resolvedOptions;
67
74
  }
68
- constructor(locale, options = {}){
69
- this.formatter = $8f23a04ae90a588b$var$getCachedDateFormatter(locale, options);
70
- this.options = options;
71
- }
72
75
  }
73
76
  // There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
74
77
  // - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
@@ -80,7 +83,7 @@ class $8f23a04ae90a588b$export$ad991b66133851cf {
80
83
  // [2] https://github.com/tc39/ecma402/issues/402
81
84
  // [3] https://bugs.webkit.org/show_bug.cgi?id=229313
82
85
  // https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
83
- const $8f23a04ae90a588b$var$hour12Preferences = {
86
+ const $10afcf45c4831ff7$var$hour12Preferences = {
84
87
  true: {
85
88
  // Only Japanese uses the h11 style for 12 hour time. All others use h12.
86
89
  ja: 'h11'
@@ -88,47 +91,47 @@ const $8f23a04ae90a588b$var$hour12Preferences = {
88
91
  false: {
89
92
  }
90
93
  };
91
- function $8f23a04ae90a588b$var$getCachedDateFormatter(locale, options = {}) {
94
+ function $10afcf45c4831ff7$var$getCachedDateFormatter(locale, options = {}) {
92
95
  // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
93
96
  // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
94
- if (typeof options.hour12 === 'boolean' && $8f23a04ae90a588b$var$hasBuggyHour12Behavior()) {
97
+ if (typeof options.hour12 === 'boolean' && $10afcf45c4831ff7$var$hasBuggyHour12Behavior()) {
95
98
  options = {
96
99
  ...options
97
100
  };
98
- let pref = $8f23a04ae90a588b$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
101
+ let pref = $10afcf45c4831ff7$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
99
102
  let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
100
- options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
103
+ options.hourCycle = pref ?? defaultHourCycle;
101
104
  delete options.hour12;
102
105
  }
103
106
  let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
104
- if ($8f23a04ae90a588b$var$formatterCache.has(cacheKey)) return $8f23a04ae90a588b$var$formatterCache.get(cacheKey);
107
+ if ($10afcf45c4831ff7$var$formatterCache.has(cacheKey)) return $10afcf45c4831ff7$var$formatterCache.get(cacheKey);
105
108
  let numberFormatter = new Intl.DateTimeFormat(locale, options);
106
- $8f23a04ae90a588b$var$formatterCache.set(cacheKey, numberFormatter);
109
+ $10afcf45c4831ff7$var$formatterCache.set(cacheKey, numberFormatter);
107
110
  return numberFormatter;
108
111
  }
109
- let $8f23a04ae90a588b$var$_hasBuggyHour12Behavior = null;
110
- function $8f23a04ae90a588b$var$hasBuggyHour12Behavior() {
111
- if ($8f23a04ae90a588b$var$_hasBuggyHour12Behavior == null) $8f23a04ae90a588b$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
112
+ let $10afcf45c4831ff7$var$_hasBuggyHour12Behavior = null;
113
+ function $10afcf45c4831ff7$var$hasBuggyHour12Behavior() {
114
+ if ($10afcf45c4831ff7$var$_hasBuggyHour12Behavior == null) $10afcf45c4831ff7$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
112
115
  hour: 'numeric',
113
116
  hour12: false
114
117
  }).format(new Date(2020, 2, 3, 0)) === '24';
115
- return $8f23a04ae90a588b$var$_hasBuggyHour12Behavior;
118
+ return $10afcf45c4831ff7$var$_hasBuggyHour12Behavior;
116
119
  }
117
- let $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle = null;
118
- function $8f23a04ae90a588b$var$hasBuggyResolvedHourCycle() {
119
- if ($8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle == null) $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
120
+ let $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle = null;
121
+ function $10afcf45c4831ff7$var$hasBuggyResolvedHourCycle() {
122
+ if ($10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle == null) $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
120
123
  hour: 'numeric',
121
124
  hour12: false
122
125
  }).resolvedOptions().hourCycle === 'h12';
123
- return $8f23a04ae90a588b$var$_hasBuggyResolvedHourCycle;
126
+ return $10afcf45c4831ff7$var$_hasBuggyResolvedHourCycle;
124
127
  }
125
- function $8f23a04ae90a588b$var$getResolvedHourCycle(locale, options) {
128
+ function $10afcf45c4831ff7$var$getResolvedHourCycle(locale, options) {
126
129
  if (!options.timeStyle && !options.hour) return undefined;
127
130
  // Work around buggy results in resolved hourCycle and hour12 options in WebKit.
128
131
  // Format the minimum possible hour and maximum possible hour in a day and parse the results.
129
132
  locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
130
133
  locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
131
- let formatter = $8f23a04ae90a588b$var$getCachedDateFormatter(locale, {
134
+ let formatter = $10afcf45c4831ff7$var$getCachedDateFormatter(locale, {
132
135
  ...options,
133
136
  timeZone: undefined // use local timezone
134
137
  });
@@ -142,4 +145,4 @@ function $8f23a04ae90a588b$var$getResolvedHourCycle(locale, options) {
142
145
  }
143
146
 
144
147
 
145
- //# sourceMappingURL=DateFormatter.main.js.map
148
+ //# sourceMappingURL=DateFormatter.cjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAKX,YAAY,MAAc,EAAE,UAAsC,CAAC,CAAC,CAAE;QACpE,IAAI,CAAC,SAAS,GAAG,6CAAuB,QAAQ;QAChD,IAAI,CAAC,OAAO,GAAG;IACjB;IAEA;;;GAGC,GACD,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO;QAG3C,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,wCAAwC;QACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,UAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,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AAC,QAAQ,SAAS,IAAI,CAAC,QAAQ,IAAI,EACrC,OAAO;IAGT,gFAAgF;IAChF,6FAA6F;IAC7F,SAAS,OAAO,OAAO,CAAC,0BAA0B;IAClD,UAAU,AAAC,CAAA,OAAO,QAAQ,CAAC,SAAS,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACpF;IAEF,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACrF;IAGF,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/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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\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 /**\n * Formats a date as a string according to the locale and format options passed to the\n * constructor.\n */\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(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\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(\n locale: string,\n options: Intl.DateTimeFormatOptions = {}\n): 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 =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\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 =\n 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 =\n new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().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(\n formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value,\n 10\n );\n let max = parseInt(\n formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value,\n 10\n );\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":"DateFormatter.cjs.map"}
@@ -8,9 +8,12 @@
8
8
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
- */ let $fb18d541ea1ad717$var$formatterCache = new Map();
12
- class $fb18d541ea1ad717$export$ad991b66133851cf {
13
- /** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
11
+ */ let $f48a4033af8eadca$var$formatterCache = new Map();
12
+ class $f48a4033af8eadca$export$ad991b66133851cf {
13
+ /**
14
+ * Formats a date as a string according to the locale and format options passed to the
15
+ * constructor.
16
+ */ format(value) {
14
17
  return this.formatter.format(value);
15
18
  }
16
19
  /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
@@ -49,8 +52,8 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
49
52
  }
50
53
  /** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
51
54
  let resolvedOptions = this.formatter.resolvedOptions();
52
- if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
53
- if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
55
+ if ($f48a4033af8eadca$var$hasBuggyResolvedHourCycle()) {
56
+ if (!this.resolvedHourCycle) this.resolvedHourCycle = $f48a4033af8eadca$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
54
57
  resolvedOptions.hourCycle = this.resolvedHourCycle;
55
58
  resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
56
59
  }
@@ -60,7 +63,7 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
60
63
  return resolvedOptions;
61
64
  }
62
65
  constructor(locale, options = {}){
63
- this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
66
+ this.formatter = $f48a4033af8eadca$var$getCachedDateFormatter(locale, options);
64
67
  this.options = options;
65
68
  }
66
69
  }
@@ -74,7 +77,7 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
74
77
  // [2] https://github.com/tc39/ecma402/issues/402
75
78
  // [3] https://bugs.webkit.org/show_bug.cgi?id=229313
76
79
  // https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
77
- const $fb18d541ea1ad717$var$hour12Preferences = {
80
+ const $f48a4033af8eadca$var$hour12Preferences = {
78
81
  true: {
79
82
  // Only Japanese uses the h11 style for 12 hour time. All others use h12.
80
83
  ja: 'h11'
@@ -82,47 +85,47 @@ const $fb18d541ea1ad717$var$hour12Preferences = {
82
85
  false: {
83
86
  }
84
87
  };
85
- function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
88
+ function $f48a4033af8eadca$var$getCachedDateFormatter(locale, options = {}) {
86
89
  // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
87
90
  // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
88
- if (typeof options.hour12 === 'boolean' && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
91
+ if (typeof options.hour12 === 'boolean' && $f48a4033af8eadca$var$hasBuggyHour12Behavior()) {
89
92
  options = {
90
93
  ...options
91
94
  };
92
- let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
95
+ let pref = $f48a4033af8eadca$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
93
96
  let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
94
97
  options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
95
98
  delete options.hour12;
96
99
  }
97
100
  let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
98
- if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
101
+ if ($f48a4033af8eadca$var$formatterCache.has(cacheKey)) return $f48a4033af8eadca$var$formatterCache.get(cacheKey);
99
102
  let numberFormatter = new Intl.DateTimeFormat(locale, options);
100
- $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
103
+ $f48a4033af8eadca$var$formatterCache.set(cacheKey, numberFormatter);
101
104
  return numberFormatter;
102
105
  }
103
- let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
104
- function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
105
- if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
106
+ let $f48a4033af8eadca$var$_hasBuggyHour12Behavior = null;
107
+ function $f48a4033af8eadca$var$hasBuggyHour12Behavior() {
108
+ if ($f48a4033af8eadca$var$_hasBuggyHour12Behavior == null) $f48a4033af8eadca$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
106
109
  hour: 'numeric',
107
110
  hour12: false
108
111
  }).format(new Date(2020, 2, 3, 0)) === '24';
109
- return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
112
+ return $f48a4033af8eadca$var$_hasBuggyHour12Behavior;
110
113
  }
111
- let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
112
- function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
113
- if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
114
+ let $f48a4033af8eadca$var$_hasBuggyResolvedHourCycle = null;
115
+ function $f48a4033af8eadca$var$hasBuggyResolvedHourCycle() {
116
+ if ($f48a4033af8eadca$var$_hasBuggyResolvedHourCycle == null) $f48a4033af8eadca$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
114
117
  hour: 'numeric',
115
118
  hour12: false
116
119
  }).resolvedOptions().hourCycle === 'h12';
117
- return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
120
+ return $f48a4033af8eadca$var$_hasBuggyResolvedHourCycle;
118
121
  }
119
- function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
122
+ function $f48a4033af8eadca$var$getResolvedHourCycle(locale, options) {
120
123
  if (!options.timeStyle && !options.hour) return undefined;
121
124
  // Work around buggy results in resolved hourCycle and hour12 options in WebKit.
122
125
  // Format the minimum possible hour and maximum possible hour in a day and parse the results.
123
126
  locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
124
127
  locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
125
- let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
128
+ let formatter = $f48a4033af8eadca$var$getCachedDateFormatter(locale, {
126
129
  ...options,
127
130
  timeZone: undefined // use local timezone
128
131
  });
@@ -136,5 +139,5 @@ function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
136
139
  }
137
140
 
138
141
 
139
- export {$fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
140
- //# sourceMappingURL=DateFormatter.module.js.map
142
+ export {$f48a4033af8eadca$export$ad991b66133851cf as DateFormatter};
143
+ //# sourceMappingURL=DateFormatter.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAUX;;;GAGC,GACD,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC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7B,gDACE,IAAI,KAAK,cAAc,CAAC,SAAS;QAC/B,MAAM;QACN,QAAQ;IACV,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,QAAQ;IAG3C,OAAO;AACT;AAEA,IAAI,mDAA6C;AACjD,SAAS;IACP,IAAI,oDAA8B,MAChC,mDACE,IAAI,KAAK,cAAc,CAAC,MAAM;QAC5B,MAAM;QACN,QAAQ;IACV,GAAG,eAAe,GAAG,SAAS,KAAK;IAGvC,OAAO;AACT;AAEA,SAAS,2CAAqB,MAAc,EAAE,OAAmC;IAC/E,IAAI,CAAC,QAAQ,SAAS,IAAI,CAAC,QAAQ,IAAI,EACrC,OAAO;IAGT,gFAAgF;IAChF,6FAA6F;IAC7F,SAAS,OAAO,OAAO,CAAC,0BAA0B;IAClD,UAAU,AAAC,CAAA,OAAO,QAAQ,CAAC,SAAS,KAAK,IAAG,IAAK;IACjD,IAAI,YAAY,6CAAuB,QAAQ;QAC7C,GAAG,OAAO;QACV,UAAU,UAAU,qBAAqB;IAC3C;IAEA,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACpF;IAEF,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACrF;IAGF,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/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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\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 /**\n * Formats a date as a string according to the locale and format options passed to the\n * constructor.\n */\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(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\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(\n locale: string,\n options: Intl.DateTimeFormatOptions = {}\n): 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 =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\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 =\n 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 =\n new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().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(\n formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value,\n 10\n );\n let max = parseInt(\n formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value,\n 10\n );\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":"DateFormatter.js.map"}
@@ -8,9 +8,16 @@
8
8
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
- */ let $fb18d541ea1ad717$var$formatterCache = new Map();
12
- class $fb18d541ea1ad717$export$ad991b66133851cf {
13
- /** Formats a date as a string according to the locale and format options passed to the constructor. */ format(value) {
11
+ */ let $12a3c853105e5a70$var$formatterCache = new Map();
12
+ class $12a3c853105e5a70$export$ad991b66133851cf {
13
+ constructor(locale, options = {}){
14
+ this.formatter = $12a3c853105e5a70$var$getCachedDateFormatter(locale, options);
15
+ this.options = options;
16
+ }
17
+ /**
18
+ * Formats a date as a string according to the locale and format options passed to the
19
+ * constructor.
20
+ */ format(value) {
14
21
  return this.formatter.format(value);
15
22
  }
16
23
  /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(value) {
@@ -49,8 +56,8 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
49
56
  }
50
57
  /** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() {
51
58
  let resolvedOptions = this.formatter.resolvedOptions();
52
- if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
53
- if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
59
+ if ($12a3c853105e5a70$var$hasBuggyResolvedHourCycle()) {
60
+ if (!this.resolvedHourCycle) this.resolvedHourCycle = $12a3c853105e5a70$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
54
61
  resolvedOptions.hourCycle = this.resolvedHourCycle;
55
62
  resolvedOptions.hour12 = this.resolvedHourCycle === 'h11' || this.resolvedHourCycle === 'h12';
56
63
  }
@@ -59,10 +66,6 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
59
66
  if (resolvedOptions.calendar === 'ethiopic-amete-alem') resolvedOptions.calendar = 'ethioaa';
60
67
  return resolvedOptions;
61
68
  }
62
- constructor(locale, options = {}){
63
- this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
64
- this.options = options;
65
- }
66
69
  }
67
70
  // There are multiple bugs involving the hour12 and hourCycle options in various browser engines.
68
71
  // - Chrome [1] (and the ECMA 402 spec [2]) resolve hour12: false in English and other locales to h24 (24:00 - 23:59)
@@ -74,7 +77,7 @@ class $fb18d541ea1ad717$export$ad991b66133851cf {
74
77
  // [2] https://github.com/tc39/ecma402/issues/402
75
78
  // [3] https://bugs.webkit.org/show_bug.cgi?id=229313
76
79
  // https://github.com/unicode-org/cldr/blob/018b55eff7ceb389c7e3fc44e2f657eae3b10b38/common/supplemental/supplementalData.xml#L4774-L4802
77
- const $fb18d541ea1ad717$var$hour12Preferences = {
80
+ const $12a3c853105e5a70$var$hour12Preferences = {
78
81
  true: {
79
82
  // Only Japanese uses the h11 style for 12 hour time. All others use h12.
80
83
  ja: 'h11'
@@ -82,47 +85,47 @@ const $fb18d541ea1ad717$var$hour12Preferences = {
82
85
  false: {
83
86
  }
84
87
  };
85
- function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
88
+ function $12a3c853105e5a70$var$getCachedDateFormatter(locale, options = {}) {
86
89
  // Work around buggy hour12 behavior in Chrome / ECMA 402 spec by using hourCycle instead.
87
90
  // Only apply the workaround if the issue is detected, because the hourCycle option is buggy in Safari.
88
- if (typeof options.hour12 === 'boolean' && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
91
+ if (typeof options.hour12 === 'boolean' && $12a3c853105e5a70$var$hasBuggyHour12Behavior()) {
89
92
  options = {
90
93
  ...options
91
94
  };
92
- let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
95
+ let pref = $12a3c853105e5a70$var$hour12Preferences[String(options.hour12)][locale.split('-')[0]];
93
96
  let defaultHourCycle = options.hour12 ? 'h12' : 'h23';
94
- options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
97
+ options.hourCycle = pref ?? defaultHourCycle;
95
98
  delete options.hour12;
96
99
  }
97
100
  let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
98
- if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
101
+ if ($12a3c853105e5a70$var$formatterCache.has(cacheKey)) return $12a3c853105e5a70$var$formatterCache.get(cacheKey);
99
102
  let numberFormatter = new Intl.DateTimeFormat(locale, options);
100
- $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
103
+ $12a3c853105e5a70$var$formatterCache.set(cacheKey, numberFormatter);
101
104
  return numberFormatter;
102
105
  }
103
- let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
104
- function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
105
- if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
106
+ let $12a3c853105e5a70$var$_hasBuggyHour12Behavior = null;
107
+ function $12a3c853105e5a70$var$hasBuggyHour12Behavior() {
108
+ if ($12a3c853105e5a70$var$_hasBuggyHour12Behavior == null) $12a3c853105e5a70$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat('en-US', {
106
109
  hour: 'numeric',
107
110
  hour12: false
108
111
  }).format(new Date(2020, 2, 3, 0)) === '24';
109
- return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
112
+ return $12a3c853105e5a70$var$_hasBuggyHour12Behavior;
110
113
  }
111
- let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
112
- function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
113
- if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
114
+ let $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle = null;
115
+ function $12a3c853105e5a70$var$hasBuggyResolvedHourCycle() {
116
+ if ($12a3c853105e5a70$var$_hasBuggyResolvedHourCycle == null) $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
114
117
  hour: 'numeric',
115
118
  hour12: false
116
119
  }).resolvedOptions().hourCycle === 'h12';
117
- return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
120
+ return $12a3c853105e5a70$var$_hasBuggyResolvedHourCycle;
118
121
  }
119
- function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
122
+ function $12a3c853105e5a70$var$getResolvedHourCycle(locale, options) {
120
123
  if (!options.timeStyle && !options.hour) return undefined;
121
124
  // Work around buggy results in resolved hourCycle and hour12 options in WebKit.
122
125
  // Format the minimum possible hour and maximum possible hour in a day and parse the results.
123
126
  locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, '');
124
127
  locale += (locale.includes('-u-') ? '' : '-u') + '-nu-latn';
125
- let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
128
+ let formatter = $12a3c853105e5a70$var$getCachedDateFormatter(locale, {
126
129
  ...options,
127
130
  timeZone: undefined // use local timezone
128
131
  });
@@ -136,5 +139,5 @@ function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
136
139
  }
137
140
 
138
141
 
139
- export {$fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
140
- //# sourceMappingURL=DateFormatter.module.js.map
142
+ export {$12a3c853105e5a70$export$ad991b66133851cf as DateFormatter};
143
+ //# sourceMappingURL=DateFormatter.mjs.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAED,IAAI,uCAAiB,IAAI;AAOlB,MAAM;IAKX,YAAY,MAAc,EAAE,UAAsC,CAAC,CAAC,CAAE;QACpE,IAAI,CAAC,SAAS,GAAG,6CAAuB,QAAQ;QAChD,IAAI,CAAC,OAAO,GAAG;IACjB;IAEA;;;GAGC,GACD,OAAO,KAAW,EAAU;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B;IAEA,4FAA4F,GAC5F,cAAc,KAAW,EAA6B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACtC;IAEA,sCAAsC,GACtC,YAAY,KAAW,EAAE,GAAS,EAAU;QAC1C,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,YACxC,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO;QAG3C,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,wCAAwC;QACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,UAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM;IAC1E;IAEA,+CAA+C,GAC/C,mBAAmB,KAAW,EAAE,GAAS,EAAyB;QAChE,aAAa;QACb,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,KAAK,YAC/C,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,OAAO;QAGlD,IAAI,MAAM,OACR,MAAM,IAAI,WAAW;QAGvB,IAAI,a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B;IAC3C;IAEA,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACpF;IAEF,IAAI,MAAM,SACR,UAAU,aAAa,CAAC,IAAI,KAAK,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAA,IAAK,EAAE,IAAI,KAAK,QAAS,KAAK,EACrF;IAGF,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/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\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\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 /**\n * Formats a date as a string according to the locale and format options passed to the\n * constructor.\n */\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(): Intl.ResolvedDateTimeFormatOptions {\n let resolvedOptions = this.formatter.resolvedOptions();\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(\n locale: string,\n options: Intl.DateTimeFormatOptions = {}\n): 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 =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\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 =\n 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 =\n new Intl.DateTimeFormat('fr', {\n hour: 'numeric',\n hour12: false\n }).resolvedOptions().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(\n formatter.formatToParts(new Date(2020, 2, 3, 0)).find(p => p.type === 'hour')!.value,\n 10\n );\n let max = parseInt(\n formatter.formatToParts(new Date(2020, 2, 3, 23)).find(p => p.type === 'hour')!.value,\n 10\n );\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":"DateFormatter.mjs.map"}
@@ -1,12 +1,12 @@
1
- var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");
2
- var $af14c9812fdceb33$exports = require("./GregorianCalendar.main.js");
1
+ var $c51b7e0106f45dea$exports = require("../CalendarDate.cjs");
2
+ var $05031860ba2f881f$exports = require("./GregorianCalendar.cjs");
3
3
 
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
6
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
7
  }
8
8
 
9
- $parcel$export(module.exports, "BuddhistCalendar", () => $561c4ef058278b74$export$42d20a78301dee44);
9
+ $parcel$export(module.exports, "BuddhistCalendar", function () { return $0ce473f03e925476$export$42d20a78301dee44; });
10
10
  /*
11
11
  * Copyright 2020 Adobe. All rights reserved.
12
12
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -21,15 +21,15 @@ $parcel$export(module.exports, "BuddhistCalendar", () => $561c4ef058278b74$expor
21
21
  // Original licensing can be found in the NOTICE file in the root directory of this source tree.
22
22
 
23
23
 
24
- const $561c4ef058278b74$var$BUDDHIST_ERA_START = -543;
25
- class $561c4ef058278b74$export$42d20a78301dee44 extends (0, $af14c9812fdceb33$exports.GregorianCalendar) {
24
+ const $0ce473f03e925476$var$BUDDHIST_ERA_START = -543;
25
+ class $0ce473f03e925476$export$42d20a78301dee44 extends (0, $05031860ba2f881f$exports.GregorianCalendar) {
26
26
  fromJulianDay(jd) {
27
27
  let gregorianDate = super.fromJulianDay(jd);
28
- let year = (0, $af14c9812fdceb33$exports.getExtendedYear)(gregorianDate.era, gregorianDate.year);
29
- return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(this, year - $561c4ef058278b74$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
28
+ let year = (0, $05031860ba2f881f$exports.getExtendedYear)(gregorianDate.era, gregorianDate.year);
29
+ return new (0, $c51b7e0106f45dea$exports.CalendarDate)(this, year - $0ce473f03e925476$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
30
30
  }
31
31
  toJulianDay(date) {
32
- return super.toJulianDay($561c4ef058278b74$var$toGregorian(date));
32
+ return super.toJulianDay($0ce473f03e925476$var$toGregorian(date));
33
33
  }
34
34
  getEras() {
35
35
  return [
@@ -37,17 +37,17 @@ class $561c4ef058278b74$export$42d20a78301dee44 extends (0, $af14c9812fdceb33$ex
37
37
  ];
38
38
  }
39
39
  getDaysInMonth(date) {
40
- return super.getDaysInMonth($561c4ef058278b74$var$toGregorian(date));
40
+ return super.getDaysInMonth($0ce473f03e925476$var$toGregorian(date));
41
41
  }
42
42
  balanceDate() {}
43
43
  constructor(...args){
44
44
  super(...args), this.identifier = 'buddhist';
45
45
  }
46
46
  }
47
- function $561c4ef058278b74$var$toGregorian(date) {
48
- let [era, year] = (0, $af14c9812fdceb33$exports.fromExtendedYear)(date.year + $561c4ef058278b74$var$BUDDHIST_ERA_START);
49
- return new (0, $625ad1e1f4c43bc1$exports.CalendarDate)(era, year, date.month, date.day);
47
+ function $0ce473f03e925476$var$toGregorian(date) {
48
+ let [era, year] = (0, $05031860ba2f881f$exports.fromExtendedYear)(date.year + $0ce473f03e925476$var$BUDDHIST_ERA_START);
49
+ return new (0, $c51b7e0106f45dea$exports.CalendarDate)(era, year, date.month, date.day);
50
50
  }
51
51
 
52
52
 
53
- //# sourceMappingURL=BuddhistCalendar.main.js.map
53
+ //# sourceMappingURL=BuddhistCalendar.cjs.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAoB,CAAC;;QA1BhB,qBACL,aAAiC;;AA0BnC;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,KACA,MACA,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate(): void {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(\n era,\n year,\n date.month,\n date.day\n );\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,gEAAgE;AAChE,gGAAgG;;;AAMhG,MAAM,2CAAqB;AAOpB,MAAM,kDAAyB,CAAA,GAAA,2CAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,gBAAgB,KAAK,CAAC,cAAc;QACxC,IAAI,OAAO,CAAA,GAAA,yCAAc,EAAE,cAAc,GAAG,EAAE,cAAc,IAAI;QAChE,OAAO,IAAI,CAAA,GAAA,sCAAW,EACpB,IAAI,EACJ,OAAO,0CACP,cAAc,KAAK,EACnB,cAAc,GAAG;IAErB;IAEA,YAAY,IAAqB,EAAU;QACzC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,UAAoB;QAClB,OAAO;YAAC;SAAK;IACf;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,cAAoB,CAAC;;QA1BhB,qBACL,aAAiC;;AA0BnC;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,CAAC,KAAK,KAAK,GAAG,CAAA,GAAA,0CAAe,EAAE,KAAK,IAAI,GAAG;IAC/C,OAAO,IAAI,CAAA,GAAA,sCAAW,EAAE,KAAK,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG;AACzD","sources":["packages/@internationalized/date/src/calendars/BuddhistCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, CalendarIdentifier} 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: CalendarIdentifier = '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): number {\n return super.toJulianDay(toGregorian(date));\n }\n\n getEras(): string[] {\n return ['BE'];\n }\n\n getDaysInMonth(date: AnyCalendarDate): number {\n return super.getDaysInMonth(toGregorian(date));\n }\n\n balanceDate(): void {}\n}\n\nfunction toGregorian(date: AnyCalendarDate) {\n let [era, year] = fromExtendedYear(date.year + BUDDHIST_ERA_START);\n return new CalendarDate(era, year, date.month, date.day);\n}\n"],"names":[],"version":3,"file":"BuddhistCalendar.cjs.map"}