@nova-design-system/nova-webcomponents 3.0.0 → 3.2.0

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 (532) hide show
  1. package/dist/cjs/{constants-bcd6b2e2.js → constants-8fb8ccc0.js} +14 -1
  2. package/dist/cjs/constants-8fb8ccc0.js.map +1 -0
  3. package/dist/cjs/{index-9bda5507.js → index-108ddff0.js} +22 -6
  4. package/dist/cjs/index-108ddff0.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +5 -471
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/native.cjs.js +2 -2
  9. package/dist/cjs/nv-alert.cjs.entry.js +6 -6
  10. package/dist/cjs/nv-alert.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nv-avatar.cjs.entry.js +2 -2
  12. package/dist/cjs/nv-badge_2.cjs.entry.js +18 -9
  13. package/dist/cjs/nv-badge_2.cjs.entry.js.map +1 -1
  14. package/dist/cjs/nv-breadcrumb.cjs.entry.js +1 -1
  15. package/dist/cjs/nv-breadcrumbs.cjs.entry.js +1 -1
  16. package/dist/cjs/nv-button.cjs.entry.js +2 -2
  17. package/dist/cjs/nv-calendar.cjs.entry.js +821 -843
  18. package/dist/cjs/nv-calendar.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nv-col.cjs.entry.js +1 -1
  20. package/dist/cjs/nv-datagrid.cjs.entry.js +423 -94
  21. package/dist/cjs/nv-datagrid.cjs.entry.js.map +1 -1
  22. package/dist/cjs/nv-datagridcolumn.cjs.entry.js +2 -2
  23. package/dist/cjs/nv-datagridcolumn.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nv-dialog.cjs.entry.js +19 -13
  25. package/dist/cjs/nv-dialog.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nv-dialogfooter_2.cjs.entry.js +2 -2
  27. package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +1 -1
  28. package/dist/cjs/nv-fielddate.cjs.entry.js +9 -18
  29. package/dist/cjs/nv-fielddate.cjs.entry.js.map +1 -1
  30. package/dist/cjs/nv-fielddaterange.cjs.entry.js +85 -32
  31. package/dist/cjs/nv-fielddaterange.cjs.entry.js.map +1 -1
  32. package/dist/cjs/nv-fielddropdown.cjs.entry.js +88 -57
  33. package/dist/cjs/nv-fielddropdown.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nv-fielddropdownitem.cjs.entry.js +2 -2
  35. package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +122 -104
  36. package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -1
  37. package/dist/cjs/nv-fieldnumber.cjs.entry.js +9 -5
  38. package/dist/cjs/nv-fieldnumber.cjs.entry.js.map +1 -1
  39. package/dist/cjs/nv-fieldpassword.cjs.entry.js +9 -5
  40. package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -1
  41. package/dist/cjs/nv-fieldradio.cjs.entry.js +4 -4
  42. package/dist/cjs/nv-fieldselect.cjs.entry.js +11 -7
  43. package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -1
  44. package/dist/cjs/nv-fieldslider.cjs.entry.js +663 -0
  45. package/dist/cjs/nv-fieldslider.cjs.entry.js.map +1 -0
  46. package/dist/cjs/nv-fieldtext.cjs.entry.js +9 -5
  47. package/dist/cjs/nv-fieldtext.cjs.entry.js.map +1 -1
  48. package/dist/cjs/nv-fieldtextarea.cjs.entry.js +9 -5
  49. package/dist/cjs/nv-fieldtextarea.cjs.entry.js.map +1 -1
  50. package/dist/cjs/nv-fieldtime.cjs.entry.js +16 -13
  51. package/dist/cjs/nv-fieldtime.cjs.entry.js.map +1 -1
  52. package/dist/cjs/nv-icon.cjs.entry.js +4 -4
  53. package/dist/cjs/nv-icon.cjs.entry.js.map +1 -1
  54. package/dist/cjs/nv-iconbutton_2.cjs.entry.js +3 -3
  55. package/dist/cjs/nv-menu.cjs.entry.js +4 -2
  56. package/dist/cjs/nv-menu.cjs.entry.js.map +1 -1
  57. package/dist/cjs/nv-menuitem.cjs.entry.js +2 -2
  58. package/dist/cjs/nv-popover.cjs.entry.js +2 -2
  59. package/dist/cjs/nv-row.cjs.entry.js +2 -2
  60. package/dist/cjs/nv-stack.cjs.entry.js +2 -2
  61. package/dist/cjs/nv-table.cjs.entry.js +3 -3
  62. package/dist/cjs/nv-table.cjs.entry.js.map +1 -1
  63. package/dist/cjs/nv-tablecolumn.cjs.entry.js +1 -1
  64. package/dist/cjs/nv-toggle.cjs.entry.js +3 -3
  65. package/dist/cjs/nv-tooltip.cjs.entry.js +3 -3
  66. package/dist/cjs/nv-tooltip.cjs.entry.js.map +1 -1
  67. package/dist/collection/collection-manifest.json +1 -0
  68. package/dist/collection/components/nv-alert/nv-alert.css +3 -0
  69. package/dist/collection/components/nv-alert/nv-alert.js +6 -11
  70. package/dist/collection/components/nv-alert/nv-alert.js.map +1 -1
  71. package/dist/collection/components/nv-badge/nv-badge.css +181 -1
  72. package/dist/collection/components/nv-badge/nv-badge.docs.js +20 -1
  73. package/dist/collection/components/nv-badge/nv-badge.docs.js.map +1 -1
  74. package/dist/collection/components/nv-badge/nv-badge.js +39 -15
  75. package/dist/collection/components/nv-badge/nv-badge.js.map +1 -1
  76. package/dist/collection/components/nv-breadcrumbs/nv-breadcrumbs.docs.js +0 -1
  77. package/dist/collection/components/nv-breadcrumbs/nv-breadcrumbs.docs.js.map +1 -1
  78. package/dist/collection/components/nv-calendar/nv-calendar.css +25 -2
  79. package/dist/collection/components/nv-calendar/nv-calendar.docs.js +33 -38
  80. package/dist/collection/components/nv-calendar/nv-calendar.docs.js.map +1 -1
  81. package/dist/collection/components/nv-calendar/nv-calendar.js +659 -897
  82. package/dist/collection/components/nv-calendar/nv-calendar.js.map +1 -1
  83. package/dist/collection/components/nv-calendar/nv-calendar.utils.js +202 -0
  84. package/dist/collection/components/nv-calendar/nv-calendar.utils.js.map +1 -0
  85. package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js +667 -0
  86. package/dist/collection/components/nv-calendar/test/nv-calendar.utils.test.js.map +1 -0
  87. package/dist/collection/components/nv-datagrid/nv-datagrid.css +98 -0
  88. package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js +232 -51
  89. package/dist/collection/components/nv-datagrid/nv-datagrid.docs.js.map +1 -1
  90. package/dist/collection/components/nv-datagrid/nv-datagrid.js +437 -160
  91. package/dist/collection/components/nv-datagrid/nv-datagrid.js.map +1 -1
  92. package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js +20 -1
  93. package/dist/collection/components/nv-datagridcolumn/nv-datagridcolumn.js.map +1 -1
  94. package/dist/collection/components/nv-dialog/nv-dialog.css +29 -5
  95. package/dist/collection/components/nv-dialog/nv-dialog.docs.js +0 -1
  96. package/dist/collection/components/nv-dialog/nv-dialog.docs.js.map +1 -1
  97. package/dist/collection/components/nv-dialog/nv-dialog.js +16 -10
  98. package/dist/collection/components/nv-dialog/nv-dialog.js.map +1 -1
  99. package/dist/collection/components/nv-fielddate/nv-fielddate.docs.js +16 -8
  100. package/dist/collection/components/nv-fielddate/nv-fielddate.docs.js.map +1 -1
  101. package/dist/collection/components/nv-fielddate/nv-fielddate.js +48 -39
  102. package/dist/collection/components/nv-fielddate/nv-fielddate.js.map +1 -1
  103. package/dist/collection/components/nv-fielddate/styles/nv-fielddate.css +14 -1
  104. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.docs.js +12 -15
  105. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.docs.js.map +1 -1
  106. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js +147 -68
  107. package/dist/collection/components/nv-fielddaterange/nv-fielddaterange.js.map +1 -1
  108. package/dist/collection/components/nv-fielddaterange/styles/nv-fielddaterange.css +20 -12
  109. package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js +16 -0
  110. package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.docs.js.map +1 -1
  111. package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js +197 -103
  112. package/dist/collection/components/nv-fielddropdown/nv-fielddropdown.js.map +1 -1
  113. package/dist/collection/components/nv-fielddropdown/styles/nv-fielddropdown.css +36 -1
  114. package/dist/collection/components/nv-fielddropdownitem/nv-fielddropdownitem.js +1 -1
  115. package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +1 -1
  116. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js +8 -1
  117. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js.map +1 -1
  118. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +228 -190
  119. package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -1
  120. package/dist/collection/components/nv-fieldmultiselect/{nv-fieldmultiselect.css → styles/nv-fieldmultiselect.css} +36 -1
  121. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.css +12 -1
  122. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js +8 -0
  123. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js.map +1 -1
  124. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +27 -3
  125. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js.map +1 -1
  126. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.css +12 -1
  127. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js +8 -0
  128. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js.map +1 -1
  129. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +27 -3
  130. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js.map +1 -1
  131. package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
  132. package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +12 -1
  133. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js +8 -0
  134. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js.map +1 -1
  135. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +29 -5
  136. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -1
  137. package/dist/collection/components/nv-fieldslider/nv-fieldslider.docs.js +264 -0
  138. package/dist/collection/components/nv-fieldslider/nv-fieldslider.docs.js.map +1 -0
  139. package/dist/collection/components/nv-fieldslider/nv-fieldslider.js +1035 -0
  140. package/dist/collection/components/nv-fieldslider/nv-fieldslider.js.map +1 -0
  141. package/dist/collection/components/nv-fieldslider/nv-fieldslider.utils.js +77 -0
  142. package/dist/collection/components/nv-fieldslider/nv-fieldslider.utils.js.map +1 -0
  143. package/dist/collection/components/nv-fieldslider/partials/field-input.js +33 -0
  144. package/dist/collection/components/nv-fieldslider/partials/field-input.js.map +1 -0
  145. package/dist/collection/components/nv-fieldslider/partials/range-thumb.js +34 -0
  146. package/dist/collection/components/nv-fieldslider/partials/range-thumb.js.map +1 -0
  147. package/dist/collection/components/nv-fieldslider/partials/single-thumb.js +18 -0
  148. package/dist/collection/components/nv-fieldslider/partials/single-thumb.js.map +1 -0
  149. package/dist/collection/components/nv-fieldslider/partials/tick-marks.js +18 -0
  150. package/dist/collection/components/nv-fieldslider/partials/tick-marks.js.map +1 -0
  151. package/dist/collection/components/nv-fieldslider/styles/nv-fieldslider.css +267 -0
  152. package/dist/collection/components/nv-fieldslider/test/nv-fieldslider.utils.test.js +159 -0
  153. package/dist/collection/components/nv-fieldslider/test/nv-fieldslider.utils.test.js.map +1 -0
  154. package/dist/collection/components/nv-fieldtext/nv-fieldtext.css +20 -1
  155. package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js +17 -1
  156. package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js.map +1 -1
  157. package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +28 -3
  158. package/dist/collection/components/nv-fieldtext/nv-fieldtext.js.map +1 -1
  159. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.css +30 -1
  160. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js +8 -0
  161. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js.map +1 -1
  162. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +27 -3
  163. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js.map +1 -1
  164. package/dist/collection/components/nv-fieldtime/nv-fieldtime.js +13 -10
  165. package/dist/collection/components/nv-fieldtime/nv-fieldtime.js.map +1 -1
  166. package/dist/collection/components/nv-fieldtime/styles/nv-fieldtime.css +26 -3
  167. package/dist/collection/components/nv-icon/nv-icon.js +1 -1
  168. package/dist/collection/components/nv-icon/nv-icons.js +4 -470
  169. package/dist/collection/components/nv-icon/nv-icons.js.map +1 -1
  170. package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
  171. package/dist/collection/components/nv-loader/nv-loader.js +1 -1
  172. package/dist/collection/components/nv-menu/nv-menu.js +3 -1
  173. package/dist/collection/components/nv-menu/nv-menu.js.map +1 -1
  174. package/dist/collection/components/nv-menuitem/nv-menuitem.js +2 -2
  175. package/dist/collection/components/nv-popover/nv-popover.js +1 -1
  176. package/dist/collection/components/nv-row/nv-row.js +1 -1
  177. package/dist/collection/components/nv-stack/nv-stack.js +1 -1
  178. package/dist/collection/components/nv-table/nv-table.js +8 -11
  179. package/dist/collection/components/nv-table/nv-table.js.map +1 -1
  180. package/dist/collection/components/nv-toggle/nv-toggle.js +2 -2
  181. package/dist/collection/components/nv-tooltip/nv-tooltip.css +1 -0
  182. package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
  183. package/dist/collection/index.js.map +1 -1
  184. package/dist/collection/interfaces/Column.js.map +1 -1
  185. package/dist/collection/templates/navigation.docs.js +0 -1
  186. package/dist/collection/templates/navigation.docs.js.map +1 -1
  187. package/dist/collection/utils/constants.js +11 -0
  188. package/dist/collection/utils/constants.js.map +1 -1
  189. package/dist/components/index.js +6 -472
  190. package/dist/components/index.js.map +1 -1
  191. package/dist/components/nv-alert.js +7 -7
  192. package/dist/components/nv-alert.js.map +1 -1
  193. package/dist/components/nv-avatar.js +3 -3
  194. package/dist/components/nv-badge.js +1 -1
  195. package/dist/components/nv-breadcrumb.js +3 -3
  196. package/dist/components/nv-breadcrumbs.js +1 -1
  197. package/dist/components/nv-button.js +1 -1
  198. package/dist/components/nv-calendar.js +1 -1
  199. package/dist/components/nv-col.js +1 -1
  200. package/dist/components/nv-datagrid.js +447 -102
  201. package/dist/components/nv-datagrid.js.map +1 -1
  202. package/dist/components/nv-datagridcolumn.js +4 -3
  203. package/dist/components/nv-datagridcolumn.js.map +1 -1
  204. package/dist/components/nv-dialog.js +24 -18
  205. package/dist/components/nv-dialog.js.map +1 -1
  206. package/dist/components/nv-dialogfooter.js +1 -1
  207. package/dist/components/nv-dialogheader.js +1 -1
  208. package/dist/components/nv-fieldcheckbox.js +1 -1
  209. package/dist/components/nv-fielddate.js +19 -27
  210. package/dist/components/nv-fielddate.js.map +1 -1
  211. package/dist/components/nv-fielddaterange.js +99 -44
  212. package/dist/components/nv-fielddaterange.js.map +1 -1
  213. package/dist/components/nv-fielddropdown.js +103 -69
  214. package/dist/components/nv-fielddropdown.js.map +1 -1
  215. package/dist/components/nv-fielddropdownitem.js +1 -1
  216. package/dist/components/nv-fielddropdownitemcheck.js +1 -1
  217. package/dist/components/nv-fieldmultiselect.js +139 -120
  218. package/dist/components/nv-fieldmultiselect.js.map +1 -1
  219. package/dist/components/nv-fieldnumber.js +14 -9
  220. package/dist/components/nv-fieldnumber.js.map +1 -1
  221. package/dist/components/nv-fieldpassword.js +13 -8
  222. package/dist/components/nv-fieldpassword.js.map +1 -1
  223. package/dist/components/nv-fieldradio.js +4 -4
  224. package/dist/components/nv-fieldselect.js +15 -10
  225. package/dist/components/nv-fieldselect.js.map +1 -1
  226. package/dist/components/nv-fieldslider.d.ts +11 -0
  227. package/dist/components/nv-fieldslider.js +726 -0
  228. package/dist/components/nv-fieldslider.js.map +1 -0
  229. package/dist/components/nv-fieldtext.js +1 -158
  230. package/dist/components/nv-fieldtext.js.map +1 -1
  231. package/dist/components/nv-fieldtextarea.js +11 -6
  232. package/dist/components/nv-fieldtextarea.js.map +1 -1
  233. package/dist/components/nv-fieldtime.js +20 -17
  234. package/dist/components/nv-fieldtime.js.map +1 -1
  235. package/dist/components/nv-icon.js +1 -1
  236. package/dist/components/nv-iconbutton.js +1 -1
  237. package/dist/components/nv-loader.js +1 -1
  238. package/dist/components/nv-menu.js +7 -5
  239. package/dist/components/nv-menu.js.map +1 -1
  240. package/dist/components/nv-menuitem.js +1 -1
  241. package/dist/components/nv-popover.js +1 -1
  242. package/dist/components/nv-row.js +2 -2
  243. package/dist/components/nv-stack.js +2 -2
  244. package/dist/components/nv-table.js +3 -3
  245. package/dist/components/nv-table.js.map +1 -1
  246. package/dist/components/nv-tablecolumn.js +1 -1
  247. package/dist/components/nv-toggle.js +3 -3
  248. package/dist/components/nv-tooltip.js +1 -1
  249. package/dist/components/{p-dc3faba3.js → p-04cb3a6f.js} +5 -5
  250. package/dist/components/{p-dc3faba3.js.map → p-04cb3a6f.js.map} +1 -1
  251. package/dist/components/p-07a89754.js +187 -0
  252. package/dist/components/p-07a89754.js.map +1 -0
  253. package/dist/components/{p-b7b78e64.js → p-0ab80d95.js} +3 -3
  254. package/dist/components/{p-b7b78e64.js.map → p-0ab80d95.js.map} +1 -1
  255. package/dist/components/{p-8348db09.js → p-1f505531.js} +15 -2
  256. package/dist/components/p-1f505531.js.map +1 -0
  257. package/dist/components/{p-02752770.js → p-33e231f4.js} +2 -2
  258. package/dist/components/{p-02752770.js.map → p-33e231f4.js.map} +1 -1
  259. package/dist/components/p-4656efae.js +1111 -0
  260. package/dist/components/p-4656efae.js.map +1 -0
  261. package/dist/components/{p-2012b8ba.js → p-581e67cc.js} +4 -4
  262. package/dist/components/{p-2012b8ba.js.map → p-581e67cc.js.map} +1 -1
  263. package/dist/components/{p-1c45c0f2.js → p-679e0fa9.js} +16 -4
  264. package/dist/components/p-679e0fa9.js.map +1 -0
  265. package/dist/components/p-76a30bf1.js +88 -0
  266. package/dist/components/p-76a30bf1.js.map +1 -0
  267. package/dist/components/{p-150daf68.js → p-83c8873a.js} +3 -3
  268. package/dist/components/{p-150daf68.js.map → p-83c8873a.js.map} +1 -1
  269. package/dist/components/{p-c14f6b8e.js → p-c0a91091.js} +5 -5
  270. package/dist/components/p-c0a91091.js.map +1 -0
  271. package/dist/components/{p-6c364a23.js → p-cbdc2c8b.js} +6 -6
  272. package/dist/components/{p-6c364a23.js.map → p-cbdc2c8b.js.map} +1 -1
  273. package/dist/components/{p-2d9ba7d3.js → p-cbe9521f.js} +4 -4
  274. package/dist/components/{p-2d9ba7d3.js.map → p-cbe9521f.js.map} +1 -1
  275. package/dist/components/{p-a30b55fc.js → p-d19b41d2.js} +2 -2
  276. package/dist/components/{p-a30b55fc.js.map → p-d19b41d2.js.map} +1 -1
  277. package/dist/components/{p-4d3ec142.js → p-d63f1cbe.js} +4 -4
  278. package/dist/components/{p-4d3ec142.js.map → p-d63f1cbe.js.map} +1 -1
  279. package/dist/components/{p-e00cbb8a.js → p-dd2273a3.js} +2 -2
  280. package/dist/components/{p-e00cbb8a.js.map → p-dd2273a3.js.map} +1 -1
  281. package/dist/components/p-f0a5e7e4.js +167 -0
  282. package/dist/components/p-f0a5e7e4.js.map +1 -0
  283. package/dist/components/{p-f4d86795.js → p-f1859ddc.js} +4 -4
  284. package/dist/components/{p-f4d86795.js.map → p-f1859ddc.js.map} +1 -1
  285. package/dist/esm/{constants-98e2dcc2.js → constants-b97e736d.js} +15 -2
  286. package/dist/esm/constants-b97e736d.js.map +1 -0
  287. package/dist/esm/{index-1fb7a9a6.js → index-8f0e5f19.js} +22 -6
  288. package/dist/esm/index-8f0e5f19.js.map +1 -0
  289. package/dist/esm/index.js +5 -471
  290. package/dist/esm/index.js.map +1 -1
  291. package/dist/esm/loader.js +3 -3
  292. package/dist/esm/native.js +3 -3
  293. package/dist/esm/nv-alert.entry.js +6 -6
  294. package/dist/esm/nv-alert.entry.js.map +1 -1
  295. package/dist/esm/nv-avatar.entry.js +2 -2
  296. package/dist/esm/nv-badge_2.entry.js +18 -9
  297. package/dist/esm/nv-badge_2.entry.js.map +1 -1
  298. package/dist/esm/nv-breadcrumb.entry.js +1 -1
  299. package/dist/esm/nv-breadcrumbs.entry.js +1 -1
  300. package/dist/esm/nv-button.entry.js +2 -2
  301. package/dist/esm/nv-calendar.entry.js +821 -843
  302. package/dist/esm/nv-calendar.entry.js.map +1 -1
  303. package/dist/esm/nv-col.entry.js +1 -1
  304. package/dist/esm/nv-datagrid.entry.js +423 -94
  305. package/dist/esm/nv-datagrid.entry.js.map +1 -1
  306. package/dist/esm/nv-datagridcolumn.entry.js +2 -2
  307. package/dist/esm/nv-datagridcolumn.entry.js.map +1 -1
  308. package/dist/esm/nv-dialog.entry.js +19 -13
  309. package/dist/esm/nv-dialog.entry.js.map +1 -1
  310. package/dist/esm/nv-dialogfooter_2.entry.js +2 -2
  311. package/dist/esm/nv-fieldcheckbox.entry.js +1 -1
  312. package/dist/esm/nv-fielddate.entry.js +9 -18
  313. package/dist/esm/nv-fielddate.entry.js.map +1 -1
  314. package/dist/esm/nv-fielddaterange.entry.js +85 -32
  315. package/dist/esm/nv-fielddaterange.entry.js.map +1 -1
  316. package/dist/esm/nv-fielddropdown.entry.js +88 -57
  317. package/dist/esm/nv-fielddropdown.entry.js.map +1 -1
  318. package/dist/esm/nv-fielddropdownitem.entry.js +2 -2
  319. package/dist/esm/nv-fieldmultiselect.entry.js +122 -104
  320. package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -1
  321. package/dist/esm/nv-fieldnumber.entry.js +9 -5
  322. package/dist/esm/nv-fieldnumber.entry.js.map +1 -1
  323. package/dist/esm/nv-fieldpassword.entry.js +9 -5
  324. package/dist/esm/nv-fieldpassword.entry.js.map +1 -1
  325. package/dist/esm/nv-fieldradio.entry.js +4 -4
  326. package/dist/esm/nv-fieldselect.entry.js +11 -7
  327. package/dist/esm/nv-fieldselect.entry.js.map +1 -1
  328. package/dist/esm/nv-fieldslider.entry.js +659 -0
  329. package/dist/esm/nv-fieldslider.entry.js.map +1 -0
  330. package/dist/esm/nv-fieldtext.entry.js +9 -5
  331. package/dist/esm/nv-fieldtext.entry.js.map +1 -1
  332. package/dist/esm/nv-fieldtextarea.entry.js +9 -5
  333. package/dist/esm/nv-fieldtextarea.entry.js.map +1 -1
  334. package/dist/esm/nv-fieldtime.entry.js +16 -13
  335. package/dist/esm/nv-fieldtime.entry.js.map +1 -1
  336. package/dist/esm/nv-icon.entry.js +4 -4
  337. package/dist/esm/nv-icon.entry.js.map +1 -1
  338. package/dist/esm/nv-iconbutton_2.entry.js +3 -3
  339. package/dist/esm/nv-menu.entry.js +4 -2
  340. package/dist/esm/nv-menu.entry.js.map +1 -1
  341. package/dist/esm/nv-menuitem.entry.js +2 -2
  342. package/dist/esm/nv-popover.entry.js +2 -2
  343. package/dist/esm/nv-row.entry.js +2 -2
  344. package/dist/esm/nv-stack.entry.js +2 -2
  345. package/dist/esm/nv-table.entry.js +3 -3
  346. package/dist/esm/nv-table.entry.js.map +1 -1
  347. package/dist/esm/nv-tablecolumn.entry.js +1 -1
  348. package/dist/esm/nv-toggle.entry.js +3 -3
  349. package/dist/esm/nv-tooltip.entry.js +3 -3
  350. package/dist/esm/nv-tooltip.entry.js.map +1 -1
  351. package/dist/native/index.esm.js +1 -1
  352. package/dist/native/index.esm.js.map +1 -1
  353. package/dist/native/native.css +1 -1
  354. package/dist/native/native.esm.js +1 -1
  355. package/dist/native/native.esm.js.map +1 -1
  356. package/dist/native/{p-6b348684.entry.js → p-0323daf6.entry.js} +2 -2
  357. package/dist/native/{p-d5cbf5c8.entry.js → p-05d95d4d.entry.js} +2 -2
  358. package/dist/native/{p-fb5bddba.entry.js → p-0ec1e2e3.entry.js} +2 -2
  359. package/dist/native/{p-c7b201cd.entry.js → p-16a4cdf3.entry.js} +2 -2
  360. package/dist/native/p-19fb0fd0.entry.js +2 -0
  361. package/dist/native/p-19fb0fd0.entry.js.map +1 -0
  362. package/dist/native/p-1e3d3374.entry.js +2 -0
  363. package/dist/native/{p-9135fdf5.entry.js.map → p-1e3d3374.entry.js.map} +1 -1
  364. package/dist/native/p-21e7132f.entry.js +2 -0
  365. package/dist/native/p-21e7132f.entry.js.map +1 -0
  366. package/dist/native/p-221b8f72.entry.js +2 -0
  367. package/dist/native/p-221b8f72.entry.js.map +1 -0
  368. package/dist/native/p-2805f9f2.entry.js +2 -0
  369. package/dist/native/p-2805f9f2.entry.js.map +1 -0
  370. package/dist/native/p-3f2b6a22.entry.js +2 -0
  371. package/dist/native/p-3f2b6a22.entry.js.map +1 -0
  372. package/dist/native/{p-0245863d.entry.js → p-407fc32d.entry.js} +2 -2
  373. package/dist/native/{p-63e6aed3.entry.js → p-4c0d81b0.entry.js} +2 -2
  374. package/dist/native/p-4c0d81b0.entry.js.map +1 -0
  375. package/dist/native/{p-39bb95ff.entry.js → p-519b4819.entry.js} +2 -2
  376. package/dist/native/{p-fa77a591.entry.js → p-5382eab2.entry.js} +2 -2
  377. package/dist/native/p-5ba3fc3c.entry.js +2 -0
  378. package/dist/native/p-5ba3fc3c.entry.js.map +1 -0
  379. package/dist/native/{p-bad11367.entry.js → p-60b204ac.entry.js} +2 -2
  380. package/dist/native/p-60b204ac.entry.js.map +1 -0
  381. package/dist/native/p-7092a675.entry.js +2 -0
  382. package/dist/native/p-711a7778.js +3 -0
  383. package/dist/native/p-711a7778.js.map +1 -0
  384. package/dist/native/p-759c9ce4.entry.js +2 -0
  385. package/dist/native/p-759c9ce4.entry.js.map +1 -0
  386. package/dist/native/{p-d7a76400.entry.js → p-7c676f2c.entry.js} +2 -2
  387. package/dist/native/p-7c6edd1c.entry.js +2 -0
  388. package/dist/native/p-7c6edd1c.entry.js.map +1 -0
  389. package/dist/native/p-987c79d8.entry.js +2 -0
  390. package/dist/native/p-987c79d8.entry.js.map +1 -0
  391. package/dist/native/{p-f85aca27.entry.js → p-9fba8663.entry.js} +2 -2
  392. package/dist/native/{p-b094296d.entry.js → p-a2c0f1a7.entry.js} +2 -2
  393. package/dist/native/p-aa86af25.entry.js +2 -0
  394. package/dist/native/p-aa86af25.entry.js.map +1 -0
  395. package/dist/native/p-adc96c3a.entry.js +2 -0
  396. package/dist/native/p-adc96c3a.entry.js.map +1 -0
  397. package/dist/native/p-b0fc08e7.entry.js +2 -0
  398. package/dist/native/p-b0fc08e7.entry.js.map +1 -0
  399. package/dist/native/{p-6ff228da.entry.js → p-c930adb7.entry.js} +2 -2
  400. package/dist/native/{p-701b5557.entry.js → p-cfe0a6c6.entry.js} +2 -2
  401. package/dist/native/p-d07ab618.entry.js +2 -0
  402. package/dist/native/p-dac0089b.entry.js +2 -0
  403. package/dist/native/p-dac0089b.entry.js.map +1 -0
  404. package/dist/native/p-de2c07a6.entry.js +13 -0
  405. package/dist/native/p-de2c07a6.entry.js.map +1 -0
  406. package/dist/native/p-ed488498.entry.js +7 -0
  407. package/dist/native/p-ed488498.entry.js.map +1 -0
  408. package/dist/native/p-ef76178b.entry.js +2 -0
  409. package/dist/native/p-ef76178b.entry.js.map +1 -0
  410. package/dist/native/{p-e5de64d5.entry.js → p-f0ddf60b.entry.js} +2 -2
  411. package/dist/native/p-f39803d9.entry.js +2 -0
  412. package/dist/native/p-f39803d9.entry.js.map +1 -0
  413. package/dist/native/{p-59768ee5.js → p-f85c08f1.js} +2 -2
  414. package/dist/native/p-f85c08f1.js.map +1 -0
  415. package/dist/native/p-fb897f7d.entry.js +2 -0
  416. package/dist/native/p-fb897f7d.entry.js.map +1 -0
  417. package/dist/native/{p-244f56ac.entry.js → p-fc3bea07.entry.js} +2 -2
  418. package/dist/types/components/nv-alert/nv-alert.d.ts +1 -1
  419. package/dist/types/components/nv-badge/nv-badge.d.ts +11 -3
  420. package/dist/types/components/nv-calendar/nv-calendar.d.ts +70 -112
  421. package/dist/types/components/nv-calendar/nv-calendar.utils.d.ts +60 -0
  422. package/dist/types/components/nv-calendar/test/nv-calendar.utils.test.d.ts +1 -0
  423. package/dist/types/components/nv-datagrid/nv-datagrid.d.ts +47 -26
  424. package/dist/types/components/nv-datagridcolumn/nv-datagridcolumn.d.ts +4 -0
  425. package/dist/types/components/nv-dialog/nv-dialog.d.ts +4 -0
  426. package/dist/types/components/nv-fielddate/nv-fielddate.d.ts +6 -7
  427. package/dist/types/components/nv-fielddaterange/nv-fielddaterange.d.ts +23 -12
  428. package/dist/types/components/nv-fielddropdown/nv-fielddropdown.d.ts +51 -26
  429. package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +65 -55
  430. package/dist/types/components/nv-fieldnumber/nv-fieldnumber.d.ts +4 -0
  431. package/dist/types/components/nv-fieldpassword/nv-fieldpassword.d.ts +4 -0
  432. package/dist/types/components/nv-fieldselect/nv-fieldselect.d.ts +4 -0
  433. package/dist/types/components/nv-fieldslider/nv-fieldslider.d.ts +230 -0
  434. package/dist/types/components/nv-fieldslider/nv-fieldslider.docs.d.ts +4 -0
  435. package/dist/types/components/nv-fieldslider/nv-fieldslider.utils.d.ts +46 -0
  436. package/dist/types/components/nv-fieldslider/partials/field-input.d.ts +45 -0
  437. package/dist/types/components/nv-fieldslider/partials/range-thumb.d.ts +37 -0
  438. package/dist/types/components/nv-fieldslider/partials/single-thumb.d.ts +35 -0
  439. package/dist/types/components/nv-fieldslider/partials/tick-marks.d.ts +28 -0
  440. package/dist/types/components/nv-fieldslider/test/nv-fieldslider.utils.test.d.ts +1 -0
  441. package/dist/types/components/nv-fieldtext/nv-fieldtext.d.ts +5 -0
  442. package/dist/types/components/nv-fieldtextarea/nv-fieldtextarea.d.ts +4 -0
  443. package/dist/types/components/nv-icon/nv-icons.d.ts +1 -1
  444. package/dist/types/components/nv-table/nv-table.d.ts +13 -2
  445. package/dist/types/components.d.ts +656 -154
  446. package/dist/types/index.d.ts +0 -2
  447. package/dist/types/interfaces/Column.d.ts +5 -1
  448. package/dist/types/utils/constants.d.ts +9 -0
  449. package/dist/vscode-data.json +292 -1546
  450. package/hydrate/index.js +2715 -1533
  451. package/hydrate/index.mjs +2715 -1533
  452. package/package.json +6 -2
  453. package/dist/cjs/constants-bcd6b2e2.js.map +0 -1
  454. package/dist/cjs/index-9bda5507.js.map +0 -1
  455. package/dist/collection/interfaces/actionEvent.js +0 -2
  456. package/dist/collection/interfaces/actionEvent.js.map +0 -1
  457. package/dist/collection/interfaces/calendarShortcut.js +0 -2
  458. package/dist/collection/interfaces/calendarShortcut.js.map +0 -1
  459. package/dist/collection/interfaces/dateRange.js +0 -2
  460. package/dist/collection/interfaces/dateRange.js.map +0 -1
  461. package/dist/components/p-1c45c0f2.js.map +0 -1
  462. package/dist/components/p-373926aa.js +0 -177
  463. package/dist/components/p-373926aa.js.map +0 -1
  464. package/dist/components/p-591730e7.js +0 -88
  465. package/dist/components/p-591730e7.js.map +0 -1
  466. package/dist/components/p-8348db09.js.map +0 -1
  467. package/dist/components/p-c14f6b8e.js.map +0 -1
  468. package/dist/components/p-f331117c.js +0 -1133
  469. package/dist/components/p-f331117c.js.map +0 -1
  470. package/dist/esm/constants-98e2dcc2.js.map +0 -1
  471. package/dist/esm/index-1fb7a9a6.js.map +0 -1
  472. package/dist/native/p-0ee428d5.entry.js +0 -2
  473. package/dist/native/p-0ee428d5.entry.js.map +0 -1
  474. package/dist/native/p-2691e02d.entry.js +0 -2
  475. package/dist/native/p-37f0210e.entry.js +0 -2
  476. package/dist/native/p-37f0210e.entry.js.map +0 -1
  477. package/dist/native/p-4a440970.entry.js +0 -2
  478. package/dist/native/p-4a440970.entry.js.map +0 -1
  479. package/dist/native/p-4ae26462.entry.js +0 -7
  480. package/dist/native/p-4ae26462.entry.js.map +0 -1
  481. package/dist/native/p-4d9c4618.entry.js +0 -2
  482. package/dist/native/p-4d9c4618.entry.js.map +0 -1
  483. package/dist/native/p-4dc1d036.entry.js +0 -2
  484. package/dist/native/p-59768ee5.js.map +0 -1
  485. package/dist/native/p-59e0bd2b.entry.js +0 -2
  486. package/dist/native/p-59e0bd2b.entry.js.map +0 -1
  487. package/dist/native/p-5c00f092.entry.js +0 -2
  488. package/dist/native/p-5c00f092.entry.js.map +0 -1
  489. package/dist/native/p-63e6aed3.entry.js.map +0 -1
  490. package/dist/native/p-7f5eb2ac.entry.js +0 -2
  491. package/dist/native/p-7f5eb2ac.entry.js.map +0 -1
  492. package/dist/native/p-84a73e2a.entry.js +0 -2
  493. package/dist/native/p-84a73e2a.entry.js.map +0 -1
  494. package/dist/native/p-9135fdf5.entry.js +0 -2
  495. package/dist/native/p-93dc2f47.entry.js +0 -2
  496. package/dist/native/p-93dc2f47.entry.js.map +0 -1
  497. package/dist/native/p-9a267f16.entry.js +0 -13
  498. package/dist/native/p-9a267f16.entry.js.map +0 -1
  499. package/dist/native/p-9d6431c7.entry.js +0 -2
  500. package/dist/native/p-9d6431c7.entry.js.map +0 -1
  501. package/dist/native/p-ab002252.js +0 -3
  502. package/dist/native/p-ab002252.js.map +0 -1
  503. package/dist/native/p-b2ce83ad.entry.js +0 -2
  504. package/dist/native/p-b2ce83ad.entry.js.map +0 -1
  505. package/dist/native/p-bad11367.entry.js.map +0 -1
  506. package/dist/native/p-e1a4f776.entry.js +0 -2
  507. package/dist/native/p-e1a4f776.entry.js.map +0 -1
  508. package/dist/native/p-e49bbd02.entry.js +0 -2
  509. package/dist/native/p-e49bbd02.entry.js.map +0 -1
  510. package/dist/native/p-eee01062.entry.js +0 -2
  511. package/dist/native/p-eee01062.entry.js.map +0 -1
  512. package/dist/native/p-f6bdc270.entry.js +0 -2
  513. package/dist/native/p-f6bdc270.entry.js.map +0 -1
  514. package/dist/types/interfaces/actionEvent.d.ts +0 -13
  515. package/dist/types/interfaces/calendarShortcut.d.ts +0 -17
  516. package/dist/types/interfaces/dateRange.d.ts +0 -13
  517. /package/dist/native/{p-6b348684.entry.js.map → p-0323daf6.entry.js.map} +0 -0
  518. /package/dist/native/{p-d5cbf5c8.entry.js.map → p-05d95d4d.entry.js.map} +0 -0
  519. /package/dist/native/{p-fb5bddba.entry.js.map → p-0ec1e2e3.entry.js.map} +0 -0
  520. /package/dist/native/{p-c7b201cd.entry.js.map → p-16a4cdf3.entry.js.map} +0 -0
  521. /package/dist/native/{p-0245863d.entry.js.map → p-407fc32d.entry.js.map} +0 -0
  522. /package/dist/native/{p-39bb95ff.entry.js.map → p-519b4819.entry.js.map} +0 -0
  523. /package/dist/native/{p-fa77a591.entry.js.map → p-5382eab2.entry.js.map} +0 -0
  524. /package/dist/native/{p-2691e02d.entry.js.map → p-7092a675.entry.js.map} +0 -0
  525. /package/dist/native/{p-d7a76400.entry.js.map → p-7c676f2c.entry.js.map} +0 -0
  526. /package/dist/native/{p-f85aca27.entry.js.map → p-9fba8663.entry.js.map} +0 -0
  527. /package/dist/native/{p-b094296d.entry.js.map → p-a2c0f1a7.entry.js.map} +0 -0
  528. /package/dist/native/{p-6ff228da.entry.js.map → p-c930adb7.entry.js.map} +0 -0
  529. /package/dist/native/{p-701b5557.entry.js.map → p-cfe0a6c6.entry.js.map} +0 -0
  530. /package/dist/native/{p-4dc1d036.entry.js.map → p-d07ab618.entry.js.map} +0 -0
  531. /package/dist/native/{p-e5de64d5.entry.js.map → p-f0ddf60b.entry.js.map} +0 -0
  532. /package/dist/native/{p-244f56ac.entry.js.map → p-fc3bea07.entry.js.map} +0 -0
@@ -0,0 +1,667 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import { getWeekNumber, parseDate, isSameDate, isSameOrAfter, isSameOrBefore, formatDate, } from "../nv-calendar.utils";
3
+ describe('nv-calendar -> utils', () => {
4
+ describe('getWeekNumber', () => {
5
+ it('should return the correct week number for the first day of the year', () => {
6
+ const date = new Date(2023, 0, 1); // January 1, 2023
7
+ expect(getWeekNumber(date)).toBe(1);
8
+ });
9
+ it('should return the correct week number for a day in the middle of the year', () => {
10
+ const date = new Date(2023, 6, 15); // July 15, 2023
11
+ expect(getWeekNumber(date)).toBe(28);
12
+ });
13
+ it('should return the correct week number for the last day of the year', () => {
14
+ const date = new Date(2023, 11, 31); // December 31, 2023
15
+ expect(getWeekNumber(date)).toBe(53);
16
+ });
17
+ it('should handle leap years correctly', () => {
18
+ const date = new Date(2024, 1, 29); // February 29, 2024 (leap year)
19
+ expect(getWeekNumber(date)).toBe(9);
20
+ });
21
+ it('should handle years where January 1 is not a Sunday', () => {
22
+ // January 1, 2022 was a Saturday, which affects week calculations
23
+ const date = new Date(2022, 0, 1); // January 1, 2022
24
+ expect(getWeekNumber(date)).toBe(1);
25
+ const secondWeek = new Date(2022, 0, 9); // January 9, 2022
26
+ expect(getWeekNumber(secondWeek)).toBe(3);
27
+ });
28
+ it('should handle edge cases between years', () => {
29
+ // Last few days of December and first few days of January
30
+ const dec31 = new Date(2022, 11, 31); // December 31, 2022
31
+ const jan1 = new Date(2023, 0, 1); // January 1, 2023
32
+ expect(getWeekNumber(dec31)).toBe(53);
33
+ expect(getWeekNumber(jan1)).toBe(1);
34
+ });
35
+ it('should return consistent results for the same date in different time zones', () => {
36
+ const date = new Date(2023, 5, 15);
37
+ const originalHours = date.getHours();
38
+ // Simulate different times on the same day
39
+ date.setHours(0);
40
+ const earlyResult = getWeekNumber(date);
41
+ date.setHours(23);
42
+ const lateResult = getWeekNumber(date);
43
+ expect(earlyResult).toBe(lateResult);
44
+ // Reset to avoid affecting other tests
45
+ date.setHours(originalHours);
46
+ });
47
+ it('should handle historic dates correctly', () => {
48
+ const historicDate = new Date(2000, 0, 1); // January 1, 2000
49
+ expect(getWeekNumber(historicDate)).toBe(1);
50
+ });
51
+ });
52
+ describe('parseDate', () => {
53
+ // Date object handling
54
+ it('should return the original Date when a Date object is passed', () => {
55
+ const date = new Date(2023, 5, 15); // June 15, 2023
56
+ const result = parseDate(date, 'YYYY-MM-DD');
57
+ expect(result).toBe(date); // Check it's the same object reference
58
+ expect(result === null || result === void 0 ? void 0 : result.getTime()).toBe(date.getTime()); // Double-check timestamp equality
59
+ });
60
+ // ISO 8601 format detection
61
+ it('should automatically detect and parse ISO 8601 format', () => {
62
+ const isoString = '2023-06-15T12:30:45.123Z';
63
+ const result = parseDate(isoString, 'any-format');
64
+ expect(result).toBeInstanceOf(Date);
65
+ expect(result === null || result === void 0 ? void 0 : result.toISOString()).toBe(isoString);
66
+ });
67
+ it('should handle ISO 8601 parsing errors gracefully', () => {
68
+ // Mock console.error to prevent actual errors in test output
69
+ const consoleSpy = vi
70
+ .spyOn(console, 'error')
71
+ .mockImplementation(() => { });
72
+ // Invalid ISO string that looks close but is malformed
73
+ const invalidIsoString = '2023-06-15T25:30:45.123Z'; // 25 hours is invalid
74
+ const result = parseDate(invalidIsoString, 'YYYY-MM-DD');
75
+ expect(result).toBeNull();
76
+ expect(consoleSpy).toHaveBeenCalled();
77
+ consoleSpy.mockRestore();
78
+ });
79
+ // Unix timestamp formats
80
+ it('should parse Unix seconds (X format)', () => {
81
+ const unixSeconds = '1623760245'; // June 15, 2021, 12:30:45 UTC
82
+ const result = parseDate(unixSeconds, 'X');
83
+ expect(result).toBeInstanceOf(Date);
84
+ expect(result === null || result === void 0 ? void 0 : result.getTime()).toBe(1623760245000);
85
+ });
86
+ it('should parse Unix milliseconds (x format)', () => {
87
+ const unixMilliseconds = '1623760245123'; // June 15, 2021, 12:30:45.123 UTC
88
+ const result = parseDate(unixMilliseconds, 'x');
89
+ expect(result).toBeInstanceOf(Date);
90
+ expect(result === null || result === void 0 ? void 0 : result.getTime()).toBe(1623760245123);
91
+ });
92
+ it('should handle invalid Unix timestamps', () => {
93
+ const consoleSpy = vi
94
+ .spyOn(console, 'error')
95
+ .mockImplementation(() => { });
96
+ // Non-numeric Unix timestamp
97
+ const invalidUnixSeconds = 'abc';
98
+ const result = parseDate(invalidUnixSeconds, 'X');
99
+ expect(result).toBeNull();
100
+ consoleSpy.mockRestore();
101
+ });
102
+ // C# Ticks format
103
+ it('should parse C# Ticks format', () => {
104
+ // Test the actual implementation with a known Ticks value
105
+ // .NET Ticks value (621355968000000000 is the offset for Unix epoch)
106
+ const csharpTicks = '637593021450000000';
107
+ const result = parseDate(csharpTicks, 'Ticks');
108
+ expect(result).toBeInstanceOf(Date);
109
+ // Instead of comparing to a specific date, let's verify the result is reasonable
110
+ // by checking basic properties
111
+ if (result) {
112
+ expect(result.getFullYear()).toBeGreaterThan(2000); // Should be a date after 2000
113
+ expect(result.getFullYear()).toBeLessThan(2030); // Should be a date before 2030
114
+ }
115
+ });
116
+ it('should handle invalid Ticks format', () => {
117
+ const consoleSpy = vi
118
+ .spyOn(console, 'error')
119
+ .mockImplementation(() => { });
120
+ const invalidTicks = 'abc';
121
+ const result = parseDate(invalidTicks, 'Ticks');
122
+ expect(result).toBeNull();
123
+ consoleSpy.mockRestore();
124
+ });
125
+ // Common date formats
126
+ it('should parse YYYY-MM-DD format', () => {
127
+ const dateStr = '2023-06-15';
128
+ const result = parseDate(dateStr, 'YYYY-MM-DD');
129
+ expect(result).toBeInstanceOf(Date);
130
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
131
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(5); // 0-based, so June is 5
132
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(15);
133
+ });
134
+ it('should parse DD-MM-YYYY format', () => {
135
+ const dateStr = '15-06-2023';
136
+ const result = parseDate(dateStr, 'DD-MM-YYYY');
137
+ expect(result).toBeInstanceOf(Date);
138
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
139
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(5);
140
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(15);
141
+ });
142
+ it('should parse MM/DD/YYYY format', () => {
143
+ const dateStr = '06/15/2023';
144
+ const result = parseDate(dateStr, 'MM/DD/YYYY');
145
+ expect(result).toBeInstanceOf(Date);
146
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
147
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(5);
148
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(15);
149
+ });
150
+ // Date with time formats
151
+ it('should parse YYYY-MM-DD HH:mm:ss format', () => {
152
+ const dateStr = '2023-06-15 14:30:45';
153
+ const result = parseDate(dateStr, 'YYYY-MM-DD HH:mm:ss');
154
+ expect(result).toBeInstanceOf(Date);
155
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
156
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(5);
157
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(15);
158
+ expect(result === null || result === void 0 ? void 0 : result.getHours()).toBe(14);
159
+ expect(result === null || result === void 0 ? void 0 : result.getMinutes()).toBe(30);
160
+ expect(result === null || result === void 0 ? void 0 : result.getSeconds()).toBe(45);
161
+ });
162
+ // UTC handling
163
+ it('should handle UTC mode correctly', () => {
164
+ // Looking at the implementation, the 'Z' in the format tells parseDate
165
+ // to use UTC mode, but doesn't require the dateStr to have a Z
166
+ const isoString = '2023-06-15T14:30:45.000Z';
167
+ const result = parseDate(isoString, 'YYYY-MM-DDTHH:mm:ss.SSSZ');
168
+ expect(result.getFullYear()).toBe(2023);
169
+ expect(result.getMonth()).toBe(5); // June
170
+ expect(result.getDate()).toBe(15);
171
+ });
172
+ // Invalid date handling
173
+ it('should return null for invalid dates', () => {
174
+ const consoleSpy = vi
175
+ .spyOn(console, 'error')
176
+ .mockImplementation(() => { });
177
+ // Invalid day (June 31 doesn't exist)
178
+ const invalidDate = '2023-06-31';
179
+ const result = parseDate(invalidDate, 'YYYY-MM-DD');
180
+ expect(result).toBeNull();
181
+ expect(consoleSpy).toHaveBeenCalled();
182
+ consoleSpy.mockRestore();
183
+ });
184
+ it("should return null when format doesn't match input", () => {
185
+ const consoleSpy = vi
186
+ .spyOn(console, 'error')
187
+ .mockImplementation(() => { });
188
+ // Format expects MM/DD/YYYY but input is YYYY-MM-DD
189
+ const mismatchFormat = '2023-06-15';
190
+ const result = parseDate(mismatchFormat, 'MM/DD/YYYY');
191
+ expect(result).toBeNull();
192
+ expect(consoleSpy).toHaveBeenCalled();
193
+ consoleSpy.mockRestore();
194
+ });
195
+ // Edge cases
196
+ it('should handle leap years correctly', () => {
197
+ // February 29 in a leap year
198
+ const leapYearDate = '2024-02-29';
199
+ const result = parseDate(leapYearDate, 'YYYY-MM-DD');
200
+ expect(result).toBeInstanceOf(Date);
201
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2024);
202
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(1); // February
203
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(29);
204
+ });
205
+ it('should handle daylight saving time transitions', () => {
206
+ // A date during DST transition (will depend on locale)
207
+ // This test might behave differently in different timezones
208
+ const dstDate = '2023-03-12 02:30:00'; // Around when DST starts in the US
209
+ const result = parseDate(dstDate, 'YYYY-MM-DD HH:mm:ss');
210
+ expect(result).toBeInstanceOf(Date);
211
+ // We're not checking specific times because behavior varies by timezone
212
+ // Just ensuring it parses to a valid date
213
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
214
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(2); // March
215
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(12);
216
+ });
217
+ // Test complex formats
218
+ it('should parse formats with month names and AM/PM markers', () => {
219
+ // Dayjs supports these format tokens, but not the ordinal 'Do'
220
+ // or day names like 'dddd' in strict mode
221
+ const dateStr = 'June 15 2023, 2:30:45 PM';
222
+ const format = 'MMMM D YYYY, h:mm:ss A';
223
+ const result = parseDate(dateStr, format);
224
+ expect(result).toBeInstanceOf(Date);
225
+ expect(result === null || result === void 0 ? void 0 : result.getFullYear()).toBe(2023);
226
+ expect(result === null || result === void 0 ? void 0 : result.getMonth()).toBe(5); // June
227
+ expect(result === null || result === void 0 ? void 0 : result.getDate()).toBe(15);
228
+ expect(result === null || result === void 0 ? void 0 : result.getHours()).toBe(14); // 2 PM = 14:00
229
+ expect(result === null || result === void 0 ? void 0 : result.getMinutes()).toBe(30);
230
+ expect(result === null || result === void 0 ? void 0 : result.getSeconds()).toBe(45);
231
+ });
232
+ });
233
+ describe('isSameDate', () => {
234
+ // Test with local dates
235
+ it('should return true for identical local dates', () => {
236
+ const date1 = new Date(2023, 5, 15, 10, 30, 0); // June 15, 2023, 10:30:00
237
+ const date2 = new Date(2023, 5, 15, 14, 45, 0); // June 15, 2023, 14:45:00 (different time)
238
+ const result = isSameDate(date1, date2, { isUTCMode: false });
239
+ expect(result).toBe(true);
240
+ });
241
+ it('should return false for different local dates', () => {
242
+ const date1 = new Date(2023, 5, 15); // June 15, 2023
243
+ const date2 = new Date(2023, 5, 16); // June 16, 2023
244
+ const result = isSameDate(date1, date2, { isUTCMode: false });
245
+ expect(result).toBe(false);
246
+ });
247
+ // Test with UTC dates
248
+ it('should return true for identical UTC dates', () => {
249
+ // Create dates with the same UTC date but different times
250
+ const date1 = new Date(Date.UTC(2023, 5, 15, 10, 30, 0)); // June 15, 2023, 10:30:00 UTC
251
+ const date2 = new Date(Date.UTC(2023, 5, 15, 14, 45, 0)); // June 15, 2023, 14:45:00 UTC
252
+ const result = isSameDate(date1, date2, { isUTCMode: true });
253
+ expect(result).toBe(true);
254
+ });
255
+ it('should return false for different UTC dates', () => {
256
+ const date1 = new Date(Date.UTC(2023, 5, 15)); // June 15, 2023 UTC
257
+ const date2 = new Date(Date.UTC(2023, 5, 16)); // June 16, 2023 UTC
258
+ const result = isSameDate(date1, date2, { isUTCMode: true });
259
+ expect(result).toBe(false);
260
+ });
261
+ // Test with dates that would be the same in one mode but different in another
262
+ it('should handle date differences across timezone boundaries when using local mode', () => {
263
+ // Create a date near midnight in UTC
264
+ const date1 = new Date(Date.UTC(2023, 5, 15, 23, 0, 0)); // June 15, 2023, 23:00 UTC
265
+ // This could be June 16 in local time depending on timezone
266
+ const date2 = new Date(date1);
267
+ date2.setUTCHours(date1.getUTCHours() + 2); // June 16, 2023, 01:00 UTC
268
+ // In local mode, these might be the same date depending on timezone
269
+ // We're just checking that the function respects the isUTCMode flag
270
+ const localResult = isSameDate(date1, date2, { isUTCMode: false });
271
+ const utcResult = isSameDate(date1, date2, { isUTCMode: true });
272
+ // The dates should be different in UTC mode (since we crossed UTC midnight)
273
+ expect(utcResult).toBe(false);
274
+ // The local result will depend on timezone, but we're just verifying
275
+ // that the function uses the correct getters based on isUTCMode
276
+ if (date1.getDate() === date2.getDate()) {
277
+ expect(localResult).toBe(true);
278
+ }
279
+ else {
280
+ expect(localResult).toBe(false);
281
+ }
282
+ });
283
+ // Test null handling
284
+ it('should return false if either date is null', () => {
285
+ const date = new Date(2023, 5, 15);
286
+ expect(isSameDate(null, date, { isUTCMode: false })).toBe(false);
287
+ expect(isSameDate(date, null, { isUTCMode: false })).toBe(false);
288
+ expect(isSameDate(null, null, { isUTCMode: false })).toBe(false);
289
+ });
290
+ // Test that the function only compares the date part
291
+ it('should ignore time differences in local mode', () => {
292
+ const morning = new Date(2023, 5, 15, 8, 0, 0); // 8:00 AM
293
+ const evening = new Date(2023, 5, 15, 20, 0, 0); // 8:00 PM
294
+ const result = isSameDate(morning, evening, { isUTCMode: false });
295
+ expect(result).toBe(true);
296
+ });
297
+ it('should ignore time differences in UTC mode', () => {
298
+ const morning = new Date(Date.UTC(2023, 5, 15, 8, 0, 0)); // 8:00 AM UTC
299
+ const evening = new Date(Date.UTC(2023, 5, 15, 20, 0, 0)); // 8:00 PM UTC
300
+ const result = isSameDate(morning, evening, { isUTCMode: true });
301
+ expect(result).toBe(true);
302
+ });
303
+ // Test edge cases
304
+ it('should correctly handle month/year boundaries', () => {
305
+ const lastDayOfMonth = new Date(2023, 5, 30); // June 30, 2023
306
+ const firstDayOfNextMonth = new Date(2023, 6, 1); // July 1, 2023
307
+ expect(isSameDate(lastDayOfMonth, firstDayOfNextMonth, { isUTCMode: false })).toBe(false);
308
+ const lastDayOfYear = new Date(2023, 11, 31); // December 31, 2023
309
+ const firstDayOfNextYear = new Date(2024, 0, 1); // January 1, 2024
310
+ expect(isSameDate(lastDayOfYear, firstDayOfNextYear, { isUTCMode: false })).toBe(false);
311
+ });
312
+ it('should handle leap year dates', () => {
313
+ const leapYearDay = new Date(2024, 1, 29); // February 29, 2024 (leap year)
314
+ const nonLeapYearDay = new Date(2023, 1, 28); // February 28, 2023 (non-leap year)
315
+ expect(isSameDate(leapYearDay, nonLeapYearDay, { isUTCMode: false })).toBe(false);
316
+ });
317
+ });
318
+ describe('isSameOrAfter', () => {
319
+ // Test cases for local mode (isUTCMode: false)
320
+ it('should return true when the date is the same in local mode', () => {
321
+ const date1 = new Date(2023, 5, 15, 10, 30); // June 15, 2023, 10:30
322
+ const date2 = new Date(2023, 5, 15, 14, 45); // June 15, 2023, 14:45 (same date, different time)
323
+ const result = isSameOrAfter(date1, date2, { isUTCMode: false });
324
+ // Should return true because the dates are the same (ignoring time)
325
+ expect(result).toBe(true);
326
+ });
327
+ it('should return true when the date is after in local mode', () => {
328
+ const later = new Date(2023, 5, 16); // June 16, 2023
329
+ const earlier = new Date(2023, 5, 15); // June 15, 2023
330
+ const result = isSameOrAfter(later, earlier, { isUTCMode: false });
331
+ expect(result).toBe(true);
332
+ });
333
+ it('should return false when the date is before in local mode', () => {
334
+ const earlier = new Date(2023, 5, 15); // June 15, 2023
335
+ const later = new Date(2023, 5, 16); // June 16, 2023
336
+ const result = isSameOrAfter(earlier, later, { isUTCMode: false });
337
+ expect(result).toBe(false);
338
+ });
339
+ // Test cases for UTC mode (isUTCMode: true)
340
+ it('should return true when the date is the same in UTC mode', () => {
341
+ const date1 = new Date(Date.UTC(2023, 5, 15, 10, 30)); // June 15, 2023, 10:30 UTC
342
+ const date2 = new Date(Date.UTC(2023, 5, 15, 14, 45)); // June 15, 2023, 14:45 UTC (same date, different time)
343
+ const result = isSameOrAfter(date1, date2, { isUTCMode: true });
344
+ // Should return true because the dates are the same (ignoring time)
345
+ expect(result).toBe(true);
346
+ });
347
+ it('should return true when the date is after in UTC mode', () => {
348
+ const later = new Date(Date.UTC(2023, 5, 16)); // June 16, 2023 UTC
349
+ const earlier = new Date(Date.UTC(2023, 5, 15)); // June 15, 2023 UTC
350
+ const result = isSameOrAfter(later, earlier, { isUTCMode: true });
351
+ expect(result).toBe(true);
352
+ });
353
+ it('should return false when the date is before in UTC mode', () => {
354
+ const earlier = new Date(Date.UTC(2023, 5, 15)); // June 15, 2023 UTC
355
+ const later = new Date(Date.UTC(2023, 5, 16)); // June 16, 2023 UTC
356
+ const result = isSameOrAfter(earlier, later, { isUTCMode: true });
357
+ expect(result).toBe(false);
358
+ });
359
+ // Test cases for different years and months
360
+ it('should return true when the year is after in local mode', () => {
361
+ const laterYear = new Date(2024, 0, 1); // January 1, 2024
362
+ const earlierYear = new Date(2023, 11, 31); // December 31, 2023
363
+ const result = isSameOrAfter(laterYear, earlierYear, {
364
+ isUTCMode: false,
365
+ });
366
+ expect(result).toBe(true);
367
+ });
368
+ it('should return true when the month is after in the same year in local mode', () => {
369
+ const laterMonth = new Date(2023, 6, 1); // July 1, 2023
370
+ const earlierMonth = new Date(2023, 5, 30); // June 30, 2023
371
+ const result = isSameOrAfter(laterMonth, earlierMonth, {
372
+ isUTCMode: false,
373
+ });
374
+ expect(result).toBe(true);
375
+ });
376
+ it('should return false when the year is before in UTC mode', () => {
377
+ const earlierYear = new Date(Date.UTC(2022, 11, 31)); // December 31, 2022 UTC
378
+ const laterYear = new Date(Date.UTC(2023, 0, 1)); // January 1, 2023 UTC
379
+ const result = isSameOrAfter(earlierYear, laterYear, { isUTCMode: true });
380
+ expect(result).toBe(false);
381
+ });
382
+ it('should return false when the month is before in the same year in UTC mode', () => {
383
+ const earlierMonth = new Date(Date.UTC(2023, 4, 31)); // May 31, 2023 UTC
384
+ const laterMonth = new Date(Date.UTC(2023, 5, 1)); // June 1, 2023 UTC
385
+ const result = isSameOrAfter(earlierMonth, laterMonth, {
386
+ isUTCMode: true,
387
+ });
388
+ expect(result).toBe(false);
389
+ });
390
+ // Edge cases
391
+ it('should handle same date with different times correctly in local mode', () => {
392
+ const morningDate = new Date(2023, 5, 15, 8, 0); // June 15, 2023, 8:00 AM
393
+ const eveningDate = new Date(2023, 5, 15, 20, 0); // June 15, 2023, 8:00 PM
394
+ // Since we're only comparing dates (not times), both should be "same or after" each other
395
+ expect(isSameOrAfter(morningDate, eveningDate, { isUTCMode: false })).toBe(true);
396
+ expect(isSameOrAfter(eveningDate, morningDate, { isUTCMode: false })).toBe(true);
397
+ });
398
+ it('should handle same date with different times correctly in UTC mode', () => {
399
+ const morningDate = new Date(Date.UTC(2023, 5, 15, 8, 0)); // June 15, 2023, 8:00 AM UTC
400
+ const eveningDate = new Date(Date.UTC(2023, 5, 15, 20, 0)); // June 15, 2023, 8:00 PM UTC
401
+ // Since we're only comparing dates (not times), both should be "same or after" each other
402
+ expect(isSameOrAfter(morningDate, eveningDate, { isUTCMode: true })).toBe(true);
403
+ expect(isSameOrAfter(eveningDate, morningDate, { isUTCMode: true })).toBe(true);
404
+ });
405
+ it('should handle leap year dates correctly', () => {
406
+ const leapYearDate = new Date(2024, 1, 29); // February 29, 2024 (leap year)
407
+ const nonLeapYearDate = new Date(2023, 1, 28); // February 28, 2023 (non-leap year)
408
+ // A date in a later year should be "after" regardless of the month/day
409
+ expect(isSameOrAfter(leapYearDate, nonLeapYearDate, { isUTCMode: false })).toBe(true);
410
+ expect(isSameOrAfter(nonLeapYearDate, leapYearDate, { isUTCMode: false })).toBe(false);
411
+ });
412
+ it('should handle edge cases between months correctly', () => {
413
+ const lastDayOfMonth = new Date(2023, 5, 30); // June 30, 2023
414
+ const firstDayOfNextMonth = new Date(2023, 6, 1); // July 1, 2023
415
+ expect(isSameOrAfter(lastDayOfMonth, firstDayOfNextMonth, {
416
+ isUTCMode: false,
417
+ })).toBe(false);
418
+ expect(isSameOrAfter(firstDayOfNextMonth, lastDayOfMonth, {
419
+ isUTCMode: false,
420
+ })).toBe(true);
421
+ });
422
+ it('should handle null dates gracefully', () => {
423
+ const date = new Date(2023, 5, 15);
424
+ const nullDate = null;
425
+ // Check if the function handles null inputs gracefully
426
+ // Note: Your implementation might need to be updated to handle this case
427
+ expect(() => isSameOrAfter(date, nullDate, { isUTCMode: false })).not.toThrow();
428
+ expect(() => isSameOrAfter(nullDate, date, { isUTCMode: false })).not.toThrow();
429
+ });
430
+ });
431
+ describe('isSameOrBefore', () => {
432
+ // Test cases for local mode (isUTCMode: false)
433
+ it('should return true when the date is the same in local mode', () => {
434
+ const date1 = new Date(2023, 5, 15, 10, 30); // June 15, 2023, 10:30
435
+ const date2 = new Date(2023, 5, 15, 14, 45); // June 15, 2023, 14:45 (same date, different time)
436
+ const result = isSameOrBefore(date1, date2, { isUTCMode: false });
437
+ // Should return true because the dates are the same (ignoring time)
438
+ expect(result).toBe(true);
439
+ });
440
+ it('should return true when the date is before in local mode', () => {
441
+ const earlier = new Date(2023, 5, 15); // June 15, 2023
442
+ const later = new Date(2023, 5, 16); // June 16, 2023
443
+ const result = isSameOrBefore(earlier, later, { isUTCMode: false });
444
+ expect(result).toBe(true);
445
+ });
446
+ it('should return false when the date is after in local mode', () => {
447
+ const later = new Date(2023, 5, 16); // June 16, 2023
448
+ const earlier = new Date(2023, 5, 15); // June 15, 2023
449
+ const result = isSameOrBefore(later, earlier, { isUTCMode: false });
450
+ expect(result).toBe(false);
451
+ });
452
+ // Test cases for UTC mode (isUTCMode: true)
453
+ it('should return true when the date is the same in UTC mode', () => {
454
+ const date1 = new Date(Date.UTC(2023, 5, 15, 10, 30)); // June 15, 2023, 10:30 UTC
455
+ const date2 = new Date(Date.UTC(2023, 5, 15, 14, 45)); // June 15, 2023, 14:45 UTC (same date, different time)
456
+ const result = isSameOrBefore(date1, date2, { isUTCMode: true });
457
+ // Should return true because the dates are the same (ignoring time)
458
+ expect(result).toBe(true);
459
+ });
460
+ it('should return true when the date is before in UTC mode', () => {
461
+ const earlier = new Date(Date.UTC(2023, 5, 15)); // June 15, 2023 UTC
462
+ const later = new Date(Date.UTC(2023, 5, 16)); // June 16, 2023 UTC
463
+ const result = isSameOrBefore(earlier, later, { isUTCMode: true });
464
+ expect(result).toBe(true);
465
+ });
466
+ it('should return false when the date is after in UTC mode', () => {
467
+ const later = new Date(Date.UTC(2023, 5, 16)); // June 16, 2023 UTC
468
+ const earlier = new Date(Date.UTC(2023, 5, 15)); // June 15, 2023 UTC
469
+ const result = isSameOrBefore(later, earlier, { isUTCMode: true });
470
+ expect(result).toBe(false);
471
+ });
472
+ // Test cases for different years and months
473
+ it('should return true when the year is before in local mode', () => {
474
+ const earlierYear = new Date(2022, 11, 31); // December 31, 2022
475
+ const laterYear = new Date(2023, 0, 1); // January 1, 2023
476
+ const result = isSameOrBefore(earlierYear, laterYear, {
477
+ isUTCMode: false,
478
+ });
479
+ expect(result).toBe(true);
480
+ });
481
+ it('should return true when the month is before in the same year in local mode', () => {
482
+ const earlierMonth = new Date(2023, 4, 31); // May 31, 2023
483
+ const laterMonth = new Date(2023, 5, 1); // June 1, 2023
484
+ const result = isSameOrBefore(earlierMonth, laterMonth, {
485
+ isUTCMode: false,
486
+ });
487
+ expect(result).toBe(true);
488
+ });
489
+ it('should return false when the year is after in UTC mode', () => {
490
+ const laterYear = new Date(Date.UTC(2023, 0, 1)); // January 1, 2023 UTC
491
+ const earlierYear = new Date(Date.UTC(2022, 11, 31)); // December 31, 2022 UTC
492
+ const result = isSameOrBefore(laterYear, earlierYear, {
493
+ isUTCMode: true,
494
+ });
495
+ expect(result).toBe(false);
496
+ });
497
+ it('should return false when the month is after in the same year in UTC mode', () => {
498
+ const laterMonth = new Date(Date.UTC(2023, 5, 1)); // June 1, 2023 UTC
499
+ const earlierMonth = new Date(Date.UTC(2023, 4, 31)); // May 31, 2023 UTC
500
+ const result = isSameOrBefore(laterMonth, earlierMonth, {
501
+ isUTCMode: true,
502
+ });
503
+ expect(result).toBe(false);
504
+ });
505
+ // Edge cases
506
+ it('should handle same date with different times correctly in local mode', () => {
507
+ const morningDate = new Date(2023, 5, 15, 8, 0); // June 15, 2023, 8:00 AM
508
+ const eveningDate = new Date(2023, 5, 15, 20, 0); // June 15, 2023, 8:00 PM
509
+ // Since we're only comparing dates (not times), both should be "same or before" each other
510
+ expect(isSameOrBefore(morningDate, eveningDate, { isUTCMode: false })).toBe(true);
511
+ expect(isSameOrBefore(eveningDate, morningDate, { isUTCMode: false })).toBe(true);
512
+ });
513
+ it('should handle same date with different times correctly in UTC mode', () => {
514
+ const morningDate = new Date(Date.UTC(2023, 5, 15, 8, 0)); // June 15, 2023, 8:00 AM UTC
515
+ const eveningDate = new Date(Date.UTC(2023, 5, 15, 20, 0)); // June 15, 2023, 8:00 PM UTC
516
+ // Since we're only comparing dates (not times), both should be "same or before" each other
517
+ expect(isSameOrBefore(morningDate, eveningDate, { isUTCMode: true })).toBe(true);
518
+ expect(isSameOrBefore(eveningDate, morningDate, { isUTCMode: true })).toBe(true);
519
+ });
520
+ it('should handle leap year dates correctly', () => {
521
+ const leapYearDate = new Date(2024, 1, 29); // February 29, 2024 (leap year)
522
+ const nonLeapYearDate = new Date(2023, 1, 28); // February 28, 2023 (non-leap year)
523
+ // A date in an earlier year should be "before" regardless of the month/day
524
+ expect(isSameOrBefore(nonLeapYearDate, leapYearDate, { isUTCMode: false })).toBe(true);
525
+ expect(isSameOrBefore(leapYearDate, nonLeapYearDate, { isUTCMode: false })).toBe(false);
526
+ });
527
+ it('should handle edge cases between months correctly', () => {
528
+ const lastDayOfMonth = new Date(2023, 5, 30); // June 30, 2023
529
+ const firstDayOfNextMonth = new Date(2023, 6, 1); // July 1, 2023
530
+ expect(isSameOrBefore(lastDayOfMonth, firstDayOfNextMonth, {
531
+ isUTCMode: false,
532
+ })).toBe(true);
533
+ expect(isSameOrBefore(firstDayOfNextMonth, lastDayOfMonth, {
534
+ isUTCMode: false,
535
+ })).toBe(false);
536
+ });
537
+ it('should handle null dates gracefully', () => {
538
+ const date = new Date(2023, 5, 15);
539
+ const nullDate = null;
540
+ // The function already has null checks, so these should return false
541
+ expect(isSameOrBefore(date, nullDate, { isUTCMode: false })).toBe(false);
542
+ expect(isSameOrBefore(nullDate, date, { isUTCMode: false })).toBe(false);
543
+ expect(isSameOrBefore(nullDate, nullDate, { isUTCMode: false })).toBe(false);
544
+ });
545
+ });
546
+ describe('formatDate', () => {
547
+ // Basic test for null input
548
+ it('should return empty string for null date', () => {
549
+ expect(formatDate(null, { dateFormat: 'YYYY-MM-DD' })).toBe('');
550
+ });
551
+ // ISO 8601 format
552
+ it('should format using toISOString() for ISO 8601 format', () => {
553
+ const date = new Date(2023, 5, 15, 12, 30, 45, 123); // June 15, 2023, 12:30:45.123
554
+ const result = formatDate(date, {
555
+ dateFormat: 'YYYY-MM-DD[T]HH:mm:ss[Z]',
556
+ });
557
+ expect(result).toBe(date.toISOString());
558
+ });
559
+ // Ticks format
560
+ it('should convert to C# ticks for "Ticks" format', () => {
561
+ const date = new Date(2023, 5, 15); // June 15, 2023
562
+ const milliseconds = date.getTime();
563
+ const expectedTicks = milliseconds * 10000 + 621355968000000000;
564
+ const result = formatDate(date, { dateFormat: 'Ticks' });
565
+ expect(result).toBe(expectedTicks.toString());
566
+ });
567
+ // Unix seconds format
568
+ it('should convert to Unix seconds for "X" format', () => {
569
+ const date = new Date(2023, 5, 15); // June 15, 2023
570
+ const unixSeconds = Math.floor(date.getTime() / 1000);
571
+ const result = formatDate(date, { dateFormat: 'X' });
572
+ expect(result).toBe(unixSeconds.toString());
573
+ });
574
+ // Unix milliseconds format
575
+ it('should convert to Unix milliseconds for "x" format', () => {
576
+ const date = new Date(2023, 5, 15); // June 15, 2023
577
+ const milliseconds = date.getTime();
578
+ const result = formatDate(date, { dateFormat: 'x' });
579
+ expect(result).toBe(milliseconds.toString());
580
+ });
581
+ // Standard date formats in local mode
582
+ it('should format date according to "YYYY-MM-DD" format in local mode', () => {
583
+ const date = new Date(2023, 5, 15); // June 15, 2023
584
+ const expected = '2023-06-15';
585
+ const result = formatDate(date, { dateFormat: 'YYYY-MM-DD' });
586
+ expect(result).toBe(expected);
587
+ });
588
+ it('should format date according to "DD/MM/YYYY" format in local mode', () => {
589
+ const date = new Date(2023, 5, 15); // June 15, 2023
590
+ const expected = '15/06/2023';
591
+ const result = formatDate(date, { dateFormat: 'DD/MM/YYYY' });
592
+ expect(result).toBe(expected);
593
+ });
594
+ it('should format date according to "MM-DD-YYYY" format in local mode', () => {
595
+ const date = new Date(2023, 5, 15); // June 15, 2023
596
+ const expected = '06-15-2023';
597
+ const result = formatDate(date, { dateFormat: 'MM-DD-YYYY' });
598
+ expect(result).toBe(expected);
599
+ });
600
+ // Date formats with time in local mode
601
+ it('should format date and time in local mode', () => {
602
+ const date = new Date(2023, 5, 15, 14, 30, 45); // June 15, 2023, 14:30:45
603
+ const expected = '2023-06-15 14:30:45';
604
+ const result = formatDate(date, { dateFormat: 'YYYY-MM-DD HH:mm:ss' });
605
+ expect(result).toBe(expected);
606
+ });
607
+ // Standard date formats in UTC mode
608
+ it('should format date according to format in UTC mode', () => {
609
+ const date = new Date(Date.UTC(2023, 5, 15, 14, 30, 45)); // June 15, 2023, 14:30:45 UTC
610
+ // When 'Z' is in the format, dayjs adds the timezone offset (+00:00)
611
+ const expected = '2023-06-15+00:00';
612
+ const result = formatDate(date, { dateFormat: 'YYYY-MM-DDZ' });
613
+ expect(result).toBe(expected);
614
+ });
615
+ // Date formats with time in UTC mode
616
+ it('should format date and time in UTC mode', () => {
617
+ // Create a specific date with known UTC time
618
+ const date = new Date(Date.UTC(2023, 5, 15, 14, 30, 45)); // June 15, 2023, 14:30:45 UTC
619
+ // When 'Z' is in the format, dayjs adds the timezone offset (+00:00)
620
+ const expected = '2023-06-15 14:30:45+00:00';
621
+ const result = formatDate(date, { dateFormat: 'YYYY-MM-DD HH:mm:ssZ' });
622
+ expect(result).toBe(expected);
623
+ });
624
+ // Test with 12-hour format
625
+ it('should format date with AM/PM markers', () => {
626
+ const morningDate = new Date(2023, 5, 15, 9, 30); // June 15, 2023, 9:30 AM
627
+ const eveningDate = new Date(2023, 5, 15, 21, 30); // June 15, 2023, 9:30 PM
628
+ const morningResult = formatDate(morningDate, { dateFormat: 'hh:mm A' });
629
+ const eveningResult = formatDate(eveningDate, { dateFormat: 'hh:mm A' });
630
+ expect(morningResult).toBe('09:30 AM');
631
+ expect(eveningResult).toBe('09:30 PM');
632
+ });
633
+ // Test with month name format
634
+ it('should format date with month names', () => {
635
+ const date = new Date(2023, 5, 15); // June 15, 2023
636
+ const resultFull = formatDate(date, { dateFormat: 'MMMM D, YYYY' });
637
+ const resultAbbr = formatDate(date, { dateFormat: 'MMM D, YYYY' });
638
+ expect(resultFull).toBe('June 15, 2023');
639
+ expect(resultAbbr).toBe('Jun 15, 2023');
640
+ });
641
+ // Test with day of week format
642
+ it('should format date with day of week', () => {
643
+ const date = new Date(2023, 5, 15); // June 15, 2023, was a Thursday
644
+ const resultFull = formatDate(date, { dateFormat: 'dddd, MMMM D, YYYY' });
645
+ const resultAbbr = formatDate(date, { dateFormat: 'ddd, MMM D, YYYY' });
646
+ expect(resultFull).toBe('Thursday, June 15, 2023');
647
+ expect(resultAbbr).toBe('Thu, Jun 15, 2023');
648
+ });
649
+ // Edge cases
650
+ it('should handle leap year dates', () => {
651
+ const leapYearDate = new Date(2024, 1, 29); // February 29, 2024 (leap year)
652
+ const result = formatDate(leapYearDate, { dateFormat: 'YYYY-MM-DD' });
653
+ expect(result).toBe('2024-02-29');
654
+ });
655
+ it('should handle historic dates', () => {
656
+ const historicDate = new Date(1776, 6, 4); // July 4, 1776
657
+ const result = formatDate(historicDate, { dateFormat: 'MMMM D, YYYY' });
658
+ expect(result).toBe('July 4, 1776');
659
+ });
660
+ it('should handle future dates', () => {
661
+ const futureDate = new Date(2100, 11, 31); // December 31, 2100
662
+ const result = formatDate(futureDate, { dateFormat: 'YYYY-MM-DD' });
663
+ expect(result).toBe('2100-12-31');
664
+ });
665
+ });
666
+ });
667
+ //# sourceMappingURL=nv-calendar.utils.test.js.map