cortex-react-components 3.0.7 → 3.0.9

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 (225) hide show
  1. package/dist/{chunk-LSHBOPCT.mjs → chunk-27NWC2OO.mjs} +6 -3
  2. package/dist/{chunk-6B6BKJIE.mjs → chunk-34R3E2JB.mjs} +1 -1
  3. package/dist/{chunk-2NKCNQ56.mjs → chunk-3YAZKLH3.mjs} +1 -1
  4. package/dist/{chunk-FUNWDVGQ.mjs → chunk-4DNX5IYR.mjs} +1 -1
  5. package/dist/{chunk-HABWABS7.mjs → chunk-4O6ESJYG.mjs} +32 -11
  6. package/dist/{chunk-7H3IRT7K.mjs → chunk-5CQITTLV.mjs} +1 -1
  7. package/dist/{chunk-NAPGIF5D.mjs → chunk-5DYPBHBP.mjs} +3 -3
  8. package/dist/{chunk-DAQOEDAR.mjs → chunk-5NGZXIP7.mjs} +1 -1
  9. package/dist/{chunk-P4DQRHCA.mjs → chunk-6I3O6TVG.mjs} +1 -1
  10. package/dist/{chunk-EDJDHF22.mjs → chunk-6QSVFSOJ.mjs} +1 -1
  11. package/dist/{chunk-R2SJ5TZH.mjs → chunk-6VQJSQRU.mjs} +8 -8
  12. package/dist/{chunk-WMAVH7JO.mjs → chunk-6VQLA4YU.mjs} +2 -2
  13. package/dist/{chunk-GXTF5CHJ.mjs → chunk-7D3SYOXW.mjs} +7 -4
  14. package/dist/{chunk-DO73CLFG.mjs → chunk-AQPLEBKG.mjs} +1 -1
  15. package/dist/{chunk-ZPWWTTFF.mjs → chunk-BPAZFILP.mjs} +1 -1
  16. package/dist/{chunk-K3TF6OWE.mjs → chunk-BVCARDFK.mjs} +5 -5
  17. package/dist/{chunk-ENFQLMV3.mjs → chunk-CKBIYWPM.mjs} +1 -1
  18. package/dist/{chunk-KV5RVOAP.mjs → chunk-DGV5AVAW.mjs} +1 -1
  19. package/dist/{chunk-OS5X3ADZ.mjs → chunk-E5LGE3IW.mjs} +1 -1
  20. package/dist/chunk-F4LCVFZK.mjs +19 -0
  21. package/dist/{chunk-LAJ5FNY4.mjs → chunk-G5N5MCLS.mjs} +1 -1
  22. package/dist/{chunk-HZZWKYB5.mjs → chunk-G7GPQ6BO.mjs} +1 -1
  23. package/dist/{chunk-URCY4KWN.mjs → chunk-G7WAPCKX.mjs} +1 -1
  24. package/dist/{chunk-7OGBZ6QQ.mjs → chunk-ICVTRW5Y.mjs} +1 -1
  25. package/dist/{chunk-AICDXFGU.mjs → chunk-IFEQNYUB.mjs} +2 -2
  26. package/dist/{chunk-LCRSPNPB.mjs → chunk-LELKTN52.mjs} +18 -14
  27. package/dist/{chunk-RKQ4CVVG.mjs → chunk-M7LM5P64.mjs} +1 -1
  28. package/dist/{chunk-DQZO42TD.mjs → chunk-MSAH6P5O.mjs} +1 -1
  29. package/dist/{chunk-GZW77OJM.mjs → chunk-NKHYDT5B.mjs} +1 -1
  30. package/dist/{chunk-TTVOGAI4.mjs → chunk-OFES4YYV.mjs} +2 -2
  31. package/dist/{chunk-LP3K7AVX.mjs → chunk-OYHXC3AT.mjs} +13 -13
  32. package/dist/{chunk-7ZMZT7I6.mjs → chunk-P7BPG7W7.mjs} +1 -1
  33. package/dist/chunk-PIQUYPOZ.mjs +41 -0
  34. package/dist/{chunk-KVULICDA.mjs → chunk-PVI4R7FJ.mjs} +1 -1
  35. package/dist/{chunk-I647IJUG.mjs → chunk-QC2AXU6I.mjs} +2 -2
  36. package/dist/{chunk-M5JROT2X.mjs → chunk-R242HNC3.mjs} +1 -1
  37. package/dist/{chunk-6Q4KYDHK.mjs → chunk-RJRQ3SY5.mjs} +2 -2
  38. package/dist/{chunk-OXZ5QAXQ.mjs → chunk-S4FUSOSS.mjs} +1 -1
  39. package/dist/{chunk-DAGWV4UL.mjs → chunk-SRK3Y7FA.mjs} +1 -1
  40. package/dist/{chunk-2TJ5HOCV.mjs → chunk-UBEWNGCN.mjs} +1 -1
  41. package/dist/{chunk-JBFNSEIJ.mjs → chunk-UETTBM3J.mjs} +1 -1
  42. package/dist/{chunk-DB2F6SID.mjs → chunk-ULYN63F3.mjs} +1 -1
  43. package/dist/{chunk-VNSEHNDX.mjs → chunk-VF2QBVAI.mjs} +1 -1
  44. package/dist/{chunk-EC4N6ZH3.mjs → chunk-WA3OQB7X.mjs} +1 -1
  45. package/dist/{chunk-UDZU3AZC.mjs → chunk-XWYGGWIF.mjs} +4 -4
  46. package/dist/{chunk-2PGER2HM.mjs → chunk-YMXGTNMY.mjs} +1 -1
  47. package/dist/{chunk-G3UZUSQZ.mjs → chunk-ZFWHFUZP.mjs} +4 -4
  48. package/dist/{chunk-HQ2AUN2H.mjs → chunk-ZMITLXFT.mjs} +1 -1
  49. package/dist/{chunk-DRCDP3RU.mjs → chunk-ZXU5T3GV.mjs} +1 -1
  50. package/dist/{chunk-6RAMGDYG.mjs → chunk-ZZ5EM2M4.mjs} +1 -1
  51. package/dist/components/AdvancedComponents/index.mjs +9 -9
  52. package/dist/components/AdvancedComponents/org-chart-component/OrgChart.mjs +4 -4
  53. package/dist/components/AdvancedComponents/org-chart-component/OrgNode.mjs +2 -2
  54. package/dist/components/AdvancedComponents/org-chart-component/OrgTree.mjs +3 -3
  55. package/dist/components/AdvancedComponents/org-chart-component/index.mjs +6 -6
  56. package/dist/components/Blocks/Banner.js +17 -1
  57. package/dist/components/Blocks/Banner.mjs +4 -3
  58. package/dist/components/Blocks/CallToAction.js +17 -1
  59. package/dist/components/Blocks/CallToAction.mjs +4 -3
  60. package/dist/components/Blocks/CollapsibleArea.js +17 -1
  61. package/dist/components/Blocks/CollapsibleArea.mjs +5 -4
  62. package/dist/components/Blocks/Content.js +17 -1
  63. package/dist/components/Blocks/Content.mjs +5 -4
  64. package/dist/components/Blocks/FeaturesBlock.js +17 -1
  65. package/dist/components/Blocks/FeaturesBlock.mjs +4 -3
  66. package/dist/components/Blocks/RelatedPosts.js +17 -1
  67. package/dist/components/Blocks/RelatedPosts.mjs +5 -4
  68. package/dist/components/Blocks/RenderBlocks.js +17 -1
  69. package/dist/components/Blocks/RenderBlocks.mjs +7 -6
  70. package/dist/components/Blocks/ReusableContentBlock.js +17 -1
  71. package/dist/components/Blocks/ReusableContentBlock.mjs +7 -6
  72. package/dist/components/Blocks/index.js +17 -1
  73. package/dist/components/Blocks/index.mjs +13 -12
  74. package/dist/components/CRM/CogeBoard.js +1 -1
  75. package/dist/components/CRM/CogeBoard.mjs +2 -2
  76. package/dist/components/CRM/DealDetails.js +1 -1
  77. package/dist/components/CRM/DealDetails.mjs +1 -1
  78. package/dist/components/CRM/KanbanBoard.js +1 -1
  79. package/dist/components/CRM/KanbanBoard.mjs +2 -2
  80. package/dist/components/CRM/NewDealForm.js +1 -1
  81. package/dist/components/CRM/NewDealForm.mjs +1 -1
  82. package/dist/components/CRM/index.js +2 -2
  83. package/dist/components/CRM/index.mjs +4 -4
  84. package/dist/components/CRM/mockData.js +6 -6
  85. package/dist/components/CRM/mockData.mjs +6 -6
  86. package/dist/components/Cards/ContentCard.js +17 -1
  87. package/dist/components/Cards/ContentCard.mjs +4 -3
  88. package/dist/components/Cards/FeatureCard.js +17 -1
  89. package/dist/components/Cards/FeatureCard.mjs +4 -3
  90. package/dist/components/Cards/index.js +17 -1
  91. package/dist/components/Cards/index.mjs +6 -5
  92. package/dist/components/Chat/ChatInterface.mjs +7 -7
  93. package/dist/components/Chat/CopilotInterface.mjs +8 -8
  94. package/dist/components/Chat/PartTypes/MessageHandler.mjs +6 -6
  95. package/dist/components/Chat/PartTypes/index.mjs +19 -19
  96. package/dist/components/Chat/demo-long-messages.mjs +8 -8
  97. package/dist/components/Chat/demo-tests.mjs +8 -8
  98. package/dist/components/Chat/demo.mjs +8 -8
  99. package/dist/components/Chat/example-usage.mjs +9 -9
  100. package/dist/components/Chat/example-with-vercel-ai.mjs +8 -8
  101. package/dist/components/Chat/index.mjs +11 -11
  102. package/dist/components/DigitalColleagues/MainPage.mjs +4 -4
  103. package/dist/components/DigitalColleagues/Pages/dashboardpage.mjs +9 -9
  104. package/dist/components/DigitalColleagues/Views/ColleaguesView.mjs +2 -2
  105. package/dist/components/DigitalColleagues/Views/index.mjs +19 -19
  106. package/dist/components/DigitalColleagues/index.mjs +27 -27
  107. package/dist/components/Foundary/Knowledge/add-knowledge-modal.mjs +2 -2
  108. package/dist/components/Foundary/Knowledge/add-team-context.mjs +2 -2
  109. package/dist/components/Foundary/MainPage.mjs +4 -4
  110. package/dist/components/Foundary/Pages/dashboardpage.mjs +13 -13
  111. package/dist/components/Foundary/RichText/index.mjs +3 -3
  112. package/dist/components/Foundary/RichText/plugins/toolbar-plugin.mjs +2 -2
  113. package/dist/components/Foundary/Views/KnowledgeView.mjs +9 -9
  114. package/dist/components/Foundary/Views/index.mjs +21 -21
  115. package/dist/components/Foundary/document-edit.mjs +4 -4
  116. package/dist/components/Foundary/document-preview-examples.mjs +5 -5
  117. package/dist/components/Foundary/document-preview.mjs +5 -5
  118. package/dist/components/Foundary/file-edit.mjs +6 -6
  119. package/dist/components/Foundary/index.mjs +39 -39
  120. package/dist/components/Foundary/knowledge-browser.mjs +6 -6
  121. package/dist/components/HeaderFooter/SectionHeading.js +17 -1
  122. package/dist/components/HeaderFooter/SectionHeading.mjs +5 -4
  123. package/dist/components/HeaderFooter/index.mjs +8 -8
  124. package/dist/components/Heros/HighImpact/index.js +17 -1
  125. package/dist/components/Heros/HighImpact/index.mjs +5 -4
  126. package/dist/components/Heros/LowImpact/index.js +17 -1
  127. package/dist/components/Heros/LowImpact/index.mjs +5 -4
  128. package/dist/components/Heros/MediumImpact/index.js +17 -1
  129. package/dist/components/Heros/MediumImpact/index.mjs +5 -4
  130. package/dist/components/Heros/PostHero/index.mjs +2 -2
  131. package/dist/components/Heros/RenderHero.js +17 -1
  132. package/dist/components/Heros/RenderHero.mjs +8 -7
  133. package/dist/components/Heros/index.js +17 -1
  134. package/dist/components/Heros/index.mjs +12 -11
  135. package/dist/components/Holidays/CalendarView.d.ts +2 -1
  136. package/dist/components/Holidays/CalendarView.js +18 -14
  137. package/dist/components/Holidays/CalendarView.mjs +1 -1
  138. package/dist/components/Holidays/HolidayGrid.js +5 -3
  139. package/dist/components/Holidays/HolidayGrid.mjs +2 -2
  140. package/dist/components/Holidays/HolidayTracker.d.ts +2 -1
  141. package/dist/components/Holidays/HolidayTracker.js +65 -35
  142. package/dist/components/Holidays/HolidayTracker.mjs +5 -5
  143. package/dist/components/Holidays/RequestLeave.js +40 -17
  144. package/dist/components/Holidays/RequestLeave.mjs +2 -2
  145. package/dist/components/Holidays/index.js +65 -35
  146. package/dist/components/Holidays/index.mjs +5 -5
  147. package/dist/components/Layouts/OutputHeaderFooter.js +17 -1
  148. package/dist/components/Layouts/OutputHeaderFooter.mjs +6 -5
  149. package/dist/components/Layouts/Print.js +17 -1
  150. package/dist/components/Layouts/Print.mjs +10 -9
  151. package/dist/components/Layouts/SlideShow.js +17 -1
  152. package/dist/components/Layouts/SlideShow.mjs +12 -11
  153. package/dist/components/Layouts/index.js +17 -1
  154. package/dist/components/Layouts/index.mjs +16 -15
  155. package/dist/components/Menus/index.mjs +3 -3
  156. package/dist/components/Payload/RichText/index.js +17 -1
  157. package/dist/components/Payload/RichText/index.mjs +4 -3
  158. package/dist/components/Payload/RichText/serialize.js +17 -1
  159. package/dist/components/Payload/RichText/serialize.mjs +4 -3
  160. package/dist/components/Payload/index.js +17 -1
  161. package/dist/components/Payload/index.mjs +7 -6
  162. package/dist/components/Projects/EpicsView.mjs +2 -2
  163. package/dist/components/Projects/FileView.mjs +9 -9
  164. package/dist/components/Projects/KanbanBoardView.mjs +12 -12
  165. package/dist/components/Projects/ProjectPage.mjs +16 -16
  166. package/dist/components/Projects/ProjectView.mjs +16 -16
  167. package/dist/components/Projects/TaskDetailsModal.mjs +10 -10
  168. package/dist/components/Projects/file-list.mjs +7 -7
  169. package/dist/components/Projects/index.mjs +15 -15
  170. package/dist/components/dc-temp/index.mjs +9 -9
  171. package/dist/components/index.js +116 -70
  172. package/dist/components/index.mjs +121 -120
  173. package/dist/components/ui/index.mjs +11 -11
  174. package/dist/decorators/Intranet.mjs +73 -72
  175. package/dist/index.js +116 -70
  176. package/dist/index.mjs +134 -133
  177. package/dist/metafile-cjs.json +1 -1
  178. package/dist/metafile-esm.json +1 -1
  179. package/dist/pages/Blog.js +17 -1
  180. package/dist/pages/Blog.mjs +12 -11
  181. package/dist/pages/Documentation.mjs +4 -4
  182. package/dist/pages/IndexPage.mjs +15 -14
  183. package/dist/pages/Intranet.mjs +1 -1
  184. package/dist/pages/LandingPage.js +17 -1
  185. package/dist/pages/LandingPage.mjs +83 -82
  186. package/dist/pages/Page.js +17 -1
  187. package/dist/pages/Page.mjs +15 -14
  188. package/dist/pages/Publish.js +17 -1
  189. package/dist/pages/Publish.mjs +72 -71
  190. package/dist/pages/Website.js +17 -1
  191. package/dist/pages/Website.mjs +17 -16
  192. package/dist/payload-types.d.ts +1 -1
  193. package/dist/sections/AboutSection.js +17 -1
  194. package/dist/sections/AboutSection.mjs +6 -5
  195. package/dist/sections/BlogDetail.js +17 -1
  196. package/dist/sections/BlogDetail.mjs +5 -4
  197. package/dist/sections/BlogList.js +17 -1
  198. package/dist/sections/BlogList.mjs +6 -5
  199. package/dist/sections/BlogListSection.mjs +2 -2
  200. package/dist/sections/ContactSection.js +17 -1
  201. package/dist/sections/ContactSection.mjs +6 -5
  202. package/dist/sections/PageSections.js +17 -1
  203. package/dist/sections/PageSections.mjs +81 -80
  204. package/dist/sections/PricingSection.js +17 -1
  205. package/dist/sections/PricingSection.mjs +6 -5
  206. package/dist/sections/ServiceDetail.js +17 -1
  207. package/dist/sections/ServiceDetail.mjs +5 -4
  208. package/dist/sections/ServiceDetailSection.js +17 -1
  209. package/dist/sections/ServiceDetailSection.mjs +5 -4
  210. package/dist/sections/ServiceSection.js +17 -1
  211. package/dist/sections/ServiceSection.mjs +72 -71
  212. package/dist/sections/index.js +17 -1
  213. package/dist/sections/index.mjs +83 -82
  214. package/dist/utils/DaysUtil.js +9 -7
  215. package/dist/utils/DaysUtil.mjs +1 -1
  216. package/dist/utils/getLinkHref.d.ts +12 -0
  217. package/dist/utils/getLinkHref.js +43 -0
  218. package/dist/utils/getLinkHref.mjs +7 -0
  219. package/package.json +1 -1
  220. package/dist/chunk-I4UOIVSC.mjs +0 -39
  221. package/dist/{chunk-25OSLP2V.mjs → chunk-6TVRFATY.mjs} +3 -3
  222. package/dist/{chunk-EUAUP52U.mjs → chunk-7UMFQPR5.mjs} +3 -3
  223. package/dist/{chunk-ECCJ42NJ.mjs → chunk-L666B5DN.mjs} +14 -14
  224. package/dist/{chunk-DZYAOBGH.mjs → chunk-PXB2ICFA.mjs} +3 -3
  225. package/dist/{chunk-6OFY4WMY.mjs → chunk-RWZ36G7W.mjs} +3 -3
@@ -4,26 +4,26 @@ import {
4
4
  import {
5
5
  Breadcrumbs,
6
6
  RenderHero
7
- } from "../../chunk-K3TF6OWE.mjs";
7
+ } from "../../chunk-BVCARDFK.mjs";
8
8
  import {
9
9
  SectionHero
10
10
  } from "../../chunk-N77BYZ6A.mjs";
11
- import {
12
- HighImpactHero
13
- } from "../../chunk-DO73CLFG.mjs";
14
11
  import {
15
12
  MediumImpactHero
16
- } from "../../chunk-DAGWV4UL.mjs";
13
+ } from "../../chunk-SRK3Y7FA.mjs";
14
+ import {
15
+ HighImpactHero
16
+ } from "../../chunk-AQPLEBKG.mjs";
17
17
  import {
18
18
  LowImpactHero
19
- } from "../../chunk-OXZ5QAXQ.mjs";
19
+ } from "../../chunk-S4FUSOSS.mjs";
20
20
  import {
21
21
  PostHero
22
22
  } from "../../chunk-R3LWKUWD.mjs";
23
- import "../../chunk-JCFLPLDK.mjs";
24
- import "../../chunk-IBQBZNEA.mjs";
25
23
  import "../../chunk-3VKPPG4Z.mjs";
26
24
  import "../../chunk-T2CLUB2R.mjs";
25
+ import "../../chunk-IBQBZNEA.mjs";
26
+ import "../../chunk-JCFLPLDK.mjs";
27
27
  import "../../chunk-6V75REDA.mjs";
28
28
  import "../../chunk-B2NSGNGK.mjs";
29
29
  import "../../chunk-WMIXALIT.mjs";
@@ -36,27 +36,28 @@ import "../../chunk-4UJUWE3A.mjs";
36
36
  import "../../chunk-7CVOGGH6.mjs";
37
37
  import "../../chunk-RFP2KGUZ.mjs";
38
38
  import "../../chunk-W5ROY7BH.mjs";
39
- import "../../chunk-LSHBOPCT.mjs";
39
+ import "../../chunk-27NWC2OO.mjs";
40
40
  import "../../chunk-YLULVMZ7.mjs";
41
41
  import "../../chunk-2NXKZY7U.mjs";
42
42
  import "../../chunk-GSG52WU5.mjs";
43
43
  import "../../chunk-US72SCH3.mjs";
44
44
  import "../../chunk-G6EC37S7.mjs";
45
45
  import "../../chunk-LTOFCHXU.mjs";
46
+ import "../../chunk-LIJ2ES4B.mjs";
46
47
  import "../../chunk-GTHNG3Q7.mjs";
47
48
  import "../../chunk-PE44IHZN.mjs";
48
49
  import "../../chunk-4GLXI5J3.mjs";
49
50
  import "../../chunk-2X45TVQS.mjs";
50
51
  import "../../chunk-DTQ2W22B.mjs";
51
- import "../../chunk-LIJ2ES4B.mjs";
52
52
  import "../../chunk-6GO5N6ZP.mjs";
53
- import "../../chunk-WPX6MOFB.mjs";
54
53
  import "../../chunk-3R2LCGLI.mjs";
55
54
  import "../../chunk-NKRBXAPF.mjs";
56
55
  import "../../chunk-MW5UCIIC.mjs";
57
56
  import "../../chunk-ZYKYDIOF.mjs";
57
+ import "../../chunk-WPX6MOFB.mjs";
58
58
  import "../../chunk-R57RJLFQ.mjs";
59
59
  import "../../chunk-GIHP74M4.mjs";
60
+ import "../../chunk-F4LCVFZK.mjs";
60
61
  import "../../chunk-3BYULUMU.mjs";
61
62
  import "../../chunk-RZRMW2DZ.mjs";
62
63
  import "../../chunk-GUHOQLS3.mjs";
@@ -2,6 +2,7 @@ interface CalendarViewProps {
2
2
  currentDate: Date;
3
3
  setCurrentDate: (date: Date) => void;
4
4
  holidays: Holiday[];
5
+ today: Date;
5
6
  }
6
7
  interface Holiday {
7
8
  id: string;
@@ -13,5 +14,5 @@ interface Holiday {
13
14
  totalDays: number;
14
15
  leaveType: 'Full Day' | 'Morning' | 'Afternoon';
15
16
  }
16
- export declare function CalendarView({ currentDate, setCurrentDate, holidays }: CalendarViewProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function CalendarView({ currentDate, setCurrentDate, holidays, today }: CalendarViewProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -2565,38 +2565,42 @@ Button.displayName = "Button";
2565
2565
 
2566
2566
  // src/components/Holidays/CalendarView.tsx
2567
2567
  var import_jsx_runtime2 = require("react/jsx-runtime");
2568
- function CalendarView({ currentDate, setCurrentDate, holidays }) {
2568
+ function CalendarView({ currentDate, setCurrentDate, holidays, today }) {
2569
2569
  const [selectedDay, setSelectedDay] = (0, import_react.useState)(null);
2570
- const firstDayOfMonth = (new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).getDay() + 6) % 7;
2570
+ const isSameUtcDay = (a, b) => a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
2571
+ const firstDayOfMonth = (new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), 1)).getUTCDay() + 6) % 7;
2571
2572
  const days = Array.from({ length: 42 }, (_, i) => {
2572
2573
  const day = new Date(
2573
- currentDate.getFullYear(),
2574
- currentDate.getMonth(),
2575
- i - firstDayOfMonth + 1,
2576
- currentDate.getHours()
2574
+ Date.UTC(
2575
+ currentDate.getUTCFullYear(),
2576
+ currentDate.getUTCMonth(),
2577
+ i - firstDayOfMonth + 1
2578
+ )
2577
2579
  );
2578
2580
  const filteredHolidays = holidays.filter(
2579
2581
  (h) => TimeUtil.toUtcMidnight(new Date(h.startDate)) <= day && TimeUtil.toUtcEndOfDay(new Date(h.endDate)) >= day
2580
2582
  );
2581
2583
  return {
2582
2584
  date: day,
2583
- isCurrentMonth: day.getMonth() === currentDate.getMonth(),
2584
- isToday: day.toDateString() === (/* @__PURE__ */ new Date()).toDateString(),
2585
+ isCurrentMonth: day.getUTCMonth() === currentDate.getUTCMonth(),
2586
+ isToday: isSameUtcDay(day, today),
2585
2587
  holidays: filteredHolidays
2586
2588
  };
2587
2589
  });
2588
2590
  const prevMonth = () => {
2589
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1));
2591
+ setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() - 1, 1)));
2590
2592
  };
2591
2593
  const nextMonth = () => {
2592
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1));
2594
+ setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 1)));
2593
2595
  };
2594
2596
  const setToday = () => {
2595
- setCurrentDate(/* @__PURE__ */ new Date());
2597
+ setCurrentDate(TimeUtil.toUtcMidnight(/* @__PURE__ */ new Date()));
2596
2598
  };
2599
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2600
+ const monthYearDisplay = `${months[currentDate.getUTCMonth()]} ${currentDate.getUTCFullYear()}`;
2597
2601
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "lg:flex lg:h-full lg:flex-col", children: [
2598
2602
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("header", { className: "flex items-center justify-between border-b border-gray-200 px-6 py-4 lg:flex-none", children: [
2599
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("time", { dateTime: currentDate.toISOString(), children: currentDate.toLocaleString("default", { month: "long", year: "numeric" }) }) }),
2603
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("time", { dateTime: currentDate.toISOString(), children: monthYearDisplay }) }),
2600
2604
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "relative flex items-center rounded-md gap-1 md:items-stretch", children: [
2601
2605
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2602
2606
  Button,
@@ -2683,7 +2687,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
2683
2687
  "flex h-6 w-6 items-center justify-center rounded-full",
2684
2688
  day.isToday && "bg-indigo-600 font-semibold text-white"
2685
2689
  ),
2686
- children: day.date.getDate()
2690
+ children: day.date.getUTCDate()
2687
2691
  }
2688
2692
  ),
2689
2693
  day.holidays.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ol", { className: "mt-2 space-y-1 overflow-visible", children: day.holidays.map((holiday) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -2720,7 +2724,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
2720
2724
  day.date === selectedDay && day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-indigo-600",
2721
2725
  day.date === selectedDay && !day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-gray-900"
2722
2726
  ),
2723
- children: day.date.getDate()
2727
+ children: day.date.getUTCDate()
2724
2728
  }
2725
2729
  ),
2726
2730
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "sr-only", children: [
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  CalendarView
5
- } from "../../chunk-LCRSPNPB.mjs";
5
+ } from "../../chunk-LELKTN52.mjs";
6
6
  import "../../chunk-I6LSWXZW.mjs";
7
7
  import "../../chunk-BXLYIIII.mjs";
8
8
  import "../../chunk-JHOP4BOK.mjs";
@@ -2636,9 +2636,11 @@ var bankHolidays = [
2636
2636
 
2637
2637
  // src/utils/DaysUtil.ts
2638
2638
  var isDayOff = (date) => {
2639
- const isSunday = date.getDay() === 0;
2640
- const isSaturday = date.getDay() === 6;
2641
- const isBankHoliday = bankHolidays.some((h) => h.toISOString() === date.toISOString());
2639
+ const isSunday = date.getUTCDay() === 0;
2640
+ const isSaturday = date.getUTCDay() === 6;
2641
+ const isBankHoliday = bankHolidays.some(
2642
+ (h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
2643
+ );
2642
2644
  return isSunday || isSaturday || isBankHoliday;
2643
2645
  };
2644
2646
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HolidayGrid
3
- } from "../../chunk-7ZMZT7I6.mjs";
4
- import "../../chunk-I4UOIVSC.mjs";
3
+ } from "../../chunk-P7BPG7W7.mjs";
4
+ import "../../chunk-PIQUYPOZ.mjs";
5
5
  import "../../chunk-IZ2IHNU4.mjs";
6
6
  import "../../chunk-DNKWV24K.mjs";
7
7
  import "../../chunk-I6LSWXZW.mjs";
@@ -6,6 +6,7 @@ interface HolidayTrackerProps {
6
6
  leaveApprovals: LeaveRequest[];
7
7
  employees: Employee[];
8
8
  currentDate: string;
9
+ today: string;
9
10
  currentUser: {
10
11
  grade: string;
11
12
  remainingLeaveDays: number;
@@ -23,5 +24,5 @@ interface HolidayTrackerProps {
23
24
  message: string;
24
25
  }>;
25
26
  }
26
- export declare function HolidayTracker({ holidays, currentUser, currentDate, leaveApprovals, employees, submitLeaveRequest, approveLeave, rejectLeave, }: HolidayTrackerProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare function HolidayTracker({ holidays, currentUser, currentDate, today, leaveApprovals, employees, submitLeaveRequest, approveLeave, rejectLeave, }: HolidayTrackerProps): import("react/jsx-runtime").JSX.Element;
27
28
  export {};
@@ -2642,14 +2642,16 @@ var bankHolidays = [
2642
2642
 
2643
2643
  // src/utils/DaysUtil.ts
2644
2644
  var isDayOff = (date) => {
2645
- const isSunday = date.getDay() === 0;
2646
- const isSaturday = date.getDay() === 6;
2647
- const isBankHoliday = bankHolidays.some((h) => h.toISOString() === date.toISOString());
2645
+ const isSunday = date.getUTCDay() === 0;
2646
+ const isSaturday = date.getUTCDay() === 6;
2647
+ const isBankHoliday = bankHolidays.some(
2648
+ (h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
2649
+ );
2648
2650
  return isSunday || isSaturday || isBankHoliday;
2649
2651
  };
2650
2652
  var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
2651
- const start = new Date(startDate);
2652
- const end = new Date(endDate);
2653
+ let start = new Date(Date.UTC(startDate.getUTCFullYear(), startDate.getUTCMonth(), startDate.getUTCDate()));
2654
+ const end = new Date(Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate()));
2653
2655
  let count = 0;
2654
2656
  if (isHalfDay && !isDayOff(start)) {
2655
2657
  return 0.5;
@@ -2658,7 +2660,7 @@ var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
2658
2660
  if (!isDayOff(start)) {
2659
2661
  count++;
2660
2662
  }
2661
- start.setDate(start.getDate() + 1);
2663
+ start = new Date(start.getTime() + 24 * 60 * 60 * 1e3);
2662
2664
  }
2663
2665
  return count;
2664
2666
  };
@@ -2666,7 +2668,7 @@ var getIsMultipleDays = (startDate, endDate) => {
2666
2668
  if (!startDate || !endDate) {
2667
2669
  return false;
2668
2670
  }
2669
- const isMultipleDays = startDate.toDateString() !== endDate.toDateString();
2671
+ const isMultipleDays = startDate.getUTCFullYear() !== endDate.getUTCFullYear() || startDate.getUTCMonth() !== endDate.getUTCMonth() || startDate.getUTCDate() !== endDate.getUTCDate();
2670
2672
  return isMultipleDays;
2671
2673
  };
2672
2674
 
@@ -2840,38 +2842,42 @@ function HolidayGrid({
2840
2842
  var import_react = require("react");
2841
2843
  var import_lucide_react2 = require("lucide-react");
2842
2844
  var import_jsx_runtime4 = require("react/jsx-runtime");
2843
- function CalendarView({ currentDate, setCurrentDate, holidays }) {
2845
+ function CalendarView({ currentDate, setCurrentDate, holidays, today }) {
2844
2846
  const [selectedDay, setSelectedDay] = (0, import_react.useState)(null);
2845
- const firstDayOfMonth = (new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).getDay() + 6) % 7;
2847
+ const isSameUtcDay = (a, b) => a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
2848
+ const firstDayOfMonth = (new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth(), 1)).getUTCDay() + 6) % 7;
2846
2849
  const days = Array.from({ length: 42 }, (_, i) => {
2847
2850
  const day = new Date(
2848
- currentDate.getFullYear(),
2849
- currentDate.getMonth(),
2850
- i - firstDayOfMonth + 1,
2851
- currentDate.getHours()
2851
+ Date.UTC(
2852
+ currentDate.getUTCFullYear(),
2853
+ currentDate.getUTCMonth(),
2854
+ i - firstDayOfMonth + 1
2855
+ )
2852
2856
  );
2853
2857
  const filteredHolidays = holidays.filter(
2854
2858
  (h) => TimeUtil.toUtcMidnight(new Date(h.startDate)) <= day && TimeUtil.toUtcEndOfDay(new Date(h.endDate)) >= day
2855
2859
  );
2856
2860
  return {
2857
2861
  date: day,
2858
- isCurrentMonth: day.getMonth() === currentDate.getMonth(),
2859
- isToday: day.toDateString() === (/* @__PURE__ */ new Date()).toDateString(),
2862
+ isCurrentMonth: day.getUTCMonth() === currentDate.getUTCMonth(),
2863
+ isToday: isSameUtcDay(day, today),
2860
2864
  holidays: filteredHolidays
2861
2865
  };
2862
2866
  });
2863
2867
  const prevMonth = () => {
2864
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1));
2868
+ setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() - 1, 1)));
2865
2869
  };
2866
2870
  const nextMonth = () => {
2867
- setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1));
2871
+ setCurrentDate(new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 1)));
2868
2872
  };
2869
2873
  const setToday = () => {
2870
- setCurrentDate(/* @__PURE__ */ new Date());
2874
+ setCurrentDate(TimeUtil.toUtcMidnight(/* @__PURE__ */ new Date()));
2871
2875
  };
2876
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2877
+ const monthYearDisplay = `${months[currentDate.getUTCMonth()]} ${currentDate.getUTCFullYear()}`;
2872
2878
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lg:flex lg:h-full lg:flex-col", children: [
2873
2879
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("header", { className: "flex items-center justify-between border-b border-gray-200 px-6 py-4 lg:flex-none", children: [
2874
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: currentDate.toISOString(), children: currentDate.toLocaleString("default", { month: "long", year: "numeric" }) }) }),
2880
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: currentDate.toISOString(), children: monthYearDisplay }) }),
2875
2881
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex items-center rounded-md gap-1 md:items-stretch", children: [
2876
2882
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2877
2883
  Button,
@@ -2958,7 +2964,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
2958
2964
  "flex h-6 w-6 items-center justify-center rounded-full",
2959
2965
  day.isToday && "bg-indigo-600 font-semibold text-white"
2960
2966
  ),
2961
- children: day.date.getDate()
2967
+ children: day.date.getUTCDate()
2962
2968
  }
2963
2969
  ),
2964
2970
  day.holidays.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ol", { className: "mt-2 space-y-1 overflow-visible", children: day.holidays.map((holiday) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -2995,7 +3001,7 @@ function CalendarView({ currentDate, setCurrentDate, holidays }) {
2995
3001
  day.date === selectedDay && day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-indigo-600",
2996
3002
  day.date === selectedDay && !day.isToday && "flex h-6 w-6 items-center justify-center rounded-full bg-gray-900"
2997
3003
  ),
2998
- children: day.date.getDate()
3004
+ children: day.date.getUTCDate()
2999
3005
  }
3000
3006
  ),
3001
3007
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "sr-only", children: [
@@ -3104,7 +3110,6 @@ var PopoverContent = React4.forwardRef(({ className, align = "center", sideOffse
3104
3110
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
3105
3111
 
3106
3112
  // src/components/Holidays/RequestLeave.tsx
3107
- var import_date_fns = require("date-fns");
3108
3113
  var import_lucide_react3 = require("lucide-react");
3109
3114
  var import_navigation = require("next/navigation");
3110
3115
  var import_sonner = require("sonner");
@@ -3124,11 +3129,26 @@ var ButtonGroup = ({ options, value, onChange, disabled = [] }) => {
3124
3129
  )) });
3125
3130
  };
3126
3131
  function RequestLeave({ remainingDays, submitLeaveRequest }) {
3127
- const [startDate, setStartDate] = (0, import_react2.useState)(/* @__PURE__ */ new Date());
3128
- const [endDate, setEndDate] = (0, import_react2.useState)(/* @__PURE__ */ new Date());
3132
+ const setToMidnightUTC = (date) => {
3133
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
3134
+ };
3135
+ const formatDateUTC = (date) => {
3136
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
3137
+ const day = date.getUTCDate();
3138
+ const month = months[date.getUTCMonth()];
3139
+ const year = date.getUTCFullYear();
3140
+ const suffix = day === 1 || day === 21 || day === 31 ? "st" : day === 2 || day === 22 ? "nd" : day === 3 || day === 23 ? "rd" : "th";
3141
+ return `${month} ${day}${suffix}, ${year}`;
3142
+ };
3143
+ const [startDate, setStartDate] = (0, import_react2.useState)(void 0);
3144
+ const [endDate, setEndDate] = (0, import_react2.useState)(void 0);
3145
+ (0, import_react2.useEffect)(() => {
3146
+ if (startDate === void 0) setStartDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
3147
+ if (endDate === void 0) setEndDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
3148
+ }, []);
3129
3149
  const [leaveType, setLeaveType] = (0, import_react2.useState)("Full Day");
3130
3150
  const [isMultipleDays, setIsMultipleDays] = (0, import_react2.useState)(false);
3131
- const [totalDays, setTotalDays] = (0, import_react2.useState)(1);
3151
+ const [totalDays, setTotalDays] = (0, import_react2.useState)(0);
3132
3152
  const router = (0, import_navigation.useRouter)();
3133
3153
  (0, import_react2.useEffect)(() => {
3134
3154
  const isMultipleDays2 = getIsMultipleDays(startDate, endDate);
@@ -3197,7 +3217,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
3197
3217
  ),
3198
3218
  children: [
3199
3219
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.CalendarIcon, { className: "mr-2 h-4 w-4" }),
3200
- startDate ? (0, import_date_fns.format)(startDate, "PPP") : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
3220
+ startDate ? formatDateUTC(startDate) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
3201
3221
  ]
3202
3222
  }
3203
3223
  ) }),
@@ -3207,9 +3227,12 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
3207
3227
  mode: "single",
3208
3228
  selected: startDate,
3209
3229
  onSelect: (date) => {
3210
- setStartDate(date);
3211
- if (date && (!endDate || date > endDate)) {
3212
- setEndDate(date);
3230
+ if (date) {
3231
+ const dateMidnight = setToMidnightUTC(date);
3232
+ setStartDate(dateMidnight);
3233
+ if (!endDate || date > endDate) {
3234
+ setEndDate(dateMidnight);
3235
+ }
3213
3236
  }
3214
3237
  },
3215
3238
  initialFocus: true
@@ -3230,7 +3253,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
3230
3253
  ),
3231
3254
  children: [
3232
3255
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.CalendarIcon, { className: "mr-2 h-4 w-4" }),
3233
- endDate ? (0, import_date_fns.format)(endDate, "PPP") : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
3256
+ endDate ? formatDateUTC(endDate) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pick a date" })
3234
3257
  ]
3235
3258
  }
3236
3259
  ) }),
@@ -3239,7 +3262,11 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
3239
3262
  {
3240
3263
  mode: "single",
3241
3264
  selected: endDate,
3242
- onSelect: setEndDate,
3265
+ onSelect: (date) => {
3266
+ if (date) {
3267
+ setEndDate(setToMidnightUTC(date));
3268
+ }
3269
+ },
3243
3270
  disabled: (date) => startDate ? date < startDate : false,
3244
3271
  initialFocus: true
3245
3272
  }
@@ -3458,7 +3485,7 @@ function ApproveLeave({ leaveRequests, onApprove, onReject }) {
3458
3485
 
3459
3486
  // src/components/Holidays/HolidayTracker.tsx
3460
3487
  var import_navigation3 = require("next/navigation");
3461
- var import_date_fns2 = require("date-fns");
3488
+ var import_date_fns = require("date-fns");
3462
3489
  var import_jsx_runtime12 = require("react/jsx-runtime");
3463
3490
  function classNames2(...classes) {
3464
3491
  return classes.filter(Boolean).join(" ");
@@ -3467,6 +3494,7 @@ function HolidayTracker({
3467
3494
  holidays,
3468
3495
  currentUser,
3469
3496
  currentDate,
3497
+ today,
3470
3498
  leaveApprovals,
3471
3499
  employees,
3472
3500
  submitLeaveRequest,
@@ -3476,9 +3504,10 @@ function HolidayTracker({
3476
3504
  const [currentTab, setCurrentTab] = (0, import_react4.useState)("Calendar View");
3477
3505
  const router = (0, import_navigation3.useRouter)();
3478
3506
  const isLoading = false;
3479
- const parsedCurrentDate = TimeUtil.toUtcMidnight((0, import_date_fns2.parseISO)(currentDate));
3507
+ const parsedCurrentDate = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(currentDate));
3508
+ const parsedToday = TimeUtil.toUtcMidnight((0, import_date_fns.parseISO)(today));
3480
3509
  const setCurrentDate = async (date) => {
3481
- const formattedDate = (0, import_date_fns2.format)(date, "dd-MM-yyyy");
3510
+ const formattedDate = (0, import_date_fns.format)(date, "dd-MM-yyyy");
3482
3511
  const url = new URL(window.location.href);
3483
3512
  url.searchParams.set("date", formattedDate);
3484
3513
  router.push(url.toString());
@@ -3558,7 +3587,8 @@ function HolidayTracker({
3558
3587
  {
3559
3588
  currentDate: parsedCurrentDate,
3560
3589
  setCurrentDate,
3561
- holidays
3590
+ holidays,
3591
+ today: parsedToday
3562
3592
  }
3563
3593
  ),
3564
3594
  currentTab === "Request Leave" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2,12 +2,12 @@
2
2
  "use strict";
3
3
  import {
4
4
  HolidayTracker
5
- } from "../../chunk-GXTF5CHJ.mjs";
6
- import "../../chunk-HABWABS7.mjs";
5
+ } from "../../chunk-7D3SYOXW.mjs";
6
+ import "../../chunk-4O6ESJYG.mjs";
7
7
  import "../../chunk-7UVCCDPI.mjs";
8
- import "../../chunk-LCRSPNPB.mjs";
9
- import "../../chunk-7ZMZT7I6.mjs";
10
- import "../../chunk-I4UOIVSC.mjs";
8
+ import "../../chunk-LELKTN52.mjs";
9
+ import "../../chunk-P7BPG7W7.mjs";
10
+ import "../../chunk-PIQUYPOZ.mjs";
11
11
  import "../../chunk-IZ2IHNU4.mjs";
12
12
  import "../../chunk-6V75REDA.mjs";
13
13
  import "../../chunk-B2NSGNGK.mjs";
@@ -2629,7 +2629,6 @@ var PopoverContent = React3.forwardRef(({ className, align = "center", sideOffse
2629
2629
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
2630
2630
 
2631
2631
  // src/components/Holidays/RequestLeave.tsx
2632
- var import_date_fns = require("date-fns");
2633
2632
  var import_lucide_react = require("lucide-react");
2634
2633
  var import_navigation = require("next/navigation");
2635
2634
  var import_sonner = require("sonner");
@@ -2674,14 +2673,16 @@ var bankHolidays = [
2674
2673
 
2675
2674
  // src/utils/DaysUtil.ts
2676
2675
  var isDayOff = (date) => {
2677
- const isSunday = date.getDay() === 0;
2678
- const isSaturday = date.getDay() === 6;
2679
- const isBankHoliday = bankHolidays.some((h) => h.toISOString() === date.toISOString());
2676
+ const isSunday = date.getUTCDay() === 0;
2677
+ const isSaturday = date.getUTCDay() === 6;
2678
+ const isBankHoliday = bankHolidays.some(
2679
+ (h) => h.getFullYear() === date.getUTCFullYear() && h.getMonth() === date.getUTCMonth() && h.getDate() === date.getUTCDate()
2680
+ );
2680
2681
  return isSunday || isSaturday || isBankHoliday;
2681
2682
  };
2682
2683
  var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
2683
- const start = new Date(startDate);
2684
- const end = new Date(endDate);
2684
+ let start = new Date(Date.UTC(startDate.getUTCFullYear(), startDate.getUTCMonth(), startDate.getUTCDate()));
2685
+ const end = new Date(Date.UTC(endDate.getUTCFullYear(), endDate.getUTCMonth(), endDate.getUTCDate()));
2685
2686
  let count = 0;
2686
2687
  if (isHalfDay && !isDayOff(start)) {
2687
2688
  return 0.5;
@@ -2690,7 +2691,7 @@ var getTotalDaysBetween = (startDate, endDate, isHalfDay = false) => {
2690
2691
  if (!isDayOff(start)) {
2691
2692
  count++;
2692
2693
  }
2693
- start.setDate(start.getDate() + 1);
2694
+ start = new Date(start.getTime() + 24 * 60 * 60 * 1e3);
2694
2695
  }
2695
2696
  return count;
2696
2697
  };
@@ -2698,7 +2699,7 @@ var getIsMultipleDays = (startDate, endDate) => {
2698
2699
  if (!startDate || !endDate) {
2699
2700
  return false;
2700
2701
  }
2701
- const isMultipleDays = startDate.toDateString() !== endDate.toDateString();
2702
+ const isMultipleDays = startDate.getUTCFullYear() !== endDate.getUTCFullYear() || startDate.getUTCMonth() !== endDate.getUTCMonth() || startDate.getUTCDate() !== endDate.getUTCDate();
2702
2703
  return isMultipleDays;
2703
2704
  };
2704
2705
 
@@ -2719,11 +2720,26 @@ var ButtonGroup = ({ options, value, onChange, disabled = [] }) => {
2719
2720
  )) });
2720
2721
  };
2721
2722
  function RequestLeave({ remainingDays, submitLeaveRequest }) {
2722
- const [startDate, setStartDate] = (0, import_react.useState)(/* @__PURE__ */ new Date());
2723
- const [endDate, setEndDate] = (0, import_react.useState)(/* @__PURE__ */ new Date());
2723
+ const setToMidnightUTC = (date) => {
2724
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
2725
+ };
2726
+ const formatDateUTC = (date) => {
2727
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2728
+ const day = date.getUTCDate();
2729
+ const month = months[date.getUTCMonth()];
2730
+ const year = date.getUTCFullYear();
2731
+ const suffix = day === 1 || day === 21 || day === 31 ? "st" : day === 2 || day === 22 ? "nd" : day === 3 || day === 23 ? "rd" : "th";
2732
+ return `${month} ${day}${suffix}, ${year}`;
2733
+ };
2734
+ const [startDate, setStartDate] = (0, import_react.useState)(void 0);
2735
+ const [endDate, setEndDate] = (0, import_react.useState)(void 0);
2736
+ (0, import_react.useEffect)(() => {
2737
+ if (startDate === void 0) setStartDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
2738
+ if (endDate === void 0) setEndDate(setToMidnightUTC(/* @__PURE__ */ new Date()));
2739
+ }, []);
2724
2740
  const [leaveType, setLeaveType] = (0, import_react.useState)("Full Day");
2725
2741
  const [isMultipleDays, setIsMultipleDays] = (0, import_react.useState)(false);
2726
- const [totalDays, setTotalDays] = (0, import_react.useState)(1);
2742
+ const [totalDays, setTotalDays] = (0, import_react.useState)(0);
2727
2743
  const router = (0, import_navigation.useRouter)();
2728
2744
  (0, import_react.useEffect)(() => {
2729
2745
  const isMultipleDays2 = getIsMultipleDays(startDate, endDate);
@@ -2792,7 +2808,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
2792
2808
  ),
2793
2809
  children: [
2794
2810
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }),
2795
- startDate ? (0, import_date_fns.format)(startDate, "PPP") : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
2811
+ startDate ? formatDateUTC(startDate) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
2796
2812
  ]
2797
2813
  }
2798
2814
  ) }),
@@ -2802,9 +2818,12 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
2802
2818
  mode: "single",
2803
2819
  selected: startDate,
2804
2820
  onSelect: (date) => {
2805
- setStartDate(date);
2806
- if (date && (!endDate || date > endDate)) {
2807
- setEndDate(date);
2821
+ if (date) {
2822
+ const dateMidnight = setToMidnightUTC(date);
2823
+ setStartDate(dateMidnight);
2824
+ if (!endDate || date > endDate) {
2825
+ setEndDate(dateMidnight);
2826
+ }
2808
2827
  }
2809
2828
  },
2810
2829
  initialFocus: true
@@ -2825,7 +2844,7 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
2825
2844
  ),
2826
2845
  children: [
2827
2846
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.CalendarIcon, { className: "mr-2 h-4 w-4" }),
2828
- endDate ? (0, import_date_fns.format)(endDate, "PPP") : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
2847
+ endDate ? formatDateUTC(endDate) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Pick a date" })
2829
2848
  ]
2830
2849
  }
2831
2850
  ) }),
@@ -2834,7 +2853,11 @@ function RequestLeave({ remainingDays, submitLeaveRequest }) {
2834
2853
  {
2835
2854
  mode: "single",
2836
2855
  selected: endDate,
2837
- onSelect: setEndDate,
2856
+ onSelect: (date) => {
2857
+ if (date) {
2858
+ setEndDate(setToMidnightUTC(date));
2859
+ }
2860
+ },
2838
2861
  disabled: (date) => startDate ? date < startDate : false,
2839
2862
  initialFocus: true
2840
2863
  }
@@ -2,8 +2,8 @@
2
2
  "use strict";
3
3
  import {
4
4
  RequestLeave
5
- } from "../../chunk-HABWABS7.mjs";
6
- import "../../chunk-I4UOIVSC.mjs";
5
+ } from "../../chunk-4O6ESJYG.mjs";
6
+ import "../../chunk-PIQUYPOZ.mjs";
7
7
  import "../../chunk-IZ2IHNU4.mjs";
8
8
  import "../../chunk-6V75REDA.mjs";
9
9
  import "../../chunk-B2NSGNGK.mjs";