@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
@@ -0,0 +1,12 @@
1
+ import type { MonthId, MonthParts } from '../types';
2
+ /**
3
+ * Parses a wire `MonthId` into numeric parts, or `null` when invalid.
4
+ *
5
+ * @param monthId - Wire month string (`YYYY-MM-01`).
6
+ * @returns Parsed parts, or `null` when `monthId` is invalid.
7
+ *
8
+ * @example
9
+ * parseMonthId('2026-07-01') // { year: 2026, month: 7 }
10
+ */
11
+ export declare function parseMonthId(monthId: MonthId): MonthParts | null;
12
+ //# sourceMappingURL=parseMonthId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseMonthId.d.ts","sourceRoot":"","sources":["../../../../src/dates/wire/parseMonthId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGpD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAMhE"}
@@ -0,0 +1,12 @@
1
+ import type { DateId, MonthId } from '../types';
2
+ /**
3
+ * Truncates a `DateId` to its month wire id.
4
+ *
5
+ * @param dateId - Wire date string.
6
+ * @returns Wire `MonthId` for the same calendar month.
7
+ *
8
+ * @example
9
+ * toMonthId('2026-07-28') // '2026-07-01'
10
+ */
11
+ export declare function toMonthId(dateId: DateId): MonthId;
12
+ //# sourceMappingURL=toMonthId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toMonthId.d.ts","sourceRoot":"","sources":["../../../../src/dates/wire/toMonthId.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,8 @@
1
+ import type { DateId } from '../types';
2
+ /**
3
+ * Returns the device-local calendar date as a wire `DateId`.
4
+ *
5
+ * @returns Today's date as `YYYY-MM-DD`.
6
+ */
7
+ export declare function todayDateId(): DateId;
8
+ //# sourceMappingURL=todayDateId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todayDateId.d.ts","sourceRoot":"","sources":["../../../../src/dates/wire/todayDateId.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
@@ -0,0 +1,8 @@
1
+ import type { MonthId } from '../types';
2
+ /**
3
+ * Returns the device-local calendar month as a wire `MonthId`.
4
+ *
5
+ * @returns Current month as `YYYY-MM-01`.
6
+ */
7
+ export declare function todayMonthId(): MonthId;
8
+ //# sourceMappingURL=todayMonthId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todayMonthId.d.ts","sourceRoot":"","sources":["../../../../src/dates/wire/todayMonthId.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
@@ -0,0 +1,19 @@
1
+ import type { Nullable } from './types';
2
+ export interface FormatNumberOptions {
3
+ locale?: Nullable<Intl.LocalesArgument>;
4
+ decimalPlaces?: Nullable<number>;
5
+ }
6
+ /**
7
+ * Formats a value as a number with decimal places for display.
8
+ *
9
+ * @param value - Value to format (`number`, plain numeric `string` like `'1234.56'`, `null`, or `undefined`).
10
+ * @param options - Formatting options.
11
+ * @param options.locale - BCP 47 locale; defaults to `en-US`.
12
+ * @param options.decimalPlaces - Fraction digits; defaults to `2`.
13
+ * @returns Locale-formatted decimal string, or `''` for nullish, blank, or non-numeric values.
14
+ *
15
+ * @example
16
+ * formatNumber(3247.19) // '3,247.19'
17
+ */
18
+ export declare function formatNumber(value: Nullable<number | string>, options?: Nullable<FormatNumberOptions>): string;
19
+ //# sourceMappingURL=formatNumber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatNumber.d.ts","sourceRoot":"","sources":["../../src/formatNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAClC;AA0BD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,EAChC,OAAO,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACtC,MAAM,CAQR"}
@@ -0,0 +1,5 @@
1
+ export { formatNumber, type FormatNumberOptions } from './formatNumber';
2
+ export type { DateFieldMode, DateFormatOptions, DateId, DateParts, DateRangeDisplayOptions, DateSegment, DateSegmentType, DateTimeGranularity, DateTimeId, DateTimeParts, FormatDateDisplayOptions, FormatDateTimeDisplayOptions, MonthId, MonthParts, TimeParts, } from './dates/types';
3
+ export { clampDateParts, clampMonthParts, dateId, monthId, formatDateId, formatMonthId, isValidDateId, isValidDateParts, isValidMonthId, isValidMonthParts, parseDateId, parseMonthId, toMonthId, todayDateId, todayMonthId, clampDateTimeId, compareDateTimeIds, dateTimeId, formatDateTimeId, isLocaleHour12, isValidDateTimeId, nowDateTimeId, parseDateTimeId, formatDateForDisplay, formatDateRangeForDisplay, formatDateTimeForDisplay, formatMonthForDisplay, compareDateIds, compareMonthIds, dateRangeAroundDay, dateRangeFromLastNDays, eachDateIdInRange, normalizeDateRange, applyDateSegmentChange, formatDateSegment, getDateFieldSegments, getDateTimeFieldSegments, getDateTimeSegmentVisibility, getEmptyDateSegmentText, parseDateSegment, formatCalendarMonthYear, formatDateTimeListDateRow, formatDateTimeListHour, formatDateTimeListMinute, formatDateTimeListPeriod, formatMonthCalendarMonth, formatMonthCalendarYear, getCalendarWeekdayLabels, DEFAULT_DATE_COMPONENT_LABELS, formatSelectYear, getDateSegmentAccessibilityLabel, resolveDateComponentLabels, } from './dates';
4
+ export type { DateComponentLabels } from './dates';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAExE,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,wBAAwB,EACxB,4BAA4B,EAC5B,OAAO,EACP,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEL,cAAc,EACd,eAAe,EACf,MAAM,EACN,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EAEZ,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,eAAe,EAEf,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EAErB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAElB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EAEhB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type Nullable<T> = T | null | undefined;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Nullable } from './types';
2
+ /**
3
+ * Coerce a nullable number/string to a finite number for display formatters.
4
+ *
5
+ * Hermes does not support the `signDisplay` property on iOS (and is unreliable on Android 11),
6
+ * so `-0` can still format as `"-0.00"`. Normalize before Intl to avoid this issue.
7
+ * @see https://github.com/facebook/hermes/blob/main/doc/IntlAPIs.md#limited-ios-property-support
8
+ */
9
+ export declare function toFiniteNumber(value: Nullable<number | string>): number | undefined;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAmBnF"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@cdx-ui/formatters",
3
+ "version": "0.0.1-beta.132",
4
+ "main": "lib/commonjs/index.js",
5
+ "module": "lib/module/index.js",
6
+ "react-native": "src/index.ts",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "source": "src/index.ts",
9
+ "exports": {
10
+ ".": {
11
+ "react-native": "./src/index.ts",
12
+ "types": "./lib/typescript/index.d.ts",
13
+ "import": "./lib/module/index.js",
14
+ "require": "./lib/commonjs/index.js",
15
+ "default": "./lib/module/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "lib",
20
+ "src"
21
+ ],
22
+ "react-native-builder-bob": {
23
+ "source": "src",
24
+ "output": "lib",
25
+ "exclude": "**/{__tests__/**,__fixtures__/**,__mocks__/**,*.test.ts,*.test.tsx,*.spec.ts,*.spec.tsx}",
26
+ "targets": [
27
+ "commonjs",
28
+ "module",
29
+ "typescript"
30
+ ]
31
+ },
32
+ "dependencies": {
33
+ "date-fns": "4.1.0"
34
+ },
35
+ "nx": {
36
+ "tags": [
37
+ "type:lib",
38
+ "scope:formatters"
39
+ ]
40
+ },
41
+ "sideEffects": false,
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "build": "bob build",
47
+ "lint": "eslint src/",
48
+ "test": "jest --config ../../jest.config.js --selectProjects formatters"
49
+ }
50
+ }
@@ -0,0 +1,26 @@
1
+ import { applyDateSegmentChange } from '../dates/segments/applyDateSegmentChange';
2
+ import { formatDateId } from '../dates/wire/formatDateId';
3
+ import { parseDateId } from '../dates/wire/parseDateId';
4
+ import { parseMonthId } from '../dates/wire/parseMonthId';
5
+
6
+ describe('applyDateSegmentChange', () => {
7
+ it('clamps day when month segment changes to a shorter month', () => {
8
+ const current = parseDateId('2026-01-31');
9
+ const next = applyDateSegmentChange(current, 'month', 2, { mode: 'date' });
10
+ const expected = { year: 2026, month: 2, day: 28 };
11
+ expect(next).toEqual(expected);
12
+ expect(formatDateId(expected)).toBe('2026-02-28');
13
+ });
14
+
15
+ it('clamps day segment to the current month length', () => {
16
+ const current = parseDateId('2026-02-01');
17
+ const next = applyDateSegmentChange(current, 'day', 31, { mode: 'date' });
18
+ expect(next).toEqual({ year: 2026, month: 2, day: 28 });
19
+ });
20
+
21
+ it('clamps month segment in month mode', () => {
22
+ const current = parseMonthId('2026-07-01');
23
+ const next = applyDateSegmentChange(current, 'month', 13, { mode: 'month' });
24
+ expect(next).toEqual({ year: 2026, month: 12 });
25
+ });
26
+ });
@@ -0,0 +1,35 @@
1
+ import { formatMonthCalendarYear } from '../dates/calendar/formatMonthCalendarYear';
2
+ import { getCalendarWeekdayLabels } from '../dates/calendar/getCalendarWeekdayLabels';
3
+ import { formatDateTimeListDateRow } from '../dates/calendar/formatDateTimeListDateRow';
4
+ import { formatDateTimeListHour } from '../dates/datetime/formatDateTimeListHour';
5
+ import { formatDateTimeListMinute } from '../dates/datetime/formatDateTimeListMinute';
6
+ import { formatDateTimeListPeriod } from '../dates/datetime/formatDateTimeListPeriod';
7
+
8
+ describe('calendar formatters', () => {
9
+ it('formats month calendar year as string', () => {
10
+ expect(formatMonthCalendarYear(2026)).toBe('2026');
11
+ });
12
+
13
+ it('returns seven weekday labels starting from first day of week', () => {
14
+ const labels = getCalendarWeekdayLabels({ locale: 'en-US', firstDayOfWeek: 1 });
15
+ expect(labels).toHaveLength(7);
16
+ expect(labels.every((label) => label.length > 0)).toBe(true);
17
+ });
18
+
19
+ it('formats date list row with today override', () => {
20
+ expect(
21
+ formatDateTimeListDateRow('2026-07-28', { locale: 'en-US', todayDateId: '2026-07-28' }),
22
+ ).toBeTruthy();
23
+ });
24
+
25
+ it('formats date list row for non-today dates', () => {
26
+ expect(formatDateTimeListDateRow('2026-01-15', { locale: 'en-US' })).toContain('15');
27
+ });
28
+
29
+ it('formats date-time list hour, minute, and period', () => {
30
+ expect(formatDateTimeListHour(14, { hour12: true })).toBe('2');
31
+ expect(formatDateTimeListHour(14)).toBe('14');
32
+ expect(formatDateTimeListMinute(30)).toBe('30');
33
+ expect(formatDateTimeListPeriod(14, { locale: 'en-US' })).toMatch(/PM/i);
34
+ });
35
+ });
@@ -0,0 +1,16 @@
1
+ import { clampDateParts } from '../dates/wire/clampDateParts';
2
+
3
+ describe('clampDateParts', () => {
4
+ it('clamps date parts to the month length', () => {
5
+ expect(clampDateParts({ year: 2026, month: 2, day: 31 })).toEqual({
6
+ year: 2026,
7
+ month: 2,
8
+ day: 28,
9
+ });
10
+ expect(clampDateParts({ year: 2024, month: 2, day: 31 })).toEqual({
11
+ year: 2024,
12
+ month: 2,
13
+ day: 29,
14
+ });
15
+ });
16
+ });
@@ -0,0 +1,7 @@
1
+ import { compareDateIds } from '../dates/ranges/compareDateIds';
2
+
3
+ describe('compareDateIds', () => {
4
+ it('compares date ids', () => {
5
+ expect(compareDateIds('2026-07-01', '2026-07-28')).toBe(-1);
6
+ });
7
+ });
@@ -0,0 +1,19 @@
1
+ import { compareMonthIds } from '../dates/ranges/compareMonthIds';
2
+
3
+ describe('compareMonthIds', () => {
4
+ it('returns -1 when first month is earlier', () => {
5
+ expect(compareMonthIds('2026-01-01', '2026-07-01')).toBe(-1);
6
+ });
7
+
8
+ it('returns 1 when first month is later', () => {
9
+ expect(compareMonthIds('2026-12-01', '2026-07-01')).toBe(1);
10
+ });
11
+
12
+ it('returns 0 for equal months', () => {
13
+ expect(compareMonthIds('2026-07-01', '2026-07-01')).toBe(0);
14
+ });
15
+
16
+ it('returns 0 when either month is invalid', () => {
17
+ expect(compareMonthIds('invalid', '2026-07-01')).toBe(0);
18
+ });
19
+ });
@@ -0,0 +1,25 @@
1
+ import {
2
+ DEFAULT_DATE_COMPONENT_LABELS,
3
+ formatSelectYear,
4
+ getDateSegmentAccessibilityLabel,
5
+ resolveDateComponentLabels,
6
+ } from '../dates/labels/dateComponentLabels';
7
+
8
+ describe('dateComponentLabels', () => {
9
+ it('merges partial overrides with defaults', () => {
10
+ const labels = resolveDateComponentLabels({ previousMonth: 'Back' });
11
+ expect(labels.previousMonth).toBe('Back');
12
+ expect(labels.nextMonth).toBe(DEFAULT_DATE_COMPONENT_LABELS.nextMonth);
13
+ });
14
+
15
+ it('formats select year with placeholder', () => {
16
+ const labels = resolveDateComponentLabels();
17
+ expect(formatSelectYear(labels, 2030)).toBe('Select year 2030');
18
+ });
19
+
20
+ it('maps segment types to accessibility labels', () => {
21
+ const labels = resolveDateComponentLabels();
22
+ expect(getDateSegmentAccessibilityLabel('month', labels)).toBe('Month');
23
+ expect(getDateSegmentAccessibilityLabel('literal', labels)).toBeUndefined();
24
+ });
25
+ });
@@ -0,0 +1,10 @@
1
+ import { dateRangeAroundDay } from '../dates/ranges/dateRangeAroundDay';
2
+
3
+ describe('dateRangeAroundDay', () => {
4
+ it('builds a window around an anchor day', () => {
5
+ expect(dateRangeAroundDay(1, 1, '2026-07-28')).toEqual({
6
+ startId: '2026-07-27',
7
+ endId: '2026-07-29',
8
+ });
9
+ });
10
+ });
@@ -0,0 +1,8 @@
1
+ import { dateRangeFromLastNDays } from '../dates/ranges/dateRangeFromLastNDays';
2
+
3
+ describe('dateRangeFromLastNDays', () => {
4
+ it('builds last N days preset inclusive of end', () => {
5
+ const range = dateRangeFromLastNDays(3, '2026-07-30');
6
+ expect(range).toEqual({ startId: '2026-07-28', endId: '2026-07-30' });
7
+ });
8
+ });
@@ -0,0 +1,24 @@
1
+ import { getEmptyDateSegmentText } from '../dates/segments/getEmptyDateSegmentText';
2
+ import { formatDateSegment } from '../dates/segments/formatDateSegment';
3
+ import { parseDateSegment } from '../dates/segments/parseDateSegment';
4
+
5
+ describe('date segment helpers', () => {
6
+ it('returns placeholder text for empty segments', () => {
7
+ expect(getEmptyDateSegmentText('month')).toBe('MM');
8
+ expect(getEmptyDateSegmentText('day')).toBe('DD');
9
+ expect(getEmptyDateSegmentText('year')).toBe('YYYY');
10
+ expect(getEmptyDateSegmentText('literal')).toBe('');
11
+ });
12
+
13
+ it('formats segment values with padding', () => {
14
+ expect(formatDateSegment('month', 7)).toBe('07');
15
+ expect(formatDateSegment('year', 2026)).toBe('2026');
16
+ });
17
+
18
+ it('parses segment text to numbers', () => {
19
+ expect(parseDateSegment('month', '07')).toBe(7);
20
+ expect(parseDateSegment('day', '')).toBeNull();
21
+ expect(parseDateSegment('literal', ' / ')).toBeNull();
22
+ expect(parseDateSegment('month', 'abc')).toBeNull();
23
+ });
24
+ });
@@ -0,0 +1,65 @@
1
+ import { compareDateTimeIds } from '../dates/datetime/compareDateTimeIds';
2
+ import { clampDateTimeId } from '../dates/datetime/clampDateTimeId';
3
+ import { nowDateTimeId } from '../dates/datetime/nowDateTimeId';
4
+ import { isLocaleHour12 } from '../dates/datetime/isLocaleHour12';
5
+
6
+ describe('datetime helpers', () => {
7
+ describe('compareDateTimeIds', () => {
8
+ it('compares chronologically', () => {
9
+ expect(compareDateTimeIds('2026-07-01T09:00', '2026-07-01T10:00')).toBe(-1);
10
+ expect(compareDateTimeIds('2026-07-02T09:00', '2026-07-01T10:00')).toBe(1);
11
+ expect(compareDateTimeIds('2026-07-01T10:00', '2026-07-01T10:00')).toBe(0);
12
+ });
13
+ });
14
+
15
+ describe('clampDateTimeId', () => {
16
+ it('clamps to inclusive bounds', () => {
17
+ expect(
18
+ clampDateTimeId('2026-01-01T00:00', {
19
+ min: '2026-07-01T00:00',
20
+ max: '2026-12-31T23:59',
21
+ }),
22
+ ).toBe('2026-07-01T00:00');
23
+ expect(
24
+ clampDateTimeId('2027-01-01T00:00', {
25
+ min: '2026-07-01T00:00',
26
+ max: '2026-12-31T23:59',
27
+ }),
28
+ ).toBe('2026-12-31T23:59');
29
+ expect(
30
+ clampDateTimeId('2026-08-01T12:00', {
31
+ min: '2026-07-01T00:00',
32
+ max: '2026-12-31T23:59',
33
+ }),
34
+ ).toBe('2026-08-01T12:00');
35
+ });
36
+ });
37
+
38
+ describe('nowDateTimeId', () => {
39
+ beforeEach(() => {
40
+ jest.useFakeTimers();
41
+ jest.setSystemTime(new Date(2026, 6, 28, 14, 30, 45));
42
+ });
43
+
44
+ afterEach(() => {
45
+ jest.useRealTimers();
46
+ });
47
+
48
+ it('returns current local time truncated by granularity', () => {
49
+ expect(nowDateTimeId({ granularity: 'minute' })).toBe('2026-07-28T14:30');
50
+ expect(nowDateTimeId({ granularity: 'hour' })).toBe('2026-07-28T14:00');
51
+ expect(nowDateTimeId({ granularity: 'day' })).toBe('2026-07-28T00:00');
52
+ expect(nowDateTimeId({ granularity: 'second' })).toBe('2026-07-28T14:30:45');
53
+ });
54
+ });
55
+
56
+ describe('isLocaleHour12', () => {
57
+ it('detects 12-hour locales', () => {
58
+ expect(isLocaleHour12('en-US')).toBe(true);
59
+ });
60
+
61
+ it('falls back to true on invalid locale', () => {
62
+ expect(isLocaleHour12('invalid-locale-xyz')).toBe(true);
63
+ });
64
+ });
65
+ });
@@ -0,0 +1,34 @@
1
+ import { formatDateRangeForDisplay } from '../dates/display/formatDateRangeForDisplay';
2
+ import { formatMonthForDisplay } from '../dates/display/formatMonthForDisplay';
3
+ import { formatDateTimeForDisplay } from '../dates/display/formatDateTimeForDisplay';
4
+
5
+ describe('display formatters', () => {
6
+ it('formats date range for display', () => {
7
+ const result = formatDateRangeForDisplay({
8
+ startId: '2026-07-01',
9
+ endId: '2026-07-28',
10
+ });
11
+ expect(result).toContain('7/1');
12
+ expect(result).toMatch(/–|—|-|to/i);
13
+ });
14
+
15
+ it('uses custom range separator when provided', () => {
16
+ const result = formatDateRangeForDisplay(
17
+ { startId: '2026-07-01', endId: '2026-07-28' },
18
+ { rangeSeparator: ' to ' },
19
+ );
20
+ expect(result).toContain(' to ');
21
+ });
22
+
23
+ it('formats month for display', () => {
24
+ expect(formatMonthForDisplay('2026-07-01', { locale: 'en-US' })).toContain('2026');
25
+ expect(formatMonthForDisplay('2026-07-01', { locale: 'en-US', dateStyle: 'long' })).toMatch(
26
+ /July/i,
27
+ );
28
+ });
29
+
30
+ it('formats date-time for display', () => {
31
+ expect(formatDateTimeForDisplay('2026-07-28T10:01', { locale: 'en-US' })).toContain('2026');
32
+ expect(formatDateTimeForDisplay('invalid', { locale: 'en-US' })).toBe('');
33
+ });
34
+ });
@@ -0,0 +1,11 @@
1
+ import { eachDateIdInRange } from '../dates/ranges/eachDateIdInRange';
2
+
3
+ describe('eachDateIdInRange', () => {
4
+ it('lists each day in range', () => {
5
+ expect(eachDateIdInRange('2026-07-27', '2026-07-29')).toEqual([
6
+ '2026-07-27',
7
+ '2026-07-28',
8
+ '2026-07-29',
9
+ ]);
10
+ });
11
+ });
@@ -0,0 +1,9 @@
1
+ import { formatCalendarMonthYear } from '../dates/calendar/formatCalendarMonthYear';
2
+ import { formatMonthCalendarMonth } from '../dates/calendar/formatMonthCalendarMonth';
3
+
4
+ describe('formatCalendarMonthYear', () => {
5
+ it('formats calendar month/year with locale', () => {
6
+ expect(formatCalendarMonthYear('2026-07-01', { locale: 'en-US' })).toContain('2026');
7
+ expect(formatMonthCalendarMonth(7, { locale: 'en-US' })).toMatch(/Jul/i);
8
+ });
9
+ });
@@ -0,0 +1,11 @@
1
+ import { formatDateForDisplay } from '../dates/display/formatDateForDisplay';
2
+
3
+ describe('formatDateForDisplay', () => {
4
+ it('formats date for en-US locale', () => {
5
+ const formatted = formatDateForDisplay('2026-07-28', {
6
+ locale: 'en-US',
7
+ dateStyle: 'long',
8
+ });
9
+ expect(formatted).toContain('2026');
10
+ });
11
+ });
@@ -0,0 +1,15 @@
1
+ import { formatDateId } from '../dates/wire/formatDateId';
2
+ import { parseDateId } from '../dates/wire/parseDateId';
3
+
4
+ describe('formatDateId', () => {
5
+ it('round-trips DateId', () => {
6
+ const id = formatDateId({ year: 2026, month: 7, day: 28 });
7
+ expect(id).toBe('2026-07-28');
8
+ expect(parseDateId(id)).toEqual({ year: 2026, month: 7, day: 28 });
9
+ });
10
+
11
+ it('clamps invalid day instead of rolling over via Date', () => {
12
+ expect(formatDateId({ year: 2026, month: 2, day: 31 })).toBe('2026-02-28');
13
+ expect(formatDateId({ year: 2024, month: 2, day: 31 })).toBe('2024-02-29');
14
+ });
15
+ });
@@ -0,0 +1,7 @@
1
+ import { formatMonthId } from '../dates/wire/formatMonthId';
2
+
3
+ describe('formatMonthId', () => {
4
+ it('formats month id', () => {
5
+ expect(formatMonthId({ year: 2026, month: 7 })).toBe('2026-07-01');
6
+ });
7
+ });
@@ -0,0 +1,35 @@
1
+ import { formatNumber } from '../formatNumber';
2
+
3
+ describe('formatNumber', () => {
4
+ it('should format with default decimal places', () => {
5
+ expect(formatNumber(99.95789)).toEqual('99.96');
6
+ });
7
+
8
+ it('should format a string with custom decimal places', () => {
9
+ expect(formatNumber('-2000', { decimalPlaces: 3 })).toEqual('-2,000.000');
10
+ });
11
+
12
+ it('should format using locale', () => {
13
+ expect(formatNumber(1234.5, { locale: 'de-DE' })).toEqual('1.234,50');
14
+ });
15
+
16
+ it('should omit the sign for signed zero (-0)', () => {
17
+ expect(formatNumber(-0)).toEqual('0.00');
18
+ });
19
+
20
+ it('should use defaults when options is nullish or fields are null', () => {
21
+ expect(formatNumber(1234.5, null)).toEqual('1,234.50');
22
+ expect(formatNumber(1234.5, undefined)).toEqual('1,234.50');
23
+ expect(formatNumber(1234.5, { locale: null, decimalPlaces: null })).toEqual('1,234.50');
24
+ });
25
+
26
+ [null, undefined, Number.NaN, 'asdf', '', ' '].forEach((value) => {
27
+ it(`should return empty string for ${JSON.stringify(value)}`, () => {
28
+ expect(formatNumber(value)).toEqual('');
29
+ });
30
+ });
31
+
32
+ it('should return empty string for already-formatted numbers', () => {
33
+ expect(formatNumber('1,234.56')).toEqual('');
34
+ });
35
+ });
@@ -0,0 +1,35 @@
1
+ import { getDateFieldSegments } from '../dates/segments/getDateFieldSegments';
2
+
3
+ describe('getDateFieldSegments', () => {
4
+ it('returns date field segments', () => {
5
+ const segments = getDateFieldSegments('2026-07-28', { mode: 'date', locale: 'en-US' });
6
+ expect(segments.map((s) => s.type)).toEqual(['month', 'literal', 'day', 'literal', 'year']);
7
+ expect(segments.filter((s) => s.type === 'literal').map((s) => s.text)).toEqual(['/', '/']);
8
+ });
9
+
10
+ it('orders date field segments by locale', () => {
11
+ const deSegments = getDateFieldSegments('2026-07-28', { mode: 'date', locale: 'de-DE' });
12
+ expect(deSegments.map((s) => s.type)).toEqual(['day', 'literal', 'month', 'literal', 'year']);
13
+ expect(deSegments.filter((s) => s.type === 'literal').map((s) => s.text)).toEqual(['.', '.']);
14
+
15
+ const jpSegments = getDateFieldSegments('2026-07-28', { mode: 'date', locale: 'ja-JP' });
16
+ expect(jpSegments.map((s) => s.type)).toEqual(['year', 'literal', 'month', 'literal', 'day']);
17
+ });
18
+
19
+ it('orders month field segments by locale', () => {
20
+ const deSegments = getDateFieldSegments('2026-07-01', { mode: 'month', locale: 'de-DE' });
21
+ expect(deSegments.map((s) => s.type)).toEqual(['month', 'literal', 'year']);
22
+ const expectedLiteral = new Intl.DateTimeFormat('de-DE', { year: 'numeric', month: '2-digit' })
23
+ .formatToParts(new Date(2026, 6, 1))
24
+ .find((part) => part.type === 'literal')?.value;
25
+ expect(deSegments.find((s) => s.type === 'literal')?.text).toBe(expectedLiteral);
26
+ });
27
+
28
+ it('returns placeholder segments when value is empty', () => {
29
+ const segments = getDateFieldSegments(undefined, { mode: 'date', locale: 'en-US' });
30
+ expect(segments.find((s) => s.type === 'month')?.text).toBe('MM');
31
+ expect(segments.find((s) => s.type === 'month')?.value).toBeUndefined();
32
+ expect(segments.find((s) => s.type === 'day')?.text).toBe('DD');
33
+ expect(segments.find((s) => s.type === 'year')?.text).toBe('YYYY');
34
+ });
35
+ });