@cdx-ui/formatters 0.0.1-beta.132

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 (464) hide show
  1. package/README.md +108 -0
  2. package/lib/commonjs/dates/calendar/formatCalendarMonthYear.js +28 -0
  3. package/lib/commonjs/dates/calendar/formatCalendarMonthYear.js.map +1 -0
  4. package/lib/commonjs/dates/calendar/formatDateTimeListDateRow.js +40 -0
  5. package/lib/commonjs/dates/calendar/formatDateTimeListDateRow.js.map +1 -0
  6. package/lib/commonjs/dates/calendar/formatMonthCalendarMonth.js +28 -0
  7. package/lib/commonjs/dates/calendar/formatMonthCalendarMonth.js.map +1 -0
  8. package/lib/commonjs/dates/calendar/formatMonthCalendarYear.js +16 -0
  9. package/lib/commonjs/dates/calendar/formatMonthCalendarYear.js.map +1 -0
  10. package/lib/commonjs/dates/calendar/getCalendarWeekdayLabels.js +23 -0
  11. package/lib/commonjs/dates/calendar/getCalendarWeekdayLabels.js.map +1 -0
  12. package/lib/commonjs/dates/datetime/clampDateTimeId.js +27 -0
  13. package/lib/commonjs/dates/datetime/clampDateTimeId.js.map +1 -0
  14. package/lib/commonjs/dates/datetime/compareDateTimeIds.js +28 -0
  15. package/lib/commonjs/dates/datetime/compareDateTimeIds.js.map +1 -0
  16. package/lib/commonjs/dates/datetime/dateTimeId.js +38 -0
  17. package/lib/commonjs/dates/datetime/dateTimeId.js.map +1 -0
  18. package/lib/commonjs/dates/datetime/formatDateTimeId.js +27 -0
  19. package/lib/commonjs/dates/datetime/formatDateTimeId.js.map +1 -0
  20. package/lib/commonjs/dates/datetime/formatDateTimeListHour.js +21 -0
  21. package/lib/commonjs/dates/datetime/formatDateTimeListHour.js.map +1 -0
  22. package/lib/commonjs/dates/datetime/formatDateTimeListMinute.js +16 -0
  23. package/lib/commonjs/dates/datetime/formatDateTimeListMinute.js.map +1 -0
  24. package/lib/commonjs/dates/datetime/formatDateTimeListPeriod.js +17 -0
  25. package/lib/commonjs/dates/datetime/formatDateTimeListPeriod.js.map +1 -0
  26. package/lib/commonjs/dates/datetime/isLocaleHour12.js +30 -0
  27. package/lib/commonjs/dates/datetime/isLocaleHour12.js.map +1 -0
  28. package/lib/commonjs/dates/datetime/isValidDateTimeId.js +23 -0
  29. package/lib/commonjs/dates/datetime/isValidDateTimeId.js.map +1 -0
  30. package/lib/commonjs/dates/datetime/nowDateTimeId.js +57 -0
  31. package/lib/commonjs/dates/datetime/nowDateTimeId.js.map +1 -0
  32. package/lib/commonjs/dates/datetime/parseDateTimeId.js +29 -0
  33. package/lib/commonjs/dates/datetime/parseDateTimeId.js.map +1 -0
  34. package/lib/commonjs/dates/display/formatDateForDisplay.js +28 -0
  35. package/lib/commonjs/dates/display/formatDateForDisplay.js.map +1 -0
  36. package/lib/commonjs/dates/display/formatDateRangeForDisplay.js +25 -0
  37. package/lib/commonjs/dates/display/formatDateRangeForDisplay.js.map +1 -0
  38. package/lib/commonjs/dates/display/formatDateTimeForDisplay.js +34 -0
  39. package/lib/commonjs/dates/display/formatDateTimeForDisplay.js.map +1 -0
  40. package/lib/commonjs/dates/display/formatMonthForDisplay.js +33 -0
  41. package/lib/commonjs/dates/display/formatMonthForDisplay.js.map +1 -0
  42. package/lib/commonjs/dates/index.js +367 -0
  43. package/lib/commonjs/dates/index.js.map +1 -0
  44. package/lib/commonjs/dates/internal/brand.js +19 -0
  45. package/lib/commonjs/dates/internal/brand.js.map +1 -0
  46. package/lib/commonjs/dates/internal/calendarHelpers.js +22 -0
  47. package/lib/commonjs/dates/internal/calendarHelpers.js.map +1 -0
  48. package/lib/commonjs/dates/internal/clampHelpers.js +20 -0
  49. package/lib/commonjs/dates/internal/clampHelpers.js.map +1 -0
  50. package/lib/commonjs/dates/internal/dateIdToNativeDate.js +20 -0
  51. package/lib/commonjs/dates/internal/dateIdToNativeDate.js.map +1 -0
  52. package/lib/commonjs/dates/internal/intlCache.js +52 -0
  53. package/lib/commonjs/dates/internal/intlCache.js.map +1 -0
  54. package/lib/commonjs/dates/internal/intlCopy.js +72 -0
  55. package/lib/commonjs/dates/internal/intlCopy.js.map +1 -0
  56. package/lib/commonjs/dates/internal/segmentBuilders.js +98 -0
  57. package/lib/commonjs/dates/internal/segmentBuilders.js.map +1 -0
  58. package/lib/commonjs/dates/labels/dateComponentLabels.js +57 -0
  59. package/lib/commonjs/dates/labels/dateComponentLabels.js.map +1 -0
  60. package/lib/commonjs/dates/ranges/compareDateIds.js +26 -0
  61. package/lib/commonjs/dates/ranges/compareDateIds.js.map +1 -0
  62. package/lib/commonjs/dates/ranges/compareMonthIds.js +31 -0
  63. package/lib/commonjs/dates/ranges/compareMonthIds.js.map +1 -0
  64. package/lib/commonjs/dates/ranges/dateRangeAroundDay.js +25 -0
  65. package/lib/commonjs/dates/ranges/dateRangeAroundDay.js.map +1 -0
  66. package/lib/commonjs/dates/ranges/dateRangeFromLastNDays.js +28 -0
  67. package/lib/commonjs/dates/ranges/dateRangeFromLastNDays.js.map +1 -0
  68. package/lib/commonjs/dates/ranges/eachDateIdInRange.js +29 -0
  69. package/lib/commonjs/dates/ranges/eachDateIdInRange.js.map +1 -0
  70. package/lib/commonjs/dates/ranges/normalizeDateRange.js +23 -0
  71. package/lib/commonjs/dates/ranges/normalizeDateRange.js.map +1 -0
  72. package/lib/commonjs/dates/segments/applyDateSegmentChange.js +77 -0
  73. package/lib/commonjs/dates/segments/applyDateSegmentChange.js.map +1 -0
  74. package/lib/commonjs/dates/segments/formatDateSegment.js +19 -0
  75. package/lib/commonjs/dates/segments/formatDateSegment.js.map +1 -0
  76. package/lib/commonjs/dates/segments/getDateFieldSegments.js +44 -0
  77. package/lib/commonjs/dates/segments/getDateFieldSegments.js.map +1 -0
  78. package/lib/commonjs/dates/segments/getDateTimeFieldSegments.js +150 -0
  79. package/lib/commonjs/dates/segments/getDateTimeFieldSegments.js.map +1 -0
  80. package/lib/commonjs/dates/segments/getDateTimeSegmentVisibility.js +15 -0
  81. package/lib/commonjs/dates/segments/getDateTimeSegmentVisibility.js.map +1 -0
  82. package/lib/commonjs/dates/segments/getEmptyDateSegmentText.js +17 -0
  83. package/lib/commonjs/dates/segments/getEmptyDateSegmentText.js.map +1 -0
  84. package/lib/commonjs/dates/segments/parseDateSegment.js +26 -0
  85. package/lib/commonjs/dates/segments/parseDateSegment.js.map +1 -0
  86. package/lib/commonjs/dates/types.js +2 -0
  87. package/lib/commonjs/dates/types.js.map +1 -0
  88. package/lib/commonjs/dates/wire/clampDateParts.js +26 -0
  89. package/lib/commonjs/dates/wire/clampDateParts.js.map +1 -0
  90. package/lib/commonjs/dates/wire/clampMonthParts.js +23 -0
  91. package/lib/commonjs/dates/wire/clampMonthParts.js.map +1 -0
  92. package/lib/commonjs/dates/wire/dateId.js +50 -0
  93. package/lib/commonjs/dates/wire/dateId.js.map +1 -0
  94. package/lib/commonjs/dates/wire/formatDateId.js +25 -0
  95. package/lib/commonjs/dates/wire/formatDateId.js.map +1 -0
  96. package/lib/commonjs/dates/wire/formatMonthId.js +21 -0
  97. package/lib/commonjs/dates/wire/formatMonthId.js.map +1 -0
  98. package/lib/commonjs/dates/wire/isValidDateId.js +27 -0
  99. package/lib/commonjs/dates/wire/isValidDateId.js.map +1 -0
  100. package/lib/commonjs/dates/wire/isValidDateParts.js +18 -0
  101. package/lib/commonjs/dates/wire/isValidDateParts.js.map +1 -0
  102. package/lib/commonjs/dates/wire/isValidMonthId.js +27 -0
  103. package/lib/commonjs/dates/wire/isValidMonthId.js.map +1 -0
  104. package/lib/commonjs/dates/wire/isValidMonthParts.js +16 -0
  105. package/lib/commonjs/dates/wire/isValidMonthParts.js.map +1 -0
  106. package/lib/commonjs/dates/wire/monthId.js +47 -0
  107. package/lib/commonjs/dates/wire/monthId.js.map +1 -0
  108. package/lib/commonjs/dates/wire/parseDateId.js +29 -0
  109. package/lib/commonjs/dates/wire/parseDateId.js.map +1 -0
  110. package/lib/commonjs/dates/wire/parseMonthId.js +28 -0
  111. package/lib/commonjs/dates/wire/parseMonthId.js.map +1 -0
  112. package/lib/commonjs/dates/wire/toMonthId.js +22 -0
  113. package/lib/commonjs/dates/wire/toMonthId.js.map +1 -0
  114. package/lib/commonjs/dates/wire/todayDateId.js +17 -0
  115. package/lib/commonjs/dates/wire/todayDateId.js.map +1 -0
  116. package/lib/commonjs/dates/wire/todayMonthId.js +17 -0
  117. package/lib/commonjs/dates/wire/todayMonthId.js.map +1 -0
  118. package/lib/commonjs/formatNumber.js +50 -0
  119. package/lib/commonjs/formatNumber.js.map +1 -0
  120. package/lib/commonjs/index.js +326 -0
  121. package/lib/commonjs/index.js.map +1 -0
  122. package/lib/commonjs/package.json +1 -0
  123. package/lib/commonjs/types.js +2 -0
  124. package/lib/commonjs/types.js.map +1 -0
  125. package/lib/commonjs/utils.js +33 -0
  126. package/lib/commonjs/utils.js.map +1 -0
  127. package/lib/module/dates/calendar/formatCalendarMonthYear.js +24 -0
  128. package/lib/module/dates/calendar/formatCalendarMonthYear.js.map +1 -0
  129. package/lib/module/dates/calendar/formatDateTimeListDateRow.js +36 -0
  130. package/lib/module/dates/calendar/formatDateTimeListDateRow.js.map +1 -0
  131. package/lib/module/dates/calendar/formatMonthCalendarMonth.js +24 -0
  132. package/lib/module/dates/calendar/formatMonthCalendarMonth.js.map +1 -0
  133. package/lib/module/dates/calendar/formatMonthCalendarYear.js +12 -0
  134. package/lib/module/dates/calendar/formatMonthCalendarYear.js.map +1 -0
  135. package/lib/module/dates/calendar/getCalendarWeekdayLabels.js +19 -0
  136. package/lib/module/dates/calendar/getCalendarWeekdayLabels.js.map +1 -0
  137. package/lib/module/dates/datetime/clampDateTimeId.js +24 -0
  138. package/lib/module/dates/datetime/clampDateTimeId.js.map +1 -0
  139. package/lib/module/dates/datetime/compareDateTimeIds.js +24 -0
  140. package/lib/module/dates/datetime/compareDateTimeIds.js.map +1 -0
  141. package/lib/module/dates/datetime/dateTimeId.js +35 -0
  142. package/lib/module/dates/datetime/dateTimeId.js.map +1 -0
  143. package/lib/module/dates/datetime/formatDateTimeId.js +23 -0
  144. package/lib/module/dates/datetime/formatDateTimeId.js.map +1 -0
  145. package/lib/module/dates/datetime/formatDateTimeListHour.js +17 -0
  146. package/lib/module/dates/datetime/formatDateTimeListHour.js.map +1 -0
  147. package/lib/module/dates/datetime/formatDateTimeListMinute.js +12 -0
  148. package/lib/module/dates/datetime/formatDateTimeListMinute.js.map +1 -0
  149. package/lib/module/dates/datetime/formatDateTimeListPeriod.js +13 -0
  150. package/lib/module/dates/datetime/formatDateTimeListPeriod.js.map +1 -0
  151. package/lib/module/dates/datetime/isLocaleHour12.js +26 -0
  152. package/lib/module/dates/datetime/isLocaleHour12.js.map +1 -0
  153. package/lib/module/dates/datetime/isValidDateTimeId.js +19 -0
  154. package/lib/module/dates/datetime/isValidDateTimeId.js.map +1 -0
  155. package/lib/module/dates/datetime/nowDateTimeId.js +54 -0
  156. package/lib/module/dates/datetime/nowDateTimeId.js.map +1 -0
  157. package/lib/module/dates/datetime/parseDateTimeId.js +26 -0
  158. package/lib/module/dates/datetime/parseDateTimeId.js.map +1 -0
  159. package/lib/module/dates/display/formatDateForDisplay.js +24 -0
  160. package/lib/module/dates/display/formatDateForDisplay.js.map +1 -0
  161. package/lib/module/dates/display/formatDateRangeForDisplay.js +22 -0
  162. package/lib/module/dates/display/formatDateRangeForDisplay.js.map +1 -0
  163. package/lib/module/dates/display/formatDateTimeForDisplay.js +30 -0
  164. package/lib/module/dates/display/formatDateTimeForDisplay.js.map +1 -0
  165. package/lib/module/dates/display/formatMonthForDisplay.js +29 -0
  166. package/lib/module/dates/display/formatMonthForDisplay.js.map +1 -0
  167. package/lib/module/dates/index.js +59 -0
  168. package/lib/module/dates/index.js.map +1 -0
  169. package/lib/module/dates/internal/brand.js +12 -0
  170. package/lib/module/dates/internal/brand.js.map +1 -0
  171. package/lib/module/dates/internal/calendarHelpers.js +19 -0
  172. package/lib/module/dates/internal/calendarHelpers.js.map +1 -0
  173. package/lib/module/dates/internal/clampHelpers.js +14 -0
  174. package/lib/module/dates/internal/clampHelpers.js.map +1 -0
  175. package/lib/module/dates/internal/dateIdToNativeDate.js +16 -0
  176. package/lib/module/dates/internal/dateIdToNativeDate.js.map +1 -0
  177. package/lib/module/dates/internal/intlCache.js +47 -0
  178. package/lib/module/dates/internal/intlCache.js.map +1 -0
  179. package/lib/module/dates/internal/intlCopy.js +66 -0
  180. package/lib/module/dates/internal/intlCopy.js.map +1 -0
  181. package/lib/module/dates/internal/segmentBuilders.js +91 -0
  182. package/lib/module/dates/internal/segmentBuilders.js.map +1 -0
  183. package/lib/module/dates/labels/dateComponentLabels.js +50 -0
  184. package/lib/module/dates/labels/dateComponentLabels.js.map +1 -0
  185. package/lib/module/dates/ranges/compareDateIds.js +22 -0
  186. package/lib/module/dates/ranges/compareDateIds.js.map +1 -0
  187. package/lib/module/dates/ranges/compareMonthIds.js +27 -0
  188. package/lib/module/dates/ranges/compareMonthIds.js.map +1 -0
  189. package/lib/module/dates/ranges/dateRangeAroundDay.js +21 -0
  190. package/lib/module/dates/ranges/dateRangeAroundDay.js.map +1 -0
  191. package/lib/module/dates/ranges/dateRangeFromLastNDays.js +24 -0
  192. package/lib/module/dates/ranges/dateRangeFromLastNDays.js.map +1 -0
  193. package/lib/module/dates/ranges/eachDateIdInRange.js +26 -0
  194. package/lib/module/dates/ranges/eachDateIdInRange.js.map +1 -0
  195. package/lib/module/dates/ranges/normalizeDateRange.js +20 -0
  196. package/lib/module/dates/ranges/normalizeDateRange.js.map +1 -0
  197. package/lib/module/dates/segments/applyDateSegmentChange.js +73 -0
  198. package/lib/module/dates/segments/applyDateSegmentChange.js.map +1 -0
  199. package/lib/module/dates/segments/formatDateSegment.js +15 -0
  200. package/lib/module/dates/segments/formatDateSegment.js.map +1 -0
  201. package/lib/module/dates/segments/getDateFieldSegments.js +40 -0
  202. package/lib/module/dates/segments/getDateFieldSegments.js.map +1 -0
  203. package/lib/module/dates/segments/getDateTimeFieldSegments.js +147 -0
  204. package/lib/module/dates/segments/getDateTimeFieldSegments.js.map +1 -0
  205. package/lib/module/dates/segments/getDateTimeSegmentVisibility.js +11 -0
  206. package/lib/module/dates/segments/getDateTimeSegmentVisibility.js.map +1 -0
  207. package/lib/module/dates/segments/getEmptyDateSegmentText.js +13 -0
  208. package/lib/module/dates/segments/getEmptyDateSegmentText.js.map +1 -0
  209. package/lib/module/dates/segments/parseDateSegment.js +22 -0
  210. package/lib/module/dates/segments/parseDateSegment.js.map +1 -0
  211. package/lib/module/dates/types.js +2 -0
  212. package/lib/module/dates/types.js.map +1 -0
  213. package/lib/module/dates/wire/clampDateParts.js +22 -0
  214. package/lib/module/dates/wire/clampDateParts.js.map +1 -0
  215. package/lib/module/dates/wire/clampMonthParts.js +19 -0
  216. package/lib/module/dates/wire/clampMonthParts.js.map +1 -0
  217. package/lib/module/dates/wire/dateId.js +47 -0
  218. package/lib/module/dates/wire/dateId.js.map +1 -0
  219. package/lib/module/dates/wire/formatDateId.js +22 -0
  220. package/lib/module/dates/wire/formatDateId.js.map +1 -0
  221. package/lib/module/dates/wire/formatMonthId.js +17 -0
  222. package/lib/module/dates/wire/formatMonthId.js.map +1 -0
  223. package/lib/module/dates/wire/isValidDateId.js +23 -0
  224. package/lib/module/dates/wire/isValidDateId.js.map +1 -0
  225. package/lib/module/dates/wire/isValidDateParts.js +14 -0
  226. package/lib/module/dates/wire/isValidDateParts.js.map +1 -0
  227. package/lib/module/dates/wire/isValidMonthId.js +23 -0
  228. package/lib/module/dates/wire/isValidMonthId.js.map +1 -0
  229. package/lib/module/dates/wire/isValidMonthParts.js +12 -0
  230. package/lib/module/dates/wire/isValidMonthParts.js.map +1 -0
  231. package/lib/module/dates/wire/monthId.js +44 -0
  232. package/lib/module/dates/wire/monthId.js.map +1 -0
  233. package/lib/module/dates/wire/parseDateId.js +26 -0
  234. package/lib/module/dates/wire/parseDateId.js.map +1 -0
  235. package/lib/module/dates/wire/parseMonthId.js +25 -0
  236. package/lib/module/dates/wire/parseMonthId.js.map +1 -0
  237. package/lib/module/dates/wire/toMonthId.js +18 -0
  238. package/lib/module/dates/wire/toMonthId.js.map +1 -0
  239. package/lib/module/dates/wire/todayDateId.js +13 -0
  240. package/lib/module/dates/wire/todayDateId.js.map +1 -0
  241. package/lib/module/dates/wire/todayMonthId.js +13 -0
  242. package/lib/module/dates/wire/todayMonthId.js.map +1 -0
  243. package/lib/module/formatNumber.js +46 -0
  244. package/lib/module/formatNumber.js.map +1 -0
  245. package/lib/module/index.js +17 -0
  246. package/lib/module/index.js.map +1 -0
  247. package/lib/module/types.js +2 -0
  248. package/lib/module/types.js.map +1 -0
  249. package/lib/module/utils.js +29 -0
  250. package/lib/module/utils.js.map +1 -0
  251. package/lib/typescript/dates/calendar/formatCalendarMonthYear.d.ts +12 -0
  252. package/lib/typescript/dates/calendar/formatCalendarMonthYear.d.ts.map +1 -0
  253. package/lib/typescript/dates/calendar/formatDateTimeListDateRow.d.ts +13 -0
  254. package/lib/typescript/dates/calendar/formatDateTimeListDateRow.d.ts.map +1 -0
  255. package/lib/typescript/dates/calendar/formatMonthCalendarMonth.d.ts +13 -0
  256. package/lib/typescript/dates/calendar/formatMonthCalendarMonth.d.ts.map +1 -0
  257. package/lib/typescript/dates/calendar/formatMonthCalendarYear.d.ts +8 -0
  258. package/lib/typescript/dates/calendar/formatMonthCalendarYear.d.ts.map +1 -0
  259. package/lib/typescript/dates/calendar/getCalendarWeekdayLabels.d.ts +12 -0
  260. package/lib/typescript/dates/calendar/getCalendarWeekdayLabels.d.ts.map +1 -0
  261. package/lib/typescript/dates/datetime/clampDateTimeId.d.ts +16 -0
  262. package/lib/typescript/dates/datetime/clampDateTimeId.d.ts.map +1 -0
  263. package/lib/typescript/dates/datetime/compareDateTimeIds.d.ts +13 -0
  264. package/lib/typescript/dates/datetime/compareDateTimeIds.d.ts.map +1 -0
  265. package/lib/typescript/dates/datetime/dateTimeId.d.ts +18 -0
  266. package/lib/typescript/dates/datetime/dateTimeId.d.ts.map +1 -0
  267. package/lib/typescript/dates/datetime/formatDateTimeId.d.ts +12 -0
  268. package/lib/typescript/dates/datetime/formatDateTimeId.d.ts.map +1 -0
  269. package/lib/typescript/dates/datetime/formatDateTimeListHour.d.ts +11 -0
  270. package/lib/typescript/dates/datetime/formatDateTimeListHour.d.ts.map +1 -0
  271. package/lib/typescript/dates/datetime/formatDateTimeListMinute.d.ts +8 -0
  272. package/lib/typescript/dates/datetime/formatDateTimeListMinute.d.ts.map +1 -0
  273. package/lib/typescript/dates/datetime/formatDateTimeListPeriod.d.ts +9 -0
  274. package/lib/typescript/dates/datetime/formatDateTimeListPeriod.d.ts.map +1 -0
  275. package/lib/typescript/dates/datetime/isLocaleHour12.d.ts +12 -0
  276. package/lib/typescript/dates/datetime/isLocaleHour12.d.ts.map +1 -0
  277. package/lib/typescript/dates/datetime/isValidDateTimeId.d.ts +9 -0
  278. package/lib/typescript/dates/datetime/isValidDateTimeId.d.ts.map +1 -0
  279. package/lib/typescript/dates/datetime/nowDateTimeId.d.ts +14 -0
  280. package/lib/typescript/dates/datetime/nowDateTimeId.d.ts.map +1 -0
  281. package/lib/typescript/dates/datetime/parseDateTimeId.d.ts +9 -0
  282. package/lib/typescript/dates/datetime/parseDateTimeId.d.ts.map +1 -0
  283. package/lib/typescript/dates/display/formatDateForDisplay.d.ts +13 -0
  284. package/lib/typescript/dates/display/formatDateForDisplay.d.ts.map +1 -0
  285. package/lib/typescript/dates/display/formatDateRangeForDisplay.d.ts +16 -0
  286. package/lib/typescript/dates/display/formatDateRangeForDisplay.d.ts.map +1 -0
  287. package/lib/typescript/dates/display/formatDateTimeForDisplay.d.ts +13 -0
  288. package/lib/typescript/dates/display/formatDateTimeForDisplay.d.ts.map +1 -0
  289. package/lib/typescript/dates/display/formatMonthForDisplay.d.ts +13 -0
  290. package/lib/typescript/dates/display/formatMonthForDisplay.d.ts.map +1 -0
  291. package/lib/typescript/dates/index.d.ts +58 -0
  292. package/lib/typescript/dates/index.d.ts.map +1 -0
  293. package/lib/typescript/dates/internal/brand.d.ts +11 -0
  294. package/lib/typescript/dates/internal/brand.d.ts.map +1 -0
  295. package/lib/typescript/dates/internal/calendarHelpers.d.ts +8 -0
  296. package/lib/typescript/dates/internal/calendarHelpers.d.ts.map +1 -0
  297. package/lib/typescript/dates/internal/clampHelpers.d.ts +5 -0
  298. package/lib/typescript/dates/internal/clampHelpers.d.ts.map +1 -0
  299. package/lib/typescript/dates/internal/dateIdToNativeDate.d.ts +12 -0
  300. package/lib/typescript/dates/internal/dateIdToNativeDate.d.ts.map +1 -0
  301. package/lib/typescript/dates/internal/intlCache.d.ts +12 -0
  302. package/lib/typescript/dates/internal/intlCache.d.ts.map +1 -0
  303. package/lib/typescript/dates/internal/intlCopy.d.ts +10 -0
  304. package/lib/typescript/dates/internal/intlCopy.d.ts.map +1 -0
  305. package/lib/typescript/dates/internal/segmentBuilders.d.ts +12 -0
  306. package/lib/typescript/dates/internal/segmentBuilders.d.ts.map +1 -0
  307. package/lib/typescript/dates/labels/dateComponentLabels.d.ts +31 -0
  308. package/lib/typescript/dates/labels/dateComponentLabels.d.ts.map +1 -0
  309. package/lib/typescript/dates/ranges/compareDateIds.d.ts +10 -0
  310. package/lib/typescript/dates/ranges/compareDateIds.d.ts.map +1 -0
  311. package/lib/typescript/dates/ranges/compareMonthIds.d.ts +10 -0
  312. package/lib/typescript/dates/ranges/compareMonthIds.d.ts.map +1 -0
  313. package/lib/typescript/dates/ranges/dateRangeAroundDay.d.ts +14 -0
  314. package/lib/typescript/dates/ranges/dateRangeAroundDay.d.ts.map +1 -0
  315. package/lib/typescript/dates/ranges/dateRangeFromLastNDays.d.ts +16 -0
  316. package/lib/typescript/dates/ranges/dateRangeFromLastNDays.d.ts.map +1 -0
  317. package/lib/typescript/dates/ranges/eachDateIdInRange.d.ts +10 -0
  318. package/lib/typescript/dates/ranges/eachDateIdInRange.d.ts.map +1 -0
  319. package/lib/typescript/dates/ranges/normalizeDateRange.d.ts +15 -0
  320. package/lib/typescript/dates/ranges/normalizeDateRange.d.ts.map +1 -0
  321. package/lib/typescript/dates/segments/applyDateSegmentChange.d.ts +21 -0
  322. package/lib/typescript/dates/segments/applyDateSegmentChange.d.ts.map +1 -0
  323. package/lib/typescript/dates/segments/formatDateSegment.d.ts +13 -0
  324. package/lib/typescript/dates/segments/formatDateSegment.d.ts.map +1 -0
  325. package/lib/typescript/dates/segments/getDateFieldSegments.d.ts +13 -0
  326. package/lib/typescript/dates/segments/getDateFieldSegments.d.ts.map +1 -0
  327. package/lib/typescript/dates/segments/getDateTimeFieldSegments.d.ts +14 -0
  328. package/lib/typescript/dates/segments/getDateTimeFieldSegments.d.ts.map +1 -0
  329. package/lib/typescript/dates/segments/getDateTimeSegmentVisibility.d.ts +8 -0
  330. package/lib/typescript/dates/segments/getDateTimeSegmentVisibility.d.ts.map +1 -0
  331. package/lib/typescript/dates/segments/getEmptyDateSegmentText.d.ts +9 -0
  332. package/lib/typescript/dates/segments/getEmptyDateSegmentText.d.ts.map +1 -0
  333. package/lib/typescript/dates/segments/parseDateSegment.d.ts +13 -0
  334. package/lib/typescript/dates/segments/parseDateSegment.d.ts.map +1 -0
  335. package/lib/typescript/dates/types.d.ts +66 -0
  336. package/lib/typescript/dates/types.d.ts.map +1 -0
  337. package/lib/typescript/dates/wire/clampDateParts.d.ts +12 -0
  338. package/lib/typescript/dates/wire/clampDateParts.d.ts.map +1 -0
  339. package/lib/typescript/dates/wire/clampMonthParts.d.ts +12 -0
  340. package/lib/typescript/dates/wire/clampMonthParts.d.ts.map +1 -0
  341. package/lib/typescript/dates/wire/dateId.d.ts +24 -0
  342. package/lib/typescript/dates/wire/dateId.d.ts.map +1 -0
  343. package/lib/typescript/dates/wire/formatDateId.d.ts +12 -0
  344. package/lib/typescript/dates/wire/formatDateId.d.ts.map +1 -0
  345. package/lib/typescript/dates/wire/formatMonthId.d.ts +12 -0
  346. package/lib/typescript/dates/wire/formatMonthId.d.ts.map +1 -0
  347. package/lib/typescript/dates/wire/isValidDateId.d.ts +13 -0
  348. package/lib/typescript/dates/wire/isValidDateId.d.ts.map +1 -0
  349. package/lib/typescript/dates/wire/isValidDateParts.d.ts +9 -0
  350. package/lib/typescript/dates/wire/isValidDateParts.d.ts.map +1 -0
  351. package/lib/typescript/dates/wire/isValidMonthId.d.ts +13 -0
  352. package/lib/typescript/dates/wire/isValidMonthId.d.ts.map +1 -0
  353. package/lib/typescript/dates/wire/isValidMonthParts.d.ts +9 -0
  354. package/lib/typescript/dates/wire/isValidMonthParts.d.ts.map +1 -0
  355. package/lib/typescript/dates/wire/monthId.d.ts +22 -0
  356. package/lib/typescript/dates/wire/monthId.d.ts.map +1 -0
  357. package/lib/typescript/dates/wire/parseDateId.d.ts +12 -0
  358. package/lib/typescript/dates/wire/parseDateId.d.ts.map +1 -0
  359. package/lib/typescript/dates/wire/parseMonthId.d.ts +12 -0
  360. package/lib/typescript/dates/wire/parseMonthId.d.ts.map +1 -0
  361. package/lib/typescript/dates/wire/toMonthId.d.ts +12 -0
  362. package/lib/typescript/dates/wire/toMonthId.d.ts.map +1 -0
  363. package/lib/typescript/dates/wire/todayDateId.d.ts +8 -0
  364. package/lib/typescript/dates/wire/todayDateId.d.ts.map +1 -0
  365. package/lib/typescript/dates/wire/todayMonthId.d.ts +8 -0
  366. package/lib/typescript/dates/wire/todayMonthId.d.ts.map +1 -0
  367. package/lib/typescript/formatNumber.d.ts +19 -0
  368. package/lib/typescript/formatNumber.d.ts.map +1 -0
  369. package/lib/typescript/index.d.ts +5 -0
  370. package/lib/typescript/index.d.ts.map +1 -0
  371. package/lib/typescript/types.d.ts +2 -0
  372. package/lib/typescript/types.d.ts.map +1 -0
  373. package/lib/typescript/utils.d.ts +10 -0
  374. package/lib/typescript/utils.d.ts.map +1 -0
  375. package/package.json +50 -0
  376. package/src/__tests__/applyDateSegmentChange.test.ts +26 -0
  377. package/src/__tests__/calendarFormatters.test.ts +35 -0
  378. package/src/__tests__/clampDateParts.test.ts +16 -0
  379. package/src/__tests__/compareDateIds.test.ts +7 -0
  380. package/src/__tests__/compareMonthIds.test.ts +19 -0
  381. package/src/__tests__/dateComponentLabels.test.ts +25 -0
  382. package/src/__tests__/dateRangeAroundDay.test.ts +10 -0
  383. package/src/__tests__/dateRangeFromLastNDays.test.ts +8 -0
  384. package/src/__tests__/dateSegmentHelpers.test.ts +24 -0
  385. package/src/__tests__/datetimeHelpers.test.ts +65 -0
  386. package/src/__tests__/displayFormatters.test.ts +34 -0
  387. package/src/__tests__/eachDateIdInRange.test.ts +11 -0
  388. package/src/__tests__/formatCalendarMonthYear.test.ts +9 -0
  389. package/src/__tests__/formatDateForDisplay.test.ts +11 -0
  390. package/src/__tests__/formatDateId.test.ts +15 -0
  391. package/src/__tests__/formatMonthId.test.ts +7 -0
  392. package/src/__tests__/formatNumber.test.ts +35 -0
  393. package/src/__tests__/getDateFieldSegments.test.ts +35 -0
  394. package/src/__tests__/getDateTimeFieldSegments.test.ts +140 -0
  395. package/src/__tests__/getDateTimeSegmentVisibility.test.ts +12 -0
  396. package/src/__tests__/intlCopy.test.ts +64 -0
  397. package/src/__tests__/isValidDateId.test.ts +8 -0
  398. package/src/__tests__/isValidMonthId.test.ts +8 -0
  399. package/src/__tests__/normalizeDateRange.test.ts +10 -0
  400. package/src/__tests__/toMonthId.test.ts +7 -0
  401. package/src/__tests__/todayDateId.test.ts +7 -0
  402. package/src/__tests__/wireConstructors.test.ts +74 -0
  403. package/src/dates/calendar/formatCalendarMonthYear.ts +21 -0
  404. package/src/dates/calendar/formatDateTimeListDateRow.ts +41 -0
  405. package/src/dates/calendar/formatMonthCalendarMonth.ts +21 -0
  406. package/src/dates/calendar/formatMonthCalendarYear.ts +9 -0
  407. package/src/dates/calendar/getCalendarWeekdayLabels.ts +23 -0
  408. package/src/dates/datetime/clampDateTimeId.ts +25 -0
  409. package/src/dates/datetime/compareDateTimeIds.ts +23 -0
  410. package/src/dates/datetime/dateTimeId.ts +36 -0
  411. package/src/dates/datetime/formatDateTimeId.ts +35 -0
  412. package/src/dates/datetime/formatDateTimeListHour.ts +14 -0
  413. package/src/dates/datetime/formatDateTimeListMinute.ts +9 -0
  414. package/src/dates/datetime/formatDateTimeListPeriod.ts +12 -0
  415. package/src/dates/datetime/isLocaleHour12.ts +23 -0
  416. package/src/dates/datetime/isValidDateTimeId.ts +18 -0
  417. package/src/dates/datetime/nowDateTimeId.ts +53 -0
  418. package/src/dates/datetime/parseDateTimeId.ts +24 -0
  419. package/src/dates/display/formatDateForDisplay.ts +21 -0
  420. package/src/dates/display/formatDateRangeForDisplay.ts +23 -0
  421. package/src/dates/display/formatDateTimeForDisplay.ts +37 -0
  422. package/src/dates/display/formatMonthForDisplay.ts +26 -0
  423. package/src/dates/index.ts +86 -0
  424. package/src/dates/internal/brand.ts +11 -0
  425. package/src/dates/internal/calendarHelpers.ts +18 -0
  426. package/src/dates/internal/clampHelpers.ts +15 -0
  427. package/src/dates/internal/dateIdToNativeDate.ts +15 -0
  428. package/src/dates/internal/intlCache.ts +40 -0
  429. package/src/dates/internal/intlCopy.ts +75 -0
  430. package/src/dates/internal/segmentBuilders.ts +94 -0
  431. package/src/dates/labels/dateComponentLabels.ts +79 -0
  432. package/src/dates/ranges/compareDateIds.ts +21 -0
  433. package/src/dates/ranges/compareMonthIds.ts +26 -0
  434. package/src/dates/ranges/dateRangeAroundDay.ts +24 -0
  435. package/src/dates/ranges/dateRangeFromLastNDays.ts +26 -0
  436. package/src/dates/ranges/eachDateIdInRange.ts +21 -0
  437. package/src/dates/ranges/normalizeDateRange.ts +18 -0
  438. package/src/dates/segments/applyDateSegmentChange.ts +57 -0
  439. package/src/dates/segments/formatDateSegment.ts +18 -0
  440. package/src/dates/segments/getDateFieldSegments.ts +45 -0
  441. package/src/dates/segments/getDateTimeFieldSegments.ts +126 -0
  442. package/src/dates/segments/getDateTimeSegmentVisibility.ts +14 -0
  443. package/src/dates/segments/getEmptyDateSegmentText.ts +12 -0
  444. package/src/dates/segments/parseDateSegment.ts +25 -0
  445. package/src/dates/types.ts +80 -0
  446. package/src/dates/wire/clampDateParts.ts +17 -0
  447. package/src/dates/wire/clampMonthParts.ts +15 -0
  448. package/src/dates/wire/dateId.ts +44 -0
  449. package/src/dates/wire/formatDateId.ts +20 -0
  450. package/src/dates/wire/formatMonthId.ts +16 -0
  451. package/src/dates/wire/isValidDateId.ts +22 -0
  452. package/src/dates/wire/isValidDateParts.ts +17 -0
  453. package/src/dates/wire/isValidMonthId.ts +22 -0
  454. package/src/dates/wire/isValidMonthParts.ts +11 -0
  455. package/src/dates/wire/monthId.ts +42 -0
  456. package/src/dates/wire/parseDateId.ts +20 -0
  457. package/src/dates/wire/parseMonthId.ts +20 -0
  458. package/src/dates/wire/toMonthId.ts +17 -0
  459. package/src/dates/wire/todayDateId.ts +12 -0
  460. package/src/dates/wire/todayMonthId.ts +12 -0
  461. package/src/formatNumber.ts +56 -0
  462. package/src/index.ts +82 -0
  463. package/src/types.ts +1 -0
  464. package/src/utils.ts +29 -0
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @cdx-ui/formatters
2
+
3
+ Pure formatters for Forge UI and FI apps — turn wire values into human-readable UI strings
4
+ (and the reverse for date wire ids). No React dependency.
5
+
6
+ Aligned in style with `@candescent/ui-formatters` (display helpers at package root; date helpers under
7
+ `dates/`). Prefer named imports from `@cdx-ui/formatters` only — do not import `date-fns` or `Intl`
8
+ wrappers from this package’s internals.
9
+
10
+ ## Wire vs display (dates)
11
+
12
+ | Representation | Example | Use for |
13
+ | -------------------------------------------- | ---------------------------- | ----------------------------- |
14
+ | **Wire** `DateId` / `MonthId` / `DateTimeId` | `'2026-07-28'` | Form state, APIs, pickers |
15
+ | **Display** string | `'7/28/26'` / `'28/07/2026'` | Labels, headers — never store |
16
+
17
+ ## Exports
18
+
19
+ ### Display (shared with banking UI formatters)
20
+
21
+ | Import | Purpose |
22
+ | -------------- | ------------------------------------------------------ |
23
+ | `formatNumber` | Locale decimal formatting (cached `Intl.NumberFormat`) |
24
+
25
+ ### Date wire
26
+
27
+ | Import | Purpose |
28
+ | ------------------------------------------------------------ | ------------------------ |
29
+ | `parseDateId` / `formatDateId` / `isValidDateId` | `YYYY-MM-DD` round-trip |
30
+ | `parseMonthId` / `formatMonthId` / `isValidMonthId` | `YYYY-MM-01` month ids |
31
+ | `parseDateTimeId` / `formatDateTimeId` / `isValidDateTimeId` | Local `YYYY-MM-DDTHH:mm` |
32
+ | `todayDateId` / `todayMonthId` / `nowDateTimeId` | Device-local “now” |
33
+ | `toMonthId` / `clampDateParts` / `clampMonthParts` | Conversions / clamping |
34
+
35
+ ### Date display
36
+
37
+ | Import | Purpose |
38
+ | --------------------------- | ------------------------------------ |
39
+ | `formatDateForDisplay` | Locale `dateStyle` short/medium/long |
40
+ | `formatMonthForDisplay` | Month + year label |
41
+ | `formatDateTimeForDisplay` | Date + time label |
42
+ | `formatDateRangeForDisplay` | Inclusive range label |
43
+
44
+ ### Ranges & segments
45
+
46
+ | Import | Purpose |
47
+ | ------------------------------------------------------------------- | ------------------------ |
48
+ | `normalizeDateRange` / `compareDateIds` / `eachDateIdInRange` | Range math |
49
+ | `dateRangeFromLastNDays` / `dateRangeAroundDay` | Presets |
50
+ | `getDateFieldSegments` / `getDateTimeFieldSegments` | Segmented field metadata |
51
+ | `parseDateSegment` / `formatDateSegment` / `applyDateSegmentChange` | Segment edits |
52
+
53
+ ### Calendar / list copy
54
+
55
+ | Import | Purpose |
56
+ | ---------------------------------------------------------- | --------------------- |
57
+ | `formatCalendarMonthYear` / `getCalendarWeekdayLabels` | Calendar chrome |
58
+ | `formatMonthCalendarMonth` / `formatMonthCalendarYear` | Month grid |
59
+ | `formatDateTimeListDateRow` / `formatDateTimeListHour` / … | DateTime list columns |
60
+
61
+ ## Usage
62
+
63
+ ```ts
64
+ import {
65
+ formatDateId,
66
+ formatDateForDisplay,
67
+ formatNumber,
68
+ normalizeDateRange,
69
+ type DateId,
70
+ } from '@cdx-ui/formatters';
71
+
72
+ formatNumber(3247.19); // '3,247.19'
73
+
74
+ const id: DateId = formatDateId({ year: 2026, month: 7, day: 28 }); // '2026-07-28'
75
+ formatDateForDisplay(id, { locale: 'en-US' }); // e.g. '7/28/26'
76
+
77
+ normalizeDateRange({ startId: '2026-07-28', endId: '2026-07-01' });
78
+ // → { startId: '2026-07-01', endId: '2026-07-28' }
79
+ ```
80
+
81
+ ```bash
82
+ pnpm --filter @cdx-ui/formatters test
83
+ ```
84
+
85
+ ## File layout
86
+
87
+ ```
88
+ src/
89
+ formatNumber.ts # shared display helper (merge target with ui-formatters)
90
+ types.ts / utils.ts # package-private (not barrel-exported)
91
+ __tests__/ # one test file per public helper
92
+ dates/
93
+ types.ts
94
+ index.ts # date barrel (re-exported from package root)
95
+ wire/ # DateId / MonthId parse, format, validate, today
96
+ display/ # locale-aware format*ForDisplay
97
+ ranges/ # compare, normalize, presets
98
+ segments/ # segmented field helpers
99
+ calendar/ # calendar + list row copy
100
+ datetime/ # DateTimeId + list hour/minute/period
101
+ internal/ # private adapters (not public API)
102
+ ```
103
+
104
+ ## Design notes
105
+
106
+ - **date-fns** is used internally for wire parse/math; **Intl** for user-facing display and calendar labels.
107
+ - Invalid / nullish inputs return `''` or `null` as documented per helper — never throw for bad display input.
108
+ - Package internals under `dates/internal/` are not part of the public API.
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatCalendarMonthYear = formatCalendarMonthYear;
7
+ var _dateIdToNativeDate = require("../internal/dateIdToNativeDate");
8
+ var _intlCache = require("../internal/intlCache");
9
+ /**
10
+ * Formats a calendar header label, e.g. `July 2026`.
11
+ *
12
+ * Uses `Intl` so `options.locale` is respected (same pattern as display formatters).
13
+ *
14
+ * @param monthId - Wire month string (`YYYY-MM-01`).
15
+ * @param options - Locale and optional time zone.
16
+ * @returns Long month and year label.
17
+ */
18
+ function formatCalendarMonthYear(monthId, options) {
19
+ const formatter = (0, _intlCache.getCachedDateFormatter)(options?.locale ?? 'en-US', {
20
+ month: 'long',
21
+ year: 'numeric',
22
+ ...(options?.timeZone ? {
23
+ timeZone: options.timeZone
24
+ } : {})
25
+ });
26
+ return formatter.format((0, _dateIdToNativeDate.dateIdToNativeDate)(monthId));
27
+ }
28
+ //# sourceMappingURL=formatCalendarMonthYear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dateIdToNativeDate","require","_intlCache","formatCalendarMonthYear","monthId","options","formatter","getCachedDateFormatter","locale","month","year","timeZone","format","dateIdToNativeDate"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatCalendarMonthYear.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,uBAAuBA,CAACC,OAAgB,EAAEC,OAA2B,EAAU;EAC7F,MAAMC,SAAS,GAAG,IAAAC,iCAAsB,EAACF,OAAO,EAAEG,MAAM,IAAI,OAAO,EAAE;IACnEC,KAAK,EAAE,MAAM;IACbC,IAAI,EAAE,SAAS;IACf,IAAIL,OAAO,EAAEM,QAAQ,GAAG;MAAEA,QAAQ,EAAEN,OAAO,CAACM;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOL,SAAS,CAACM,MAAM,CAAC,IAAAC,sCAAkB,EAACT,OAAO,CAAC,CAAC;AACtD","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDateTimeListDateRow = formatDateTimeListDateRow;
7
+ var _dateIdToNativeDate = require("../internal/dateIdToNativeDate");
8
+ var _intlCopy = require("../internal/intlCopy");
9
+ var _intlCache = require("../internal/intlCache");
10
+ /**
11
+ * Formats a row label for a scrollable date list. Returns a locale-aware "today" label when the
12
+ * id matches today (pass a precomputed `todayDateId` when comparing wire ids).
13
+ *
14
+ * @param dateId - Wire date string.
15
+ * @param options - Locale, optional `todayDateId` override, and time zone.
16
+ * @returns Relative today label or a short weekday/month/day label.
17
+ */
18
+ function formatDateTimeListDateRow(dateId, options) {
19
+ const locale = options?.locale ?? 'en-US';
20
+ const todayId = options?.todayDateId;
21
+ if (todayId && dateId === todayId) {
22
+ return (0, _intlCopy.formatRelativeToday)(locale);
23
+ }
24
+ const date = (0, _dateIdToNativeDate.dateIdToNativeDate)(dateId);
25
+ const todayParts = new Date();
26
+ const isToday = date.getFullYear() === todayParts.getFullYear() && date.getMonth() === todayParts.getMonth() && date.getDate() === todayParts.getDate();
27
+ if (isToday) {
28
+ return (0, _intlCopy.formatRelativeToday)(locale);
29
+ }
30
+ const formatter = (0, _intlCache.getCachedDateFormatter)(locale, {
31
+ weekday: 'short',
32
+ month: 'short',
33
+ day: 'numeric',
34
+ ...(options?.timeZone ? {
35
+ timeZone: options.timeZone
36
+ } : {})
37
+ });
38
+ return formatter.format(date);
39
+ }
40
+ //# sourceMappingURL=formatDateTimeListDateRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dateIdToNativeDate","require","_intlCopy","_intlCache","formatDateTimeListDateRow","dateId","options","locale","todayId","todayDateId","formatRelativeToday","date","dateIdToNativeDate","todayParts","Date","isToday","getFullYear","getMonth","getDate","formatter","getCachedDateFormatter","weekday","month","day","timeZone","format"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatDateTimeListDateRow.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,yBAAyBA,CACvCC,MAAc,EACdC,OAAsD,EAC9C;EACR,MAAMC,MAAM,GAAGD,OAAO,EAAEC,MAAM,IAAI,OAAO;EACzC,MAAMC,OAAO,GAAGF,OAAO,EAAEG,WAAW;EACpC,IAAID,OAAO,IAAIH,MAAM,KAAKG,OAAO,EAAE;IACjC,OAAO,IAAAE,6BAAmB,EAACH,MAAM,CAAC;EACpC;EAEA,MAAMI,IAAI,GAAG,IAAAC,sCAAkB,EAACP,MAAM,CAAC;EACvC,MAAMQ,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;EAC7B,MAAMC,OAAO,GACXJ,IAAI,CAACK,WAAW,CAAC,CAAC,KAAKH,UAAU,CAACG,WAAW,CAAC,CAAC,IAC/CL,IAAI,CAACM,QAAQ,CAAC,CAAC,KAAKJ,UAAU,CAACI,QAAQ,CAAC,CAAC,IACzCN,IAAI,CAACO,OAAO,CAAC,CAAC,KAAKL,UAAU,CAACK,OAAO,CAAC,CAAC;EACzC,IAAIH,OAAO,EAAE;IACX,OAAO,IAAAL,6BAAmB,EAACH,MAAM,CAAC;EACpC;EAEA,MAAMY,SAAS,GAAG,IAAAC,iCAAsB,EAACb,MAAM,EAAE;IAC/Cc,OAAO,EAAE,OAAO;IAChBC,KAAK,EAAE,OAAO;IACdC,GAAG,EAAE,SAAS;IACd,IAAIjB,OAAO,EAAEkB,QAAQ,GAAG;MAAEA,QAAQ,EAAElB,OAAO,CAACkB;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOL,SAAS,CAACM,MAAM,CAACd,IAAI,CAAC;AAC/B","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatMonthCalendarMonth = formatMonthCalendarMonth;
7
+ var _intlCache = require("../internal/intlCache");
8
+ /**
9
+ * Formats a short month name for month-grid cells (1–12).
10
+ *
11
+ * @param month - Month number (1–12).
12
+ * @param options - Locale and optional time zone.
13
+ * @returns Short month name.
14
+ *
15
+ * @example
16
+ * formatMonthCalendarMonth(7, { locale: 'en-US' }) // 'Jul'
17
+ */
18
+ function formatMonthCalendarMonth(month, options) {
19
+ const date = new Date(2024, month - 1, 1);
20
+ const formatter = (0, _intlCache.getCachedDateFormatter)(options?.locale ?? 'en-US', {
21
+ month: 'short',
22
+ ...(options?.timeZone ? {
23
+ timeZone: options.timeZone
24
+ } : {})
25
+ });
26
+ return formatter.format(date);
27
+ }
28
+ //# sourceMappingURL=formatMonthCalendarMonth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_intlCache","require","formatMonthCalendarMonth","month","options","date","Date","formatter","getCachedDateFormatter","locale","timeZone","format"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatMonthCalendarMonth.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAACC,KAAa,EAAEC,OAA2B,EAAU;EAC3F,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAAC,IAAI,EAAEH,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;EACzC,MAAMI,SAAS,GAAG,IAAAC,iCAAsB,EAACJ,OAAO,EAAEK,MAAM,IAAI,OAAO,EAAE;IACnEN,KAAK,EAAE,OAAO;IACd,IAAIC,OAAO,EAAEM,QAAQ,GAAG;MAAEA,QAAQ,EAAEN,OAAO,CAACM;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOH,SAAS,CAACI,MAAM,CAACN,IAAI,CAAC;AAC/B","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatMonthCalendarYear = formatMonthCalendarYear;
7
+ /**
8
+ * Formats a year label for month-calendar decade/year pickers.
9
+ *
10
+ * @param year - Four-digit year.
11
+ * @returns Year as a string.
12
+ */
13
+ function formatMonthCalendarYear(year) {
14
+ return String(year);
15
+ }
16
+ //# sourceMappingURL=formatMonthCalendarYear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatMonthCalendarYear","year","String"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatMonthCalendarYear.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,uBAAuBA,CAACC,IAAY,EAAU;EAC5D,OAAOC,MAAM,CAACD,IAAI,CAAC;AACrB","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCalendarWeekdayLabels = getCalendarWeekdayLabels;
7
+ var _calendarHelpers = require("../internal/calendarHelpers");
8
+ /**
9
+ * Returns ordered weekday labels for a calendar week header.
10
+ *
11
+ * @param options - Locale, first day of week, and weekday width.
12
+ * @returns Array of seven weekday label strings.
13
+ */
14
+ function getCalendarWeekdayLabels(options) {
15
+ const firstDayOfWeek = options?.firstDayOfWeek ?? 0;
16
+ const labels = [];
17
+ for (let i = 0; i < 7; i += 1) {
18
+ const index = (firstDayOfWeek + i) % 7;
19
+ labels.push((0, _calendarHelpers.formatCalendarWeekday)(index, options));
20
+ }
21
+ return labels;
22
+ }
23
+ //# sourceMappingURL=getCalendarWeekdayLabels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_calendarHelpers","require","getCalendarWeekdayLabels","options","firstDayOfWeek","labels","i","index","push","formatCalendarWeekday"],"sourceRoot":"../../../../src","sources":["dates/calendar/getCalendarWeekdayLabels.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACtCC,OAGC,EACS;EACV,MAAMC,cAAc,GAAGD,OAAO,EAAEC,cAAc,IAAI,CAAC;EACnD,MAAMC,MAAgB,GAAG,EAAE;EAC3B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAI,CAAC,EAAE;IAC7B,MAAMC,KAAK,GAAG,CAACH,cAAc,GAAGE,CAAC,IAAI,CAAC;IACtCD,MAAM,CAACG,IAAI,CAAC,IAAAC,sCAAqB,EAACF,KAAK,EAAEJ,OAAO,CAAC,CAAC;EACpD;EACA,OAAOE,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clampDateTimeId = clampDateTimeId;
7
+ var _compareDateTimeIds = require("./compareDateTimeIds");
8
+ /**
9
+ * Clamps a wire date-time into the inclusive `[min, max]` range.
10
+ *
11
+ * Returns `min` when `value` is earlier than `min`, `max` when later than `max`,
12
+ * otherwise `value` unchanged. Omitted bounds are ignored.
13
+ *
14
+ * @param value - Wire date-time to clamp.
15
+ * @param bounds - Optional inclusive `min` / `max` wire date-times.
16
+ * @returns The clamped `DateTimeId`.
17
+ */
18
+ function clampDateTimeId(value, bounds) {
19
+ if (bounds.min && (0, _compareDateTimeIds.compareDateTimeIds)(value, bounds.min) < 0) {
20
+ return bounds.min;
21
+ }
22
+ if (bounds.max && (0, _compareDateTimeIds.compareDateTimeIds)(value, bounds.max) > 0) {
23
+ return bounds.max;
24
+ }
25
+ return value;
26
+ }
27
+ //# sourceMappingURL=clampDateTimeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compareDateTimeIds","require","clampDateTimeId","value","bounds","min","compareDateTimeIds","max"],"sourceRoot":"../../../../src","sources":["dates/datetime/clampDateTimeId.ts"],"mappings":";;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,KAAiB,EACjBC,MAA8C,EAClC;EACZ,IAAIA,MAAM,CAACC,GAAG,IAAI,IAAAC,sCAAkB,EAACH,KAAK,EAAEC,MAAM,CAACC,GAAG,CAAC,GAAG,CAAC,EAAE;IAC3D,OAAOD,MAAM,CAACC,GAAG;EACnB;EACA,IAAID,MAAM,CAACG,GAAG,IAAI,IAAAD,sCAAkB,EAACH,KAAK,EAAEC,MAAM,CAACG,GAAG,CAAC,GAAG,CAAC,EAAE;IAC3D,OAAOH,MAAM,CAACG,GAAG;EACnB;EACA,OAAOJ,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compareDateTimeIds = compareDateTimeIds;
7
+ var _dateFns = require("date-fns");
8
+ /**
9
+ * Compares two wire date-times chronologically.
10
+ *
11
+ * Handles local (`YYYY-MM-DDTHH:MM`) and UTC (`…Z`) forms alike by parsing each
12
+ * to an absolute instant before comparing.
13
+ *
14
+ * @param a - First wire date-time.
15
+ * @param b - Second wire date-time.
16
+ * @returns `-1` if `a` is earlier, `1` if later, `0` if equal.
17
+ */
18
+ function compareDateTimeIds(a, b) {
19
+ const result = (0, _dateFns.compareAsc)((0, _dateFns.parseISO)(a), (0, _dateFns.parseISO)(b));
20
+ if (result < 0) {
21
+ return -1;
22
+ }
23
+ if (result > 0) {
24
+ return 1;
25
+ }
26
+ return 0;
27
+ }
28
+ //# sourceMappingURL=compareDateTimeIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dateFns","require","compareDateTimeIds","a","b","result","compareAsc","parseISO"],"sourceRoot":"../../../../src","sources":["dates/datetime/compareDateTimeIds.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,CAAa,EAAEC,CAAa,EAAc;EAC3E,MAAMC,MAAM,GAAG,IAAAC,mBAAU,EAAC,IAAAC,iBAAQ,EAACJ,CAAC,CAAC,EAAE,IAAAI,iBAAQ,EAACH,CAAC,CAAC,CAAC;EACnD,IAAIC,MAAM,GAAG,CAAC,EAAE;IACd,OAAO,CAAC,CAAC;EACX;EACA,IAAIA,MAAM,GAAG,CAAC,EAAE;IACd,OAAO,CAAC;EACV;EACA,OAAO,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.dateTimeId = dateTimeId;
7
+ var _brand = require("../internal/brand");
8
+ var _formatDateTimeId = require("./formatDateTimeId");
9
+ var _isValidDateTimeId = require("./isValidDateTimeId");
10
+ /**
11
+ * Validating smart constructor for a wire {@link DateTimeId} (local ISO-like,
12
+ * e.g. `YYYY-MM-DDTHH:mm`).
13
+ *
14
+ * Accepts either a wire string or {@link DateTimeParts}. Throws `RangeError` on
15
+ * input that does not parse to a valid date-time.
16
+ *
17
+ * @param input - A wire date-time string or {@link DateTimeParts}.
18
+ * @returns The branded `DateTimeId`.
19
+ * @throws RangeError when the input is not a valid `DateTimeId`.
20
+ *
21
+ * @example
22
+ * dateTimeId('2026-08-07T14:30'); // DateTimeId
23
+ * dateTimeId({ year: 2026, month: 8, day: 7, hour: 14, minute: 30 }); // DateTimeId
24
+ */
25
+ function dateTimeId(input) {
26
+ if (typeof input === 'string') {
27
+ if (!(0, _isValidDateTimeId.isValidDateTimeId)(input)) {
28
+ throw new RangeError(`Invalid DateTimeId: "${input}". Expected a wire date-time such as "YYYY-MM-DDTHH:mm".`);
29
+ }
30
+ return input;
31
+ }
32
+ const built = (0, _formatDateTimeId.formatDateTimeId)(input);
33
+ if (!(0, _isValidDateTimeId.isValidDateTimeId)(built)) {
34
+ throw new RangeError(`Invalid DateTimeId parts: ${JSON.stringify(input)}.`);
35
+ }
36
+ return (0, _brand.asDateTimeId)(built);
37
+ }
38
+ //# sourceMappingURL=dateTimeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_brand","require","_formatDateTimeId","_isValidDateTimeId","dateTimeId","input","isValidDateTimeId","RangeError","built","formatDateTimeId","JSON","stringify","asDateTimeId"],"sourceRoot":"../../../../src","sources":["dates/datetime/dateTimeId.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAACC,KAA6B,EAAc;EACpE,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,IAAI,CAAC,IAAAC,oCAAiB,EAACD,KAAK,CAAC,EAAE;MAC7B,MAAM,IAAIE,UAAU,CAClB,wBAAwBF,KAAK,0DAC/B,CAAC;IACH;IACA,OAAOA,KAAK;EACd;EAEA,MAAMG,KAAK,GAAG,IAAAC,kCAAgB,EAACJ,KAAK,CAAC;EACrC,IAAI,CAAC,IAAAC,oCAAiB,EAACE,KAAK,CAAC,EAAE;IAC7B,MAAM,IAAID,UAAU,CAAC,6BAA6BG,IAAI,CAACC,SAAS,CAACN,KAAK,CAAC,GAAG,CAAC;EAC7E;EACA,OAAO,IAAAO,mBAAY,EAACJ,KAAK,CAAC;AAC5B","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDateTimeId = formatDateTimeId;
7
+ var _brand = require("../internal/brand");
8
+ var _formatDateId = require("../wire/formatDateId");
9
+ /**
10
+ * Builds a wire `DateTimeId` from parts. Local by default; pass `{ utc: true }` for ISO UTC.
11
+ *
12
+ * @param parts - Date and time parts.
13
+ * @param options - When `utc` is true, returns an ISO UTC string ending in `Z`.
14
+ * @returns Wire `DateTimeId` string.
15
+ */
16
+ function formatDateTimeId(parts, options) {
17
+ const date = options?.utc ? new Date(Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second ?? 0)) : new Date(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second ?? 0);
18
+ if (options?.utc) {
19
+ return (0, _brand.asDateTimeId)(date.toISOString());
20
+ }
21
+ const datePart = (0, _formatDateId.formatDateId)(parts);
22
+ const hour = String(parts.hour).padStart(2, '0');
23
+ const minute = String(parts.minute).padStart(2, '0');
24
+ const second = parts.second != null ? `:${String(parts.second).padStart(2, '0')}` : '';
25
+ return (0, _brand.asDateTimeId)(`${datePart}T${hour}:${minute}${second}`);
26
+ }
27
+ //# sourceMappingURL=formatDateTimeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_brand","require","_formatDateId","formatDateTimeId","parts","options","date","utc","Date","UTC","year","month","day","hour","minute","second","asDateTimeId","toISOString","datePart","formatDateId","String","padStart"],"sourceRoot":"../../../../src","sources":["dates/datetime/formatDateTimeId.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAACC,KAAoB,EAAEC,OAA2B,EAAc;EAC9F,MAAMC,IAAI,GAAGD,OAAO,EAAEE,GAAG,GACrB,IAAIC,IAAI,CACNA,IAAI,CAACC,GAAG,CACNL,KAAK,CAACM,IAAI,EACVN,KAAK,CAACO,KAAK,GAAG,CAAC,EACfP,KAAK,CAACQ,GAAG,EACTR,KAAK,CAACS,IAAI,EACVT,KAAK,CAACU,MAAM,EACZV,KAAK,CAACW,MAAM,IAAI,CAClB,CACF,CAAC,GACD,IAAIP,IAAI,CAACJ,KAAK,CAACM,IAAI,EAAEN,KAAK,CAACO,KAAK,GAAG,CAAC,EAAEP,KAAK,CAACQ,GAAG,EAAER,KAAK,CAACS,IAAI,EAAET,KAAK,CAACU,MAAM,EAAEV,KAAK,CAACW,MAAM,IAAI,CAAC,CAAC;EAEjG,IAAIV,OAAO,EAAEE,GAAG,EAAE;IAChB,OAAO,IAAAS,mBAAY,EAACV,IAAI,CAACW,WAAW,CAAC,CAAC,CAAC;EACzC;EAEA,MAAMC,QAAQ,GAAG,IAAAC,0BAAY,EAACf,KAAK,CAAC;EACpC,MAAMS,IAAI,GAAGO,MAAM,CAAChB,KAAK,CAACS,IAAI,CAAC,CAACQ,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAChD,MAAMP,MAAM,GAAGM,MAAM,CAAChB,KAAK,CAACU,MAAM,CAAC,CAACO,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EACpD,MAAMN,MAAM,GAAGX,KAAK,CAACW,MAAM,IAAI,IAAI,GAAG,IAAIK,MAAM,CAAChB,KAAK,CAACW,MAAM,CAAC,CAACM,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE;EACtF,OAAO,IAAAL,mBAAY,EAAC,GAAGE,QAAQ,IAAIL,IAAI,IAAIC,MAAM,GAAGC,MAAM,EAAE,CAAC;AAC/D","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDateTimeListHour = formatDateTimeListHour;
7
+ /**
8
+ * Formats the hour label for a date-time list column.
9
+ *
10
+ * @param hour - Hour value (0–23).
11
+ * @param options - When `hour12` is true, returns 1–12 without leading zero.
12
+ * @returns Hour label string.
13
+ */
14
+ function formatDateTimeListHour(hour, options) {
15
+ if (options?.hour12) {
16
+ const h = hour % 12 || 12;
17
+ return String(h);
18
+ }
19
+ return String(hour).padStart(2, '0');
20
+ }
21
+ //# sourceMappingURL=formatDateTimeListHour.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatDateTimeListHour","hour","options","hour12","h","String","padStart"],"sourceRoot":"../../../../src","sources":["dates/datetime/formatDateTimeListHour.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsBA,CAACC,IAAY,EAAEC,OAA8B,EAAU;EAC3F,IAAIA,OAAO,EAAEC,MAAM,EAAE;IACnB,MAAMC,CAAC,GAAGH,IAAI,GAAG,EAAE,IAAI,EAAE;IACzB,OAAOI,MAAM,CAACD,CAAC,CAAC;EAClB;EACA,OAAOC,MAAM,CAACJ,IAAI,CAAC,CAACK,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACtC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDateTimeListMinute = formatDateTimeListMinute;
7
+ /**
8
+ * Formats a zero-padded minute label for a date-time list column.
9
+ *
10
+ * @param minute - Minute value (0–59).
11
+ * @returns Two-digit minute string.
12
+ */
13
+ function formatDateTimeListMinute(minute) {
14
+ return String(minute).padStart(2, '0');
15
+ }
16
+ //# sourceMappingURL=formatDateTimeListMinute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatDateTimeListMinute","minute","String","padStart"],"sourceRoot":"../../../../src","sources":["dates/datetime/formatDateTimeListMinute.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAwBA,CAACC,MAAc,EAAU;EAC/D,OAAOC,MAAM,CAACD,MAAM,CAAC,CAACE,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AACxC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDateTimeListPeriod = formatDateTimeListPeriod;
7
+ var _intlCopy = require("../internal/intlCopy");
8
+ /**
9
+ * Returns the day-period label (AM/PM or locale equivalent) derived from a 0–23 hour value.
10
+ *
11
+ * @param hour - Hour value (0–23).
12
+ * @param options - Locale for the day-period label.
13
+ */
14
+ function formatDateTimeListPeriod(hour, options) {
15
+ return (0, _intlCopy.formatDayPeriodFromHour)(hour, options?.locale);
16
+ }
17
+ //# sourceMappingURL=formatDateTimeListPeriod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_intlCopy","require","formatDateTimeListPeriod","hour","options","formatDayPeriodFromHour","locale"],"sourceRoot":"../../../../src","sources":["dates/datetime/formatDateTimeListPeriod.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAACC,IAAY,EAAEC,OAA2B,EAAU;EAC1F,OAAO,IAAAC,iCAAuB,EAACF,IAAI,EAAEC,OAAO,EAAEE,MAAM,CAAC;AACvD","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isLocaleHour12 = isLocaleHour12;
7
+ /**
8
+ * Whether the given locale conventionally uses a 12-hour clock (AM/PM).
9
+ *
10
+ * Derived from the locale's resolved hour cycle so date-time components can
11
+ * default their clock to the locale instead of hardcoding 12-hour. Pass an
12
+ * explicit `hour12` to override.
13
+ *
14
+ * @param locale - BCP-47 locale. Defaults to `en-US`.
15
+ * @returns `true` when the locale uses a 12-hour clock.
16
+ */
17
+ function isLocaleHour12(locale) {
18
+ try {
19
+ const resolved = new Intl.DateTimeFormat(locale ?? 'en-US', {
20
+ hour: 'numeric'
21
+ }).resolvedOptions();
22
+ if (typeof resolved.hour12 === 'boolean') {
23
+ return resolved.hour12;
24
+ }
25
+ return resolved.hourCycle === 'h11' || resolved.hourCycle === 'h12';
26
+ } catch {
27
+ return true;
28
+ }
29
+ }
30
+ //# sourceMappingURL=isLocaleHour12.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isLocaleHour12","locale","resolved","Intl","DateTimeFormat","hour","resolvedOptions","hour12","hourCycle"],"sourceRoot":"../../../../src","sources":["dates/datetime/isLocaleHour12.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,MAAe,EAAW;EACvD,IAAI;IACF,MAAMC,QAAQ,GAAG,IAAIC,IAAI,CAACC,cAAc,CAACH,MAAM,IAAI,OAAO,EAAE;MAC1DI,IAAI,EAAE;IACR,CAAC,CAAC,CAACC,eAAe,CAAC,CAA6C;IAChE,IAAI,OAAOJ,QAAQ,CAACK,MAAM,KAAK,SAAS,EAAE;MACxC,OAAOL,QAAQ,CAACK,MAAM;IACxB;IACA,OAAOL,QAAQ,CAACM,SAAS,KAAK,KAAK,IAAIN,QAAQ,CAACM,SAAS,KAAK,KAAK;EACrE,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidDateTimeId = isValidDateTimeId;
7
+ var _dateFns = require("date-fns");
8
+ const LOCAL_DATE_TIME_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?$/;
9
+
10
+ /**
11
+ * Type guard for local `DateTimeId` (`YYYY-MM-DDTHH:mm` or with seconds) and UTC `…Z` strings.
12
+ *
13
+ * @param dateTimeId - Candidate wire date-time string.
14
+ * @returns `true` when `dateTimeId` is a valid `DateTimeId`.
15
+ */
16
+ function isValidDateTimeId(dateTimeId) {
17
+ if (!LOCAL_DATE_TIME_PATTERN.test(dateTimeId) && !dateTimeId.endsWith('Z')) {
18
+ return false;
19
+ }
20
+ const parsed = (0, _dateFns.parseISO)(dateTimeId);
21
+ return (0, _dateFns.isValid)(parsed);
22
+ }
23
+ //# sourceMappingURL=isValidDateTimeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dateFns","require","LOCAL_DATE_TIME_PATTERN","isValidDateTimeId","dateTimeId","test","endsWith","parsed","parseISO","isValid"],"sourceRoot":"../../../../src","sources":["dates/datetime/isValidDateTimeId.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA,MAAMC,uBAAuB,GAAG,0CAA0C;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAACC,UAAkB,EAA4B;EAC9E,IAAI,CAACF,uBAAuB,CAACG,IAAI,CAACD,UAAU,CAAC,IAAI,CAACA,UAAU,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC1E,OAAO,KAAK;EACd;EACA,MAAMC,MAAM,GAAG,IAAAC,iBAAQ,EAACJ,UAAU,CAAC;EACnC,OAAO,IAAAK,gBAAO,EAACF,MAAM,CAAC;AACxB","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.nowDateTimeId = nowDateTimeId;
7
+ var _formatDateTimeId = require("./formatDateTimeId");
8
+ /**
9
+ * Returns the local device date/time as a `DateTimeId`, truncated to the requested granularity.
10
+ *
11
+ * @param options - Optional granularity; defaults to `'minute'`.
12
+ * @returns Wire `DateTimeId` for the current local time.
13
+ *
14
+ * @example
15
+ * nowDateTimeId({ granularity: 'minute' }) // '2026-07-28T14:30'
16
+ */
17
+ function nowDateTimeId(options) {
18
+ const now = new Date();
19
+ const parts = {
20
+ year: now.getFullYear(),
21
+ month: now.getMonth() + 1,
22
+ day: now.getDate(),
23
+ hour: now.getHours(),
24
+ minute: now.getMinutes(),
25
+ second: now.getSeconds()
26
+ };
27
+ switch (options?.granularity ?? 'minute') {
28
+ case 'day':
29
+ return (0, _formatDateTimeId.formatDateTimeId)({
30
+ year: parts.year,
31
+ month: parts.month,
32
+ day: parts.day,
33
+ hour: 0,
34
+ minute: 0
35
+ });
36
+ case 'hour':
37
+ return (0, _formatDateTimeId.formatDateTimeId)({
38
+ year: parts.year,
39
+ month: parts.month,
40
+ day: parts.day,
41
+ hour: parts.hour,
42
+ minute: 0
43
+ });
44
+ case 'minute':
45
+ return (0, _formatDateTimeId.formatDateTimeId)({
46
+ year: parts.year,
47
+ month: parts.month,
48
+ day: parts.day,
49
+ hour: parts.hour,
50
+ minute: parts.minute
51
+ });
52
+ case 'second':
53
+ default:
54
+ return (0, _formatDateTimeId.formatDateTimeId)(parts);
55
+ }
56
+ }
57
+ //# sourceMappingURL=nowDateTimeId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_formatDateTimeId","require","nowDateTimeId","options","now","Date","parts","year","getFullYear","month","getMonth","day","getDate","hour","getHours","minute","getMinutes","second","getSeconds","granularity","formatDateTimeId"],"sourceRoot":"../../../../src","sources":["dates/datetime/nowDateTimeId.ts"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,OAA+C,EAAc;EACzF,MAAMC,GAAG,GAAG,IAAIC,IAAI,CAAC,CAAC;EACtB,MAAMC,KAAoB,GAAG;IAC3BC,IAAI,EAAEH,GAAG,CAACI,WAAW,CAAC,CAAC;IACvBC,KAAK,EAAEL,GAAG,CAACM,QAAQ,CAAC,CAAC,GAAG,CAAC;IACzBC,GAAG,EAAEP,GAAG,CAACQ,OAAO,CAAC,CAAC;IAClBC,IAAI,EAAET,GAAG,CAACU,QAAQ,CAAC,CAAC;IACpBC,MAAM,EAAEX,GAAG,CAACY,UAAU,CAAC,CAAC;IACxBC,MAAM,EAAEb,GAAG,CAACc,UAAU,CAAC;EACzB,CAAC;EAED,QAAQf,OAAO,EAAEgB,WAAW,IAAI,QAAQ;IACtC,KAAK,KAAK;MACR,OAAO,IAAAC,kCAAgB,EAAC;QACtBb,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBE,KAAK,EAAEH,KAAK,CAACG,KAAK;QAClBE,GAAG,EAAEL,KAAK,CAACK,GAAG;QACdE,IAAI,EAAE,CAAC;QACPE,MAAM,EAAE;MACV,CAAC,CAAC;IACJ,KAAK,MAAM;MACT,OAAO,IAAAK,kCAAgB,EAAC;QACtBb,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBE,KAAK,EAAEH,KAAK,CAACG,KAAK;QAClBE,GAAG,EAAEL,KAAK,CAACK,GAAG;QACdE,IAAI,EAAEP,KAAK,CAACO,IAAI;QAChBE,MAAM,EAAE;MACV,CAAC,CAAC;IACJ,KAAK,QAAQ;MACX,OAAO,IAAAK,kCAAgB,EAAC;QACtBb,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBE,KAAK,EAAEH,KAAK,CAACG,KAAK;QAClBE,GAAG,EAAEL,KAAK,CAACK,GAAG;QACdE,IAAI,EAAEP,KAAK,CAACO,IAAI;QAChBE,MAAM,EAAET,KAAK,CAACS;MAChB,CAAC,CAAC;IACJ,KAAK,QAAQ;IACb;MACE,OAAO,IAAAK,kCAAgB,EAACd,KAAK,CAAC;EAClC;AACF","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseDateTimeId = parseDateTimeId;
7
+ var _dateFns = require("date-fns");
8
+ var _isValidDateTimeId = require("./isValidDateTimeId");
9
+ /**
10
+ * Parses a wire `DateTimeId` into numeric parts, or `null` when invalid.
11
+ *
12
+ * @param dateTimeId - Wire date-time string.
13
+ * @returns Parsed parts, or `null` when `dateTimeId` is invalid.
14
+ */
15
+ function parseDateTimeId(dateTimeId) {
16
+ if (!(0, _isValidDateTimeId.isValidDateTimeId)(dateTimeId)) {
17
+ return null;
18
+ }
19
+ const date = (0, _dateFns.parseISO)(dateTimeId);
20
+ return {
21
+ year: date.getFullYear(),
22
+ month: date.getMonth() + 1,
23
+ day: date.getDate(),
24
+ hour: date.getHours(),
25
+ minute: date.getMinutes(),
26
+ second: date.getSeconds()
27
+ };
28
+ }
29
+ //# sourceMappingURL=parseDateTimeId.js.map