@zealakit/chrono-react 0.0.0-stage → 1.0.0-beta.1

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 (355) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +624 -2
  3. package/dist/calendar/components.d.ts +346 -0
  4. package/dist/calendar/components.js +245 -0
  5. package/dist/calendar/context.d.ts +636 -0
  6. package/dist/calendar/context.js +21 -0
  7. package/dist/calendar/index.d.ts +6 -0
  8. package/dist/calendar/index.js +6 -0
  9. package/dist/calendar/mini-calendar.d.ts +60 -0
  10. package/dist/calendar/mini-calendar.js +50 -0
  11. package/dist/calendar/options.d.ts +4 -0
  12. package/dist/calendar/options.js +98 -0
  13. package/dist/calendar/use-calendar.d.ts +340 -0
  14. package/dist/calendar/use-calendar.js +156 -0
  15. package/dist/calendar/use-mini-calendar.d.ts +302 -0
  16. package/dist/calendar/use-mini-calendar.js +56 -0
  17. package/dist/calendar/utilities.d.ts +9 -0
  18. package/dist/calendar/utilities.js +8 -0
  19. package/dist/date/bind-panel.d.ts +30 -0
  20. package/dist/date/bind-panel.js +125 -0
  21. package/dist/date/components.d.ts +197 -0
  22. package/dist/date/components.js +202 -0
  23. package/dist/date/context.d.ts +34 -0
  24. package/dist/date/context.js +19 -0
  25. package/dist/date/index.d.ts +4 -0
  26. package/dist/date/index.js +4 -0
  27. package/dist/date/options.d.ts +7 -0
  28. package/dist/date/options.js +91 -0
  29. package/dist/date/use-date-input.d.ts +43 -0
  30. package/dist/date/use-date-input.js +138 -0
  31. package/dist/date/use-date-panel.d.ts +81 -0
  32. package/dist/date/use-date-panel.js +21 -0
  33. package/dist/date/utilities.d.ts +4 -0
  34. package/dist/date/utilities.js +4 -0
  35. package/dist/datetime/components.d.ts +121 -0
  36. package/dist/datetime/components.js +169 -0
  37. package/dist/datetime/context.d.ts +8 -0
  38. package/dist/datetime/context.js +18 -0
  39. package/dist/datetime/index.d.ts +4 -0
  40. package/dist/datetime/index.js +4 -0
  41. package/dist/datetime/options.d.ts +5 -0
  42. package/dist/datetime/options.js +99 -0
  43. package/dist/datetime/use-datetime-input.d.ts +44 -0
  44. package/dist/datetime/use-datetime-input.js +145 -0
  45. package/dist/datetime/use-datetime-panel.d.ts +128 -0
  46. package/dist/datetime/use-datetime-panel.js +60 -0
  47. package/dist/datetime/utilities.d.ts +4 -0
  48. package/dist/datetime/utilities.js +4 -0
  49. package/dist/index.d.ts +4 -0
  50. package/dist/index.js +4 -0
  51. package/dist/shared/merge-props.d.ts +9 -0
  52. package/dist/shared/merge-props.js +33 -0
  53. package/dist/shared/modifiers.d.ts +7 -0
  54. package/dist/shared/modifiers.js +6 -0
  55. package/dist/shared/part.d.ts +10 -0
  56. package/dist/shared/part.js +9 -0
  57. package/dist/shared/slot.d.ts +12 -0
  58. package/dist/shared/slot.js +60 -0
  59. package/dist/shared/style-properties.d.ts +8 -0
  60. package/dist/shared/style-properties.js +13 -0
  61. package/dist/shared/to-react-props.d.ts +11 -0
  62. package/dist/shared/to-react-props.js +27 -0
  63. package/dist/time/bind-panel.d.ts +19 -0
  64. package/dist/time/bind-panel.js +97 -0
  65. package/dist/time/components.d.ts +183 -0
  66. package/dist/time/components.js +174 -0
  67. package/dist/time/context.d.ts +24 -0
  68. package/dist/time/context.js +19 -0
  69. package/dist/time/index.d.ts +4 -0
  70. package/dist/time/index.js +4 -0
  71. package/dist/time/options.d.ts +5 -0
  72. package/dist/time/options.js +85 -0
  73. package/dist/time/use-time-input.d.ts +43 -0
  74. package/dist/time/use-time-input.js +138 -0
  75. package/dist/time/use-time-panel.d.ts +37 -0
  76. package/dist/time/use-time-panel.js +18 -0
  77. package/dist/time/utilities.d.ts +4 -0
  78. package/dist/time/utilities.js +4 -0
  79. package/dist/vendor/core/calendar/availability.d.ts +39 -0
  80. package/dist/vendor/core/calendar/availability.js +74 -0
  81. package/dist/vendor/core/calendar/controllers/calendar-controller.d.ts +251 -0
  82. package/dist/vendor/core/calendar/controllers/calendar-controller.js +1448 -0
  83. package/dist/vendor/core/calendar/controllers/drag-engine.d.ts +99 -0
  84. package/dist/vendor/core/calendar/controllers/drag-engine.js +382 -0
  85. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.d.ts +66 -0
  86. package/dist/vendor/core/calendar/controllers/mini-calendar-controller.js +170 -0
  87. package/dist/vendor/core/calendar/controllers/shared.d.ts +29 -0
  88. package/dist/vendor/core/calendar/controllers/shared.js +82 -0
  89. package/dist/vendor/core/calendar/events/agenda-layout.d.ts +21 -0
  90. package/dist/vendor/core/calendar/events/agenda-layout.js +71 -0
  91. package/dist/vendor/core/calendar/events/all-day-row.d.ts +22 -0
  92. package/dist/vendor/core/calendar/events/all-day-row.js +93 -0
  93. package/dist/vendor/core/calendar/events/background-layout.d.ts +66 -0
  94. package/dist/vendor/core/calendar/events/background-layout.js +107 -0
  95. package/dist/vendor/core/calendar/events/index.d.ts +17 -0
  96. package/dist/vendor/core/calendar/events/index.js +8 -0
  97. package/dist/vendor/core/calendar/events/month-layout.d.ts +13 -0
  98. package/dist/vendor/core/calendar/events/month-layout.js +156 -0
  99. package/dist/vendor/core/calendar/events/normalize.d.ts +33 -0
  100. package/dist/vendor/core/calendar/events/normalize.js +159 -0
  101. package/dist/vendor/core/calendar/events/now-indicator.d.ts +18 -0
  102. package/dist/vendor/core/calendar/events/now-indicator.js +19 -0
  103. package/dist/vendor/core/calendar/events/overflow.d.ts +36 -0
  104. package/dist/vendor/core/calendar/events/overflow.js +112 -0
  105. package/dist/vendor/core/calendar/events/sort.d.ts +21 -0
  106. package/dist/vendor/core/calendar/events/sort.js +35 -0
  107. package/dist/vendor/core/calendar/events/time-grid-layout.d.ts +22 -0
  108. package/dist/vendor/core/calendar/events/time-grid-layout.js +184 -0
  109. package/dist/vendor/core/calendar/events/types.d.ts +141 -0
  110. package/dist/vendor/core/calendar/events/types.js +1 -0
  111. package/dist/vendor/core/calendar/index.d.ts +70 -0
  112. package/dist/vendor/core/calendar/index.js +37 -0
  113. package/dist/vendor/core/calendar/interaction/auto-scroll.d.ts +19 -0
  114. package/dist/vendor/core/calendar/interaction/auto-scroll.js +64 -0
  115. package/dist/vendor/core/calendar/interaction/drag-geometry.d.ts +52 -0
  116. package/dist/vendor/core/calendar/interaction/drag-geometry.js +125 -0
  117. package/dist/vendor/core/calendar/interaction/drag-keyboard.d.ts +38 -0
  118. package/dist/vendor/core/calendar/interaction/drag-keyboard.js +56 -0
  119. package/dist/vendor/core/calendar/interaction/drag-pointer.d.ts +23 -0
  120. package/dist/vendor/core/calendar/interaction/drag-pointer.js +203 -0
  121. package/dist/vendor/core/calendar/interaction/event-focus.d.ts +28 -0
  122. package/dist/vendor/core/calendar/interaction/event-focus.js +44 -0
  123. package/dist/vendor/core/calendar/interaction/hit-test.d.ts +17 -0
  124. package/dist/vendor/core/calendar/interaction/hit-test.js +26 -0
  125. package/dist/vendor/core/calendar/interaction/pending.d.ts +17 -0
  126. package/dist/vendor/core/calendar/interaction/pending.js +17 -0
  127. package/dist/vendor/core/calendar/interaction/pointer.d.ts +21 -0
  128. package/dist/vendor/core/calendar/interaction/pointer.js +119 -0
  129. package/dist/vendor/core/calendar/interaction/selection.d.ts +29 -0
  130. package/dist/vendor/core/calendar/interaction/selection.js +47 -0
  131. package/dist/vendor/core/calendar/internal/equal.d.ts +3 -0
  132. package/dist/vendor/core/calendar/internal/equal.js +43 -0
  133. package/dist/vendor/core/calendar/navigation/navigate.d.ts +33 -0
  134. package/dist/vendor/core/calendar/navigation/navigate.js +83 -0
  135. package/dist/vendor/core/calendar/navigation/range.d.ts +15 -0
  136. package/dist/vendor/core/calendar/navigation/range.js +52 -0
  137. package/dist/vendor/core/calendar/navigation/title.d.ts +12 -0
  138. package/dist/vendor/core/calendar/navigation/title.js +39 -0
  139. package/dist/vendor/core/calendar/navigation/view-definition.d.ts +39 -0
  140. package/dist/vendor/core/calendar/navigation/view-definition.js +61 -0
  141. package/dist/vendor/core/calendar/navigation/zoom.d.ts +5 -0
  142. package/dist/vendor/core/calendar/navigation/zoom.js +11 -0
  143. package/dist/vendor/core/calendar/recurrence/apply.d.ts +50 -0
  144. package/dist/vendor/core/calendar/recurrence/apply.js +207 -0
  145. package/dist/vendor/core/calendar/recurrence/expand.d.ts +27 -0
  146. package/dist/vendor/core/calendar/recurrence/expand.js +302 -0
  147. package/dist/vendor/core/calendar/recurrence/pack.d.ts +3 -0
  148. package/dist/vendor/core/calendar/recurrence/pack.js +251 -0
  149. package/dist/vendor/core/calendar/recurrence/rrule-types.d.ts +30 -0
  150. package/dist/vendor/core/calendar/recurrence/rrule-types.js +8 -0
  151. package/dist/vendor/core/calendar/recurrence/rrule.d.ts +12 -0
  152. package/dist/vendor/core/calendar/recurrence/rrule.js +288 -0
  153. package/dist/vendor/core/calendar/recurrence/series.d.ts +25 -0
  154. package/dist/vendor/core/calendar/recurrence/series.js +165 -0
  155. package/dist/vendor/core/calendar/recurrence/types.d.ts +30 -0
  156. package/dist/vendor/core/calendar/recurrence/types.js +1 -0
  157. package/dist/vendor/core/calendar/resources/keys.d.ts +2 -0
  158. package/dist/vendor/core/calendar/resources/keys.js +2 -0
  159. package/dist/vendor/core/calendar/resources/resource-time-grid.d.ts +7 -0
  160. package/dist/vendor/core/calendar/resources/resource-time-grid.js +130 -0
  161. package/dist/vendor/core/calendar/resources/timeline-axis.d.ts +10 -0
  162. package/dist/vendor/core/calendar/resources/timeline-axis.js +98 -0
  163. package/dist/vendor/core/calendar/resources/timeline-layout.d.ts +7 -0
  164. package/dist/vendor/core/calendar/resources/timeline-layout.js +111 -0
  165. package/dist/vendor/core/calendar/resources/tree.d.ts +10 -0
  166. package/dist/vendor/core/calendar/resources/tree.js +86 -0
  167. package/dist/vendor/core/calendar/resources/types.d.ts +177 -0
  168. package/dist/vendor/core/calendar/resources/types.js +1 -0
  169. package/dist/vendor/core/calendar/resources/views.d.ts +7 -0
  170. package/dist/vendor/core/calendar/resources/views.js +45 -0
  171. package/dist/vendor/core/calendar/resources/windowing.d.ts +11 -0
  172. package/dist/vendor/core/calendar/resources/windowing.js +17 -0
  173. package/dist/vendor/core/calendar/views/day.d.ts +37 -0
  174. package/dist/vendor/core/calendar/views/day.js +39 -0
  175. package/dist/vendor/core/calendar/views/list-layout.d.ts +8 -0
  176. package/dist/vendor/core/calendar/views/list-layout.js +5 -0
  177. package/dist/vendor/core/calendar/views/mini-calendar.d.ts +23 -0
  178. package/dist/vendor/core/calendar/views/mini-calendar.js +31 -0
  179. package/dist/vendor/core/calendar/views/month-layout.d.ts +30 -0
  180. package/dist/vendor/core/calendar/views/month-layout.js +63 -0
  181. package/dist/vendor/core/calendar/views/time-grid-layout.d.ts +26 -0
  182. package/dist/vendor/core/calendar/views/time-grid-layout.js +30 -0
  183. package/dist/vendor/core/date/index.d.ts +9 -0
  184. package/dist/vendor/core/date/index.js +9 -0
  185. package/dist/vendor/core/date/input/date-input-controller.d.ts +97 -0
  186. package/dist/vendor/core/date/input/date-input-controller.js +478 -0
  187. package/dist/vendor/core/date/input/date-range-input-controller.d.ts +43 -0
  188. package/dist/vendor/core/date/input/date-range-input-controller.js +189 -0
  189. package/dist/vendor/core/date/input/parse.d.ts +22 -0
  190. package/dist/vendor/core/date/input/parse.js +84 -0
  191. package/dist/vendor/core/date/input/validity.d.ts +6 -0
  192. package/dist/vendor/core/date/input/validity.js +13 -0
  193. package/dist/vendor/core/date/panel/panel-controller.d.ts +176 -0
  194. package/dist/vendor/core/date/panel/panel-controller.js +726 -0
  195. package/dist/vendor/core/date/presets.d.ts +22 -0
  196. package/dist/vendor/core/date/presets.js +104 -0
  197. package/dist/vendor/core/date/selection/multiple.d.ts +7 -0
  198. package/dist/vendor/core/date/selection/multiple.js +32 -0
  199. package/dist/vendor/core/date/selection/range.d.ts +29 -0
  200. package/dist/vendor/core/date/selection/range.js +39 -0
  201. package/dist/vendor/core/date/types.d.ts +12 -0
  202. package/dist/vendor/core/date/types.js +1 -0
  203. package/dist/vendor/core/datetime/compose.d.ts +24 -0
  204. package/dist/vendor/core/datetime/compose.js +49 -0
  205. package/dist/vendor/core/datetime/constraints.d.ts +42 -0
  206. package/dist/vendor/core/datetime/constraints.js +56 -0
  207. package/dist/vendor/core/datetime/index.d.ts +9 -0
  208. package/dist/vendor/core/datetime/index.js +9 -0
  209. package/dist/vendor/core/datetime/input/datetime-input-controller.d.ts +96 -0
  210. package/dist/vendor/core/datetime/input/datetime-input-controller.js +395 -0
  211. package/dist/vendor/core/datetime/input/datetime-range-input-controller.d.ts +46 -0
  212. package/dist/vendor/core/datetime/input/datetime-range-input-controller.js +182 -0
  213. package/dist/vendor/core/datetime/input/parse.d.ts +20 -0
  214. package/dist/vendor/core/datetime/input/parse.js +59 -0
  215. package/dist/vendor/core/datetime/panel/controller.d.ts +64 -0
  216. package/dist/vendor/core/datetime/panel/controller.js +197 -0
  217. package/dist/vendor/core/datetime/panel/range-controller.d.ts +71 -0
  218. package/dist/vendor/core/datetime/panel/range-controller.js +217 -0
  219. package/dist/vendor/core/datetime/types.d.ts +12 -0
  220. package/dist/vendor/core/datetime/types.js +1 -0
  221. package/dist/vendor/core/datetime/zone/day-instants.d.ts +19 -0
  222. package/dist/vendor/core/datetime/zone/day-instants.js +54 -0
  223. package/dist/vendor/core/datetime/zone/resolve.d.ts +16 -0
  224. package/dist/vendor/core/datetime/zone/resolve.js +26 -0
  225. package/dist/vendor/core/foundation/a11y/announcer.d.ts +7 -0
  226. package/dist/vendor/core/foundation/a11y/announcer.js +36 -0
  227. package/dist/vendor/core/foundation/a11y/grid-navigation.d.ts +19 -0
  228. package/dist/vendor/core/foundation/a11y/grid-navigation.js +86 -0
  229. package/dist/vendor/core/foundation/a11y/index.d.ts +8 -0
  230. package/dist/vendor/core/foundation/a11y/index.js +5 -0
  231. package/dist/vendor/core/foundation/a11y/labels.d.ts +21 -0
  232. package/dist/vendor/core/foundation/a11y/labels.js +43 -0
  233. package/dist/vendor/core/foundation/a11y/messages.d.ts +80 -0
  234. package/dist/vendor/core/foundation/a11y/messages.js +74 -0
  235. package/dist/vendor/core/foundation/a11y/roving-focus.d.ts +18 -0
  236. package/dist/vendor/core/foundation/a11y/roving-focus.js +52 -0
  237. package/dist/vendor/core/foundation/constraints/availability-rules.d.ts +52 -0
  238. package/dist/vendor/core/foundation/constraints/availability-rules.js +66 -0
  239. package/dist/vendor/core/foundation/constraints/availability.d.ts +93 -0
  240. package/dist/vendor/core/foundation/constraints/availability.js +490 -0
  241. package/dist/vendor/core/foundation/constraints/date.d.ts +21 -0
  242. package/dist/vendor/core/foundation/constraints/date.js +41 -0
  243. package/dist/vendor/core/foundation/constraints/index.d.ts +9 -0
  244. package/dist/vendor/core/foundation/constraints/index.js +4 -0
  245. package/dist/vendor/core/foundation/constraints/range.d.ts +44 -0
  246. package/dist/vendor/core/foundation/constraints/range.js +70 -0
  247. package/dist/vendor/core/foundation/constraints/time.d.ts +30 -0
  248. package/dist/vendor/core/foundation/constraints/time.js +56 -0
  249. package/dist/vendor/core/foundation/grid/index.d.ts +8 -0
  250. package/dist/vendor/core/foundation/grid/index.js +4 -0
  251. package/dist/vendor/core/foundation/grid/month-grid.d.ts +33 -0
  252. package/dist/vendor/core/foundation/grid/month-grid.js +52 -0
  253. package/dist/vendor/core/foundation/grid/time-axis.d.ts +25 -0
  254. package/dist/vendor/core/foundation/grid/time-axis.js +32 -0
  255. package/dist/vendor/core/foundation/grid/weekday-headers.d.ts +17 -0
  256. package/dist/vendor/core/foundation/grid/weekday-headers.js +26 -0
  257. package/dist/vendor/core/foundation/grid/year-grid.d.ts +29 -0
  258. package/dist/vendor/core/foundation/grid/year-grid.js +40 -0
  259. package/dist/vendor/core/foundation/index.d.ts +8 -0
  260. package/dist/vendor/core/foundation/index.js +8 -0
  261. package/dist/vendor/core/foundation/input/form.d.ts +7 -0
  262. package/dist/vendor/core/foundation/input/form.js +10 -0
  263. package/dist/vendor/core/foundation/input/index.d.ts +6 -0
  264. package/dist/vendor/core/foundation/input/index.js +3 -0
  265. package/dist/vendor/core/foundation/input/segment-engine.d.ts +33 -0
  266. package/dist/vendor/core/foundation/input/segment-engine.js +49 -0
  267. package/dist/vendor/core/foundation/input/tokenize.d.ts +19 -0
  268. package/dist/vendor/core/foundation/input/tokenize.js +24 -0
  269. package/dist/vendor/core/foundation/locale/digits.d.ts +6 -0
  270. package/dist/vendor/core/foundation/locale/digits.js +35 -0
  271. package/dist/vendor/core/foundation/locale/direction.d.ts +1 -0
  272. package/dist/vendor/core/foundation/locale/direction.js +37 -0
  273. package/dist/vendor/core/foundation/locale/format.d.ts +31 -0
  274. package/dist/vendor/core/foundation/locale/format.js +79 -0
  275. package/dist/vendor/core/foundation/locale/hour-cycle.d.ts +12 -0
  276. package/dist/vendor/core/foundation/locale/hour-cycle.js +45 -0
  277. package/dist/vendor/core/foundation/locale/index.d.ts +10 -0
  278. package/dist/vendor/core/foundation/locale/index.js +8 -0
  279. package/dist/vendor/core/foundation/locale/names.d.ts +6 -0
  280. package/dist/vendor/core/foundation/locale/names.js +30 -0
  281. package/dist/vendor/core/foundation/locale/resolve.d.ts +7 -0
  282. package/dist/vendor/core/foundation/locale/resolve.js +29 -0
  283. package/dist/vendor/core/foundation/locale/week-info.d.ts +5 -0
  284. package/dist/vendor/core/foundation/locale/week-info.js +61 -0
  285. package/dist/vendor/core/foundation/locale/zone-label.d.ts +6 -0
  286. package/dist/vendor/core/foundation/locale/zone-label.js +24 -0
  287. package/dist/vendor/core/foundation/ranges/date-range.d.ts +18 -0
  288. package/dist/vendor/core/foundation/ranges/date-range.js +40 -0
  289. package/dist/vendor/core/foundation/ranges/index.d.ts +4 -0
  290. package/dist/vendor/core/foundation/ranges/index.js +2 -0
  291. package/dist/vendor/core/foundation/ranges/interval.d.ts +24 -0
  292. package/dist/vendor/core/foundation/ranges/interval.js +56 -0
  293. package/dist/vendor/core/foundation/store/attributes.d.ts +19 -0
  294. package/dist/vendor/core/foundation/store/attributes.js +43 -0
  295. package/dist/vendor/core/foundation/store/controllable.d.ts +19 -0
  296. package/dist/vendor/core/foundation/store/controllable.js +50 -0
  297. package/dist/vendor/core/foundation/store/env.d.ts +1 -0
  298. package/dist/vendor/core/foundation/store/env.js +3 -0
  299. package/dist/vendor/core/foundation/store/global-state.d.ts +1 -0
  300. package/dist/vendor/core/foundation/store/global-state.js +21 -0
  301. package/dist/vendor/core/foundation/store/ids.d.ts +2 -0
  302. package/dist/vendor/core/foundation/store/ids.js +7 -0
  303. package/dist/vendor/core/foundation/store/index.d.ts +11 -0
  304. package/dist/vendor/core/foundation/store/index.js +7 -0
  305. package/dist/vendor/core/foundation/store/store.d.ts +7 -0
  306. package/dist/vendor/core/foundation/store/store.js +25 -0
  307. package/dist/vendor/core/foundation/store/ticker.d.ts +11 -0
  308. package/dist/vendor/core/foundation/store/ticker.js +27 -0
  309. package/dist/vendor/core/foundation/values/clock.d.ts +4 -0
  310. package/dist/vendor/core/foundation/values/clock.js +21 -0
  311. package/dist/vendor/core/foundation/values/compare.d.ts +16 -0
  312. package/dist/vendor/core/foundation/values/compare.js +70 -0
  313. package/dist/vendor/core/foundation/values/convert.d.ts +31 -0
  314. package/dist/vendor/core/foundation/values/convert.js +112 -0
  315. package/dist/vendor/core/foundation/values/epoch-day.d.ts +15 -0
  316. package/dist/vendor/core/foundation/values/epoch-day.js +47 -0
  317. package/dist/vendor/core/foundation/values/index.d.ts +14 -0
  318. package/dist/vendor/core/foundation/values/index.js +10 -0
  319. package/dist/vendor/core/foundation/values/iso.d.ts +24 -0
  320. package/dist/vendor/core/foundation/values/iso.js +113 -0
  321. package/dist/vendor/core/foundation/values/plain-date-time.d.ts +8 -0
  322. package/dist/vendor/core/foundation/values/plain-date-time.js +25 -0
  323. package/dist/vendor/core/foundation/values/plain-date.d.ts +33 -0
  324. package/dist/vendor/core/foundation/values/plain-date.js +105 -0
  325. package/dist/vendor/core/foundation/values/plain-time.d.ts +15 -0
  326. package/dist/vendor/core/foundation/values/plain-time.js +45 -0
  327. package/dist/vendor/core/foundation/values/types.d.ts +37 -0
  328. package/dist/vendor/core/foundation/values/types.js +1 -0
  329. package/dist/vendor/core/foundation/values/week.d.ts +9 -0
  330. package/dist/vendor/core/foundation/values/week.js +31 -0
  331. package/dist/vendor/core/foundation/values/year-month.d.ts +10 -0
  332. package/dist/vendor/core/foundation/values/year-month.js +19 -0
  333. package/dist/vendor/core/foundation/values/zoned.d.ts +16 -0
  334. package/dist/vendor/core/foundation/values/zoned.js +155 -0
  335. package/dist/vendor/core/index.d.ts +5 -0
  336. package/dist/vendor/core/index.js +5 -0
  337. package/dist/vendor/core/time/index.d.ts +8 -0
  338. package/dist/vendor/core/time/index.js +8 -0
  339. package/dist/vendor/core/time/input/parse.d.ts +19 -0
  340. package/dist/vendor/core/time/input/parse.js +84 -0
  341. package/dist/vendor/core/time/input/time-input-controller.d.ts +102 -0
  342. package/dist/vendor/core/time/input/time-input-controller.js +562 -0
  343. package/dist/vendor/core/time/input/time-range-input-controller.d.ts +49 -0
  344. package/dist/vendor/core/time/input/time-range-input-controller.js +185 -0
  345. package/dist/vendor/core/time/input/validity.d.ts +7 -0
  346. package/dist/vendor/core/time/input/validity.js +16 -0
  347. package/dist/vendor/core/time/panel/time-panel-controller.d.ts +163 -0
  348. package/dist/vendor/core/time/panel/time-panel-controller.js +839 -0
  349. package/dist/vendor/core/time/selection/range.d.ts +25 -0
  350. package/dist/vendor/core/time/selection/range.js +35 -0
  351. package/dist/vendor/core/time/selection/slots.d.ts +46 -0
  352. package/dist/vendor/core/time/selection/slots.js +78 -0
  353. package/dist/vendor/core/time/types.d.ts +11 -0
  354. package/dist/vendor/core/time/types.js +1 -0
  355. package/package.json +90 -4
@@ -0,0 +1,14 @@
1
+ export type { DateInput, DateTimeInput, DayOfWeek, Disambiguation, Overflow, PlainDate, PlainDateTime, PlainTime, TimeInput, WeekInfo, ZonedDateTime, } from "./types.js";
2
+ export { addDays, addMonths, addWeeks, addYears, dayOfWeek, dayOfWeekFromEpochDay, dayOfYear, daysInMonth, daysInYear, diffDays, endOfMonth, endOfWeek, endOfYear, fromEpochDay, isLeapYear, isValidDate, plainDate, startOfMonth, startOfWeek, startOfYear, toEpochDay, } from "./plain-date.js";
3
+ export { addMinutes, addSeconds, fromSecondOfDay, plainTime, toSecondOfDay, } from "./plain-time.js";
4
+ export { plainDateTime } from "./plain-date-time.js";
5
+ export { compare, isAfter, isBefore, isSameDay, isSameMonth, isSameTime, isSameYear, maxValue, minValue, } from "./compare.js";
6
+ export { getIsoWeek, getLocaleWeek } from "./week.js";
7
+ export type { WeekNumber } from "./week.js";
8
+ export { fromInstant, getOffset, isValidTimeZone, toInstant, toZoned, withTimeZone, } from "./zoned.js";
9
+ export { parseCellKey, parseIsoDate, parseIsoDateTime, parseIsoTime, parseIsoZoned, toIsoString, } from "./iso.js";
10
+ export type { CellKey } from "./iso.js";
11
+ export { fromDate, fromInclusiveEndDate, fromTemporalLike, toDate, toPlainDate, toPlainDateTime, toPlainTime, } from "./convert.js";
12
+ export { nowZoned, today } from "./clock.js";
13
+ export { addMonthsToYearMonth, compareYearMonth, plainYearMonth, toPlainYearMonth, } from "./year-month.js";
14
+ export type { PlainYearMonth } from "./year-month.js";
@@ -0,0 +1,10 @@
1
+ export { addDays, addMonths, addWeeks, addYears, dayOfWeek, dayOfWeekFromEpochDay, dayOfYear, daysInMonth, daysInYear, diffDays, endOfMonth, endOfWeek, endOfYear, fromEpochDay, isLeapYear, isValidDate, plainDate, startOfMonth, startOfWeek, startOfYear, toEpochDay, } from "./plain-date.js";
2
+ export { addMinutes, addSeconds, fromSecondOfDay, plainTime, toSecondOfDay, } from "./plain-time.js";
3
+ export { plainDateTime } from "./plain-date-time.js";
4
+ export { compare, isAfter, isBefore, isSameDay, isSameMonth, isSameTime, isSameYear, maxValue, minValue, } from "./compare.js";
5
+ export { getIsoWeek, getLocaleWeek } from "./week.js";
6
+ export { fromInstant, getOffset, isValidTimeZone, toInstant, toZoned, withTimeZone, } from "./zoned.js";
7
+ export { parseCellKey, parseIsoDate, parseIsoDateTime, parseIsoTime, parseIsoZoned, toIsoString, } from "./iso.js";
8
+ export { fromDate, fromInclusiveEndDate, fromTemporalLike, toDate, toPlainDate, toPlainDateTime, toPlainTime, } from "./convert.js";
9
+ export { nowZoned, today } from "./clock.js";
10
+ export { addMonthsToYearMonth, compareYearMonth, plainYearMonth, toPlainYearMonth, } from "./year-month.js";
@@ -0,0 +1,24 @@
1
+ import type { PlainDate, PlainDateTime, PlainTime, ZonedDateTime } from "./types.js";
2
+ /** `YYYY-MM-DD`. Anything else throws a `RangeError`. */
3
+ export declare function parseIsoDate(text: string): PlainDate;
4
+ /** `HH:mm`, `HH:mm:ss` (fractional seconds are accepted and dropped, D6). */
5
+ export declare function parseIsoTime(text: string): PlainTime;
6
+ /** `YYYY-MM-DDTHH:mm[:ss]`. */
7
+ export declare function parseIsoDateTime(text: string): PlainDateTime;
8
+ /**
9
+ * `YYYY-MM-DDTHH:mm[:ss]` followed by `Z` or `±hh:mm`, and an optional
10
+ * `[Zone/Id]`. With a zone id the offset must match the zone at that instant.
11
+ */
12
+ export declare function parseIsoZoned(text: string): ZonedDateTime;
13
+ /** Serialize any plain or zoned value to ISO 8601. */
14
+ export declare function toIsoString(value: PlainDate | PlainTime | PlainDateTime | ZonedDateTime): string;
15
+ /** A calendar cell key: `YYYY-MM-DD` or `YYYY-MM-DDTHH:mm[:ss]` (plan 05 R3). */
16
+ export type CellKey = {
17
+ date: PlainDate;
18
+ time?: PlainTime;
19
+ };
20
+ /**
21
+ * Parse a `data-chrono-key` back into its date and optional time. Day cells
22
+ * use `YYYY-MM-DD`; time-grid slots use `YYYY-MM-DDTHH:mm` (the slot start).
23
+ */
24
+ export declare function parseCellKey(key: string): CellKey;
@@ -0,0 +1,113 @@
1
+ import { plainDateTime } from "./plain-date-time.js";
2
+ import { plainDate } from "./plain-date.js";
3
+ import { plainTime } from "./plain-time.js";
4
+ import { fromInstant, isValidTimeZone, parseOffsetId, toInstant, } from "./zoned.js";
5
+ const DATE = "(\\d{4})-(\\d{2})-(\\d{2})";
6
+ const TIME = "(\\d{2}):(\\d{2})(?::(\\d{2})(?:[.,]\\d{1,9})?)?";
7
+ const DATE_RE = new RegExp(`^${DATE}$`);
8
+ const TIME_RE = new RegExp(`^${TIME}$`);
9
+ const DATE_TIME_RE = new RegExp(`^${DATE}T${TIME}$`);
10
+ const ZONED_RE = new RegExp(`^${DATE}T${TIME}(Z|[+-]\\d{2}:\\d{2})(?:\\[([^\\]]+)\\])?$`);
11
+ function invalid(kind, text) {
12
+ throw new RangeError(`"${text}" is not a valid ISO 8601 ${kind}.`);
13
+ }
14
+ function pad(value, length = 2) {
15
+ return String(value).padStart(length, "0");
16
+ }
17
+ function dateFrom(match) {
18
+ return plainDate(Number(match[1]), Number(match[2]), Number(match[3]));
19
+ }
20
+ function timeFrom(match, at) {
21
+ return plainTime(Number(match[at]), Number(match[at + 1]), match[at + 2] === undefined ? 0 : Number(match[at + 2]));
22
+ }
23
+ /** `YYYY-MM-DD`. Anything else throws a `RangeError`. */
24
+ export function parseIsoDate(text) {
25
+ const match = DATE_RE.exec(text);
26
+ return match ? dateFrom(match) : invalid("date", text);
27
+ }
28
+ /** `HH:mm`, `HH:mm:ss` (fractional seconds are accepted and dropped, D6). */
29
+ export function parseIsoTime(text) {
30
+ const match = TIME_RE.exec(text);
31
+ return match ? timeFrom(match, 1) : invalid("time", text);
32
+ }
33
+ /** `YYYY-MM-DDTHH:mm[:ss]`. */
34
+ export function parseIsoDateTime(text) {
35
+ const match = DATE_TIME_RE.exec(text);
36
+ return match
37
+ ? plainDateTime(dateFrom(match), timeFrom(match, 4))
38
+ : invalid("date-time", text);
39
+ }
40
+ function offsetFrom(text) {
41
+ return text === "Z" ? 0 : parseOffsetId(text);
42
+ }
43
+ /**
44
+ * `YYYY-MM-DDTHH:mm[:ss]` followed by `Z` or `±hh:mm`, and an optional
45
+ * `[Zone/Id]`. With a zone id the offset must match the zone at that instant.
46
+ */
47
+ export function parseIsoZoned(text) {
48
+ const match = ZONED_RE.exec(text);
49
+ if (!match) {
50
+ return invalid("zoned date-time", text);
51
+ }
52
+ const wall = plainDateTime(dateFrom(match), timeFrom(match, 4));
53
+ const offsetText = match[7];
54
+ const offset = offsetFrom(offsetText);
55
+ if (offsetText !== "Z" && parseOffsetId(offsetText) === null) {
56
+ return invalid("zoned date-time", text);
57
+ }
58
+ const zone = match[8];
59
+ if (zone === undefined) {
60
+ return Object.freeze({
61
+ ...wall,
62
+ timeZone: offsetText === "Z" ? "UTC" : offsetText,
63
+ offset,
64
+ });
65
+ }
66
+ if (!isValidTimeZone(zone)) {
67
+ throw new RangeError(`Unknown time zone "${zone}" in "${text}".`);
68
+ }
69
+ const resolved = fromInstant(toInstant({ ...wall, timeZone: zone, offset }), zone);
70
+ if (resolved.year !== wall.year ||
71
+ resolved.month !== wall.month ||
72
+ resolved.day !== wall.day ||
73
+ resolved.hour !== wall.hour ||
74
+ resolved.minute !== wall.minute ||
75
+ resolved.second !== wall.second) {
76
+ throw new RangeError(`Offset in "${text}" does not match time zone ${zone}.`);
77
+ }
78
+ return resolved;
79
+ }
80
+ function formatOffset(minutes) {
81
+ const abs = Math.abs(minutes);
82
+ return `${minutes < 0 ? "-" : "+"}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`;
83
+ }
84
+ /** Serialize any plain or zoned value to ISO 8601. */
85
+ export function toIsoString(value) {
86
+ const v = value;
87
+ const date = v.year === undefined
88
+ ? ""
89
+ : `${pad(v.year, 4)}-${pad(v.month)}-${pad(v.day)}`;
90
+ const time = v.hour === undefined
91
+ ? ""
92
+ : `${pad(v.hour)}:${pad(v.minute)}:${pad(v.second)}`;
93
+ if (v.timeZone !== undefined) {
94
+ const zone = parseOffsetId(v.timeZone) === null ? `[${v.timeZone}]` : "";
95
+ return `${date}T${time}${formatOffset(v.offset)}${zone}`;
96
+ }
97
+ return date && time ? `${date}T${time}` : date || time;
98
+ }
99
+ /**
100
+ * Parse a `data-chrono-key` back into its date and optional time. Day cells
101
+ * use `YYYY-MM-DD`; time-grid slots use `YYYY-MM-DDTHH:mm` (the slot start).
102
+ */
103
+ export function parseCellKey(key) {
104
+ const t = key.indexOf("T");
105
+ if (t === -1) {
106
+ return { date: parseIsoDate(key) };
107
+ }
108
+ const dateTime = parseIsoDateTime(key);
109
+ return {
110
+ date: plainDate(dateTime.year, dateTime.month, dateTime.day),
111
+ time: plainTime(dateTime.hour, dateTime.minute, dateTime.second),
112
+ };
113
+ }
@@ -0,0 +1,8 @@
1
+ import type { PlainDate, PlainDateTime, PlainTime } from "./types.js";
2
+ export declare function plainDateTime(date: PlainDate, time: PlainTime): PlainDateTime;
3
+ /** The date part of any value that has one. */
4
+ export declare function datePart(value: PlainDate): PlainDate;
5
+ /** The time part of any value that has one. */
6
+ export declare function timePart(value: PlainTime): PlainTime;
7
+ /** Wall-clock seconds since 1970-01-01T00:00:00 as if the wall time were UTC. */
8
+ export declare function wallSeconds(value: PlainDateTime): number;
@@ -0,0 +1,25 @@
1
+ import { SECONDS_PER_DAY, plainTime, toSecondOfDay } from "./plain-time.js";
2
+ import { plainDate, toEpochDay } from "./plain-date.js";
3
+ export function plainDateTime(date, time) {
4
+ return Object.freeze({
5
+ calendar: "gregory",
6
+ year: date.year,
7
+ month: date.month,
8
+ day: date.day,
9
+ hour: time.hour,
10
+ minute: time.minute,
11
+ second: time.second,
12
+ });
13
+ }
14
+ /** The date part of any value that has one. */
15
+ export function datePart(value) {
16
+ return plainDate(value.year, value.month, value.day);
17
+ }
18
+ /** The time part of any value that has one. */
19
+ export function timePart(value) {
20
+ return plainTime(value.hour, value.minute, value.second);
21
+ }
22
+ /** Wall-clock seconds since 1970-01-01T00:00:00 as if the wall time were UTC. */
23
+ export function wallSeconds(value) {
24
+ return toEpochDay(value) * SECONDS_PER_DAY + toSecondOfDay(value);
25
+ }
@@ -0,0 +1,33 @@
1
+ import { daysInMonth, daysInYear, isLeapYear } from "./epoch-day.js";
2
+ import type { DayOfWeek, Overflow, PlainDate } from "./types.js";
3
+ export { daysInMonth, daysInYear, isLeapYear };
4
+ export declare function isValidDate(year: number, month: number, day: number): boolean;
5
+ /**
6
+ * Create a frozen {@link PlainDate}. Invalid input throws a `RangeError`, or
7
+ * is clamped into the month with `overflow: "constrain"`.
8
+ */
9
+ export declare function plainDate(year: number, month: number, day: number, options?: {
10
+ overflow?: Overflow;
11
+ }): PlainDate;
12
+ export declare function toEpochDay(date: Pick<PlainDate, "year" | "month" | "day">): number;
13
+ export declare function fromEpochDay(epochDay: number): PlainDate;
14
+ /** 1 = Monday ... 7 = Sunday. */
15
+ export declare function dayOfWeek(date: Pick<PlainDate, "year" | "month" | "day">): DayOfWeek;
16
+ export declare function dayOfWeekFromEpochDay(epochDay: number): DayOfWeek;
17
+ export declare function dayOfYear(date: PlainDate): number;
18
+ export declare function addDays(date: PlainDate, days: number): PlainDate;
19
+ export declare function addWeeks(date: PlainDate, weeks: number): PlainDate;
20
+ export declare function addMonths(date: PlainDate, months: number, options?: {
21
+ overflow?: Overflow;
22
+ }): PlainDate;
23
+ export declare function addYears(date: PlainDate, years: number, options?: {
24
+ overflow?: Overflow;
25
+ }): PlainDate;
26
+ /** `a - b` in whole days. */
27
+ export declare function diffDays(a: PlainDate, b: PlainDate): number;
28
+ export declare function startOfWeek(date: PlainDate, weekStartsOn: DayOfWeek): PlainDate;
29
+ export declare function endOfWeek(date: PlainDate, weekStartsOn: DayOfWeek): PlainDate;
30
+ export declare function startOfMonth(date: PlainDate): PlainDate;
31
+ export declare function endOfMonth(date: PlainDate): PlainDate;
32
+ export declare function startOfYear(date: PlainDate): PlainDate;
33
+ export declare function endOfYear(date: PlainDate): PlainDate;
@@ -0,0 +1,105 @@
1
+ import { civilFromDays, daysFromCivil, daysInMonth, daysInYear, isLeapYear, MAX_YEAR, MIN_YEAR, } from "./epoch-day.js";
2
+ export { daysInMonth, daysInYear, isLeapYear };
3
+ export function isValidDate(year, month, day) {
4
+ return (Number.isInteger(year) &&
5
+ Number.isInteger(month) &&
6
+ Number.isInteger(day) &&
7
+ year >= MIN_YEAR &&
8
+ year <= MAX_YEAR &&
9
+ month >= 1 &&
10
+ month <= 12 &&
11
+ day >= 1 &&
12
+ day <= daysInMonth(year, month));
13
+ }
14
+ /**
15
+ * Create a frozen {@link PlainDate}. Invalid input throws a `RangeError`, or
16
+ * is clamped into the month with `overflow: "constrain"`.
17
+ */
18
+ export function plainDate(year, month, day, options = {}) {
19
+ if (options.overflow === "constrain") {
20
+ if (Number.isInteger(year) &&
21
+ Number.isInteger(month) &&
22
+ Number.isInteger(day) &&
23
+ year >= MIN_YEAR &&
24
+ year <= MAX_YEAR &&
25
+ month >= 1 &&
26
+ month <= 12) {
27
+ return Object.freeze({
28
+ calendar: "gregory",
29
+ year,
30
+ month,
31
+ day: Math.min(Math.max(day, 1), daysInMonth(year, month)),
32
+ });
33
+ }
34
+ }
35
+ if (!isValidDate(year, month, day)) {
36
+ throw new RangeError(`Invalid date ${year}-${month}-${day}: year must be ${MIN_YEAR}-${MAX_YEAR}, month 1-12 and day within the month.`);
37
+ }
38
+ return Object.freeze({ calendar: "gregory", year, month, day });
39
+ }
40
+ export function toEpochDay(date) {
41
+ return daysFromCivil(date.year, date.month, date.day);
42
+ }
43
+ export function fromEpochDay(epochDay) {
44
+ const [year, month, day] = civilFromDays(epochDay);
45
+ if (year < MIN_YEAR || year > MAX_YEAR) {
46
+ throw new RangeError(`Date out of range: year ${year} is outside ${MIN_YEAR}-${MAX_YEAR}.`);
47
+ }
48
+ return Object.freeze({ calendar: "gregory", year, month, day });
49
+ }
50
+ /** 1 = Monday ... 7 = Sunday. */
51
+ export function dayOfWeek(date) {
52
+ return dayOfWeekFromEpochDay(toEpochDay(date));
53
+ }
54
+ export function dayOfWeekFromEpochDay(epochDay) {
55
+ // 1970-01-01 was a Thursday (4).
56
+ return (((((epochDay + 3) % 7) + 7) % 7) + 1);
57
+ }
58
+ export function dayOfYear(date) {
59
+ return toEpochDay(date) - daysFromCivil(date.year, 1, 1) + 1;
60
+ }
61
+ export function addDays(date, days) {
62
+ return fromEpochDay(toEpochDay(date) + days);
63
+ }
64
+ export function addWeeks(date, weeks) {
65
+ return addDays(date, weeks * 7);
66
+ }
67
+ export function addMonths(date, months, options = {}) {
68
+ const index = date.year * 12 + (date.month - 1) + months;
69
+ const year = Math.floor(index / 12);
70
+ const month = index - year * 12 + 1;
71
+ if (year < MIN_YEAR || year > MAX_YEAR) {
72
+ throw new RangeError(`Date out of range: year ${year}.`);
73
+ }
74
+ const limit = daysInMonth(year, month);
75
+ if (date.day > limit && options.overflow === "reject") {
76
+ throw new RangeError(`${year}-${month}-${date.day} does not exist (overflow: "reject").`);
77
+ }
78
+ return plainDate(year, month, Math.min(date.day, limit));
79
+ }
80
+ export function addYears(date, years, options = {}) {
81
+ return addMonths(date, years * 12, options);
82
+ }
83
+ /** `a - b` in whole days. */
84
+ export function diffDays(a, b) {
85
+ return toEpochDay(a) - toEpochDay(b);
86
+ }
87
+ export function startOfWeek(date, weekStartsOn) {
88
+ const offset = (dayOfWeek(date) - weekStartsOn + 7) % 7;
89
+ return addDays(date, -offset);
90
+ }
91
+ export function endOfWeek(date, weekStartsOn) {
92
+ return addDays(startOfWeek(date, weekStartsOn), 6);
93
+ }
94
+ export function startOfMonth(date) {
95
+ return plainDate(date.year, date.month, 1);
96
+ }
97
+ export function endOfMonth(date) {
98
+ return plainDate(date.year, date.month, daysInMonth(date.year, date.month));
99
+ }
100
+ export function startOfYear(date) {
101
+ return plainDate(date.year, 1, 1);
102
+ }
103
+ export function endOfYear(date) {
104
+ return plainDate(date.year, 12, 31);
105
+ }
@@ -0,0 +1,15 @@
1
+ import type { PlainTime } from "./types.js";
2
+ export declare const SECONDS_PER_DAY = 86400;
3
+ export declare function isValidTime(hour: number, minute: number, second: number): boolean;
4
+ export declare function plainTime(hour: number, minute: number, second?: number): PlainTime;
5
+ export declare function toSecondOfDay(time: PlainTime): number;
6
+ export declare function fromSecondOfDay(secondOfDay: number): PlainTime;
7
+ /** Add seconds, wrapping at midnight. `dayDelta` is the number of days carried. */
8
+ export declare function addSeconds(time: PlainTime, seconds: number): {
9
+ time: PlainTime;
10
+ dayDelta: number;
11
+ };
12
+ export declare function addMinutes(time: PlainTime, minutes: number): {
13
+ time: PlainTime;
14
+ dayDelta: number;
15
+ };
@@ -0,0 +1,45 @@
1
+ export const SECONDS_PER_DAY = 86400;
2
+ export function isValidTime(hour, minute, second) {
3
+ return (Number.isInteger(hour) &&
4
+ Number.isInteger(minute) &&
5
+ Number.isInteger(second) &&
6
+ hour >= 0 &&
7
+ hour <= 23 &&
8
+ minute >= 0 &&
9
+ minute <= 59 &&
10
+ second >= 0 &&
11
+ second <= 59);
12
+ }
13
+ export function plainTime(hour, minute, second = 0) {
14
+ if (!isValidTime(hour, minute, second)) {
15
+ throw new RangeError(`Invalid time ${hour}:${minute}:${second}: expected hour 0-23, minute 0-59, second 0-59.`);
16
+ }
17
+ return Object.freeze({ hour, minute, second });
18
+ }
19
+ export function toSecondOfDay(time) {
20
+ return time.hour * 3600 + time.minute * 60 + time.second;
21
+ }
22
+ export function fromSecondOfDay(secondOfDay) {
23
+ if (!Number.isInteger(secondOfDay) ||
24
+ secondOfDay < 0 ||
25
+ secondOfDay >= SECONDS_PER_DAY) {
26
+ throw new RangeError(`Second of day out of range: ${secondOfDay}.`);
27
+ }
28
+ return Object.freeze({
29
+ hour: Math.floor(secondOfDay / 3600),
30
+ minute: Math.floor((secondOfDay % 3600) / 60),
31
+ second: secondOfDay % 60,
32
+ });
33
+ }
34
+ /** Add seconds, wrapping at midnight. `dayDelta` is the number of days carried. */
35
+ export function addSeconds(time, seconds) {
36
+ const total = toSecondOfDay(time) + seconds;
37
+ const dayDelta = Math.floor(total / SECONDS_PER_DAY);
38
+ return {
39
+ time: fromSecondOfDay(total - dayDelta * SECONDS_PER_DAY),
40
+ dayDelta,
41
+ };
42
+ }
43
+ export function addMinutes(time, minutes) {
44
+ return addSeconds(time, minutes * 60);
45
+ }
@@ -0,0 +1,37 @@
1
+ /** ISO weekday number: 1 = Monday ... 7 = Sunday (plan 03 D2). */
2
+ export type DayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
3
+ /** A calendar date with no time and no time zone. Months are 1-based (D2). */
4
+ export type PlainDate = Readonly<{
5
+ calendar: "gregory";
6
+ year: number;
7
+ month: number;
8
+ day: number;
9
+ }>;
10
+ /** A wall-clock time with no date and no time zone. Second precision (D6). */
11
+ export type PlainTime = Readonly<{
12
+ hour: number;
13
+ minute: number;
14
+ second: number;
15
+ }>;
16
+ export type PlainDateTime = Readonly<PlainDate & PlainTime>;
17
+ /** A wall-clock date-time pinned to a time zone. `offset` is minutes east of UTC (D7). */
18
+ export type ZonedDateTime = Readonly<PlainDateTime & {
19
+ timeZone: string;
20
+ offset: number;
21
+ }>;
22
+ /** How a wall time that is skipped or repeated by a DST change is resolved (D8). */
23
+ export type Disambiguation = "compatible" | "earlier" | "later" | "reject";
24
+ /** What public props accept for a date. */
25
+ export type DateInput = PlainDate | string | Date;
26
+ /** What public props accept for a time. */
27
+ export type TimeInput = PlainTime | string;
28
+ /** What public props accept for a date-time (plan 05 R4). */
29
+ export type DateTimeInput = PlainDateTime | ZonedDateTime | string;
30
+ /** `constrain` clamps an overflowing day; `reject` throws (D5). */
31
+ export type Overflow = "constrain" | "reject";
32
+ /** Locale week rules (D12). */
33
+ export type WeekInfo = Readonly<{
34
+ firstDay: DayOfWeek;
35
+ weekend: readonly DayOfWeek[];
36
+ minimalDays: 1 | 2 | 3 | 4 | 5 | 6 | 7;
37
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { PlainDate, WeekInfo } from "./types.js";
2
+ export type WeekNumber = {
3
+ year: number;
4
+ week: number;
5
+ };
6
+ /** ISO 8601 week: weeks start on Monday, week 1 contains January 4th. */
7
+ export declare function getIsoWeek(date: PlainDate): WeekNumber;
8
+ /** Week number under a locale's first day and minimal days. */
9
+ export declare function getLocaleWeek(date: PlainDate, weekInfo: Pick<WeekInfo, "firstDay" | "minimalDays">): WeekNumber;
@@ -0,0 +1,31 @@
1
+ import { daysFromCivil } from "./epoch-day.js";
2
+ import { dayOfWeekFromEpochDay, toEpochDay } from "./plain-date.js";
3
+ const ISO_WEEK_INFO = { firstDay: 1, minimalDays: 4 };
4
+ /** Epoch day on which week 1 of `year` starts under the given rules. */
5
+ function firstWeekStart(year, firstDay, minimalDays) {
6
+ const jan1 = daysFromCivil(year, 1, 1);
7
+ const offset = (dayOfWeekFromEpochDay(jan1) - firstDay + 7) % 7;
8
+ const weekStart = jan1 - offset;
9
+ const daysInYearPart = 7 - offset;
10
+ return daysInYearPart >= minimalDays ? weekStart : weekStart + 7;
11
+ }
12
+ function weekNumber(date, firstDay, minimalDays) {
13
+ const day = toEpochDay(date);
14
+ let year = date.year;
15
+ if (day >= firstWeekStart(year + 1, firstDay, minimalDays)) {
16
+ year += 1;
17
+ }
18
+ else if (day < firstWeekStart(year, firstDay, minimalDays)) {
19
+ year -= 1;
20
+ }
21
+ const week = Math.floor((day - firstWeekStart(year, firstDay, minimalDays)) / 7) + 1;
22
+ return { year, week };
23
+ }
24
+ /** ISO 8601 week: weeks start on Monday, week 1 contains January 4th. */
25
+ export function getIsoWeek(date) {
26
+ return weekNumber(date, ISO_WEEK_INFO.firstDay, ISO_WEEK_INFO.minimalDays);
27
+ }
28
+ /** Week number under a locale's first day and minimal days. */
29
+ export function getLocaleWeek(date, weekInfo) {
30
+ return weekNumber(date, weekInfo.firstDay, weekInfo.minimalDays);
31
+ }
@@ -0,0 +1,10 @@
1
+ import type { PlainDate } from "./types.js";
2
+ /** A calendar month without a day (plan 06 A25). Months are 1-based. */
3
+ export type PlainYearMonth = Readonly<{
4
+ year: number;
5
+ month: number;
6
+ }>;
7
+ export declare function plainYearMonth(year: number, month: number): PlainYearMonth;
8
+ export declare const toPlainYearMonth: (date: PlainDate) => PlainYearMonth;
9
+ export declare const compareYearMonth: (a: PlainYearMonth, b: PlainYearMonth) => number;
10
+ export declare function addMonthsToYearMonth(value: PlainYearMonth, months: number): PlainYearMonth;
@@ -0,0 +1,19 @@
1
+ import { MAX_YEAR, MIN_YEAR } from "./epoch-day.js";
2
+ export function plainYearMonth(year, month) {
3
+ if (!Number.isInteger(year) ||
4
+ !Number.isInteger(month) ||
5
+ year < MIN_YEAR ||
6
+ year > MAX_YEAR ||
7
+ month < 1 ||
8
+ month > 12) {
9
+ throw new RangeError(`${year}-${month} is not a valid year and month.`);
10
+ }
11
+ return Object.freeze({ year, month });
12
+ }
13
+ export const toPlainYearMonth = (date) => plainYearMonth(date.year, date.month);
14
+ export const compareYearMonth = (a, b) => a.year * 12 + a.month - (b.year * 12 + b.month);
15
+ export function addMonthsToYearMonth(value, months) {
16
+ const total = value.year * 12 + (value.month - 1) + months;
17
+ const year = Math.floor(total / 12);
18
+ return plainYearMonth(year, total - year * 12 + 1);
19
+ }
@@ -0,0 +1,16 @@
1
+ import type { Disambiguation, PlainDateTime, ZonedDateTime } from "./types.js";
2
+ /** Minutes east of UTC for a fixed-offset id such as `+05:30`, else `null`. */
3
+ export declare function parseOffsetId(id: string): number | null;
4
+ /** `true` for an IANA zone id the runtime knows, or a fixed offset such as `+05:30`. */
5
+ export declare function isValidTimeZone(timeZone: string): boolean;
6
+ /**
7
+ * Offset of `timeZone` at an instant, in minutes east of UTC. Historical
8
+ * offsets with seconds (pre-1900 local mean time) are rounded to the minute.
9
+ */
10
+ export declare function getOffset(epochMs: number, timeZone: string): number;
11
+ /** The instant (epoch milliseconds) a zoned value points at. */
12
+ export declare function toInstant(zoned: ZonedDateTime): number;
13
+ export declare function fromInstant(epochMs: number, timeZone: string): ZonedDateTime;
14
+ /** Pin a wall time to a zone. DST gaps and overlaps follow `disambiguation` (D8). */
15
+ export declare function toZoned(dateTime: PlainDateTime, timeZone: string, disambiguation?: Disambiguation): ZonedDateTime;
16
+ export declare function withTimeZone(zoned: ZonedDateTime, timeZone: string): ZonedDateTime;