@alexisapp/leave-core 0.0.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +260 -0
  2. package/dist/chunk-P5WZALLT.mjs +1633 -0
  3. package/dist/chunk-R7NHFDIU.mjs +53 -0
  4. package/dist/chunk-TUQKZ7GW.mjs +207 -0
  5. package/dist/chunk-VS74AXZ6.mjs +70 -0
  6. package/dist/components/index.d.ts +11 -0
  7. package/dist/components/index.mjs +23 -0
  8. package/dist/domain/index.d.ts +2 -0
  9. package/dist/domain/index.mjs +0 -0
  10. package/dist/en-GB-TSTNTOGN.mjs +81 -0
  11. package/dist/forms/index.d.ts +2 -0
  12. package/dist/forms/index.mjs +0 -0
  13. package/dist/graphql-BI4OTV8N.d.ts +1814 -0
  14. package/dist/hooks/index.d.ts +50 -0
  15. package/dist/hooks/index.mjs +106 -0
  16. package/dist/i18n/index.d.ts +18 -0
  17. package/dist/i18n/index.mjs +16 -0
  18. package/dist/index.d.ts +133 -0
  19. package/dist/index.mjs +109 -0
  20. package/dist/leaveStatusUtils-C26heVdh.d.ts +11 -0
  21. package/dist/mutations/index.d.ts +2 -0
  22. package/dist/mutations/index.mjs +0 -0
  23. package/dist/queries/index.d.ts +489 -0
  24. package/dist/queries/index.mjs +15 -0
  25. package/dist/stores/index.d.ts +2 -0
  26. package/dist/stores/index.mjs +0 -0
  27. package/dist/utils/index.d.ts +40 -0
  28. package/dist/utils/index.mjs +53 -0
  29. package/package.json +94 -0
  30. package/src/client/createKyInstance.ts +34 -0
  31. package/src/client/execute.ts +153 -0
  32. package/src/client/index.ts +4 -0
  33. package/src/client/initializeClient.ts +48 -0
  34. package/src/client/resetClient.ts +10 -0
  35. package/src/client/types.ts +12 -0
  36. package/src/components/AsyncBoundary.tsx +29 -0
  37. package/src/components/index.ts +1 -0
  38. package/src/domain/index.ts +2 -0
  39. package/src/errors/AuthError.ts +12 -0
  40. package/src/errors/DomainError.ts +15 -0
  41. package/src/errors/GraphQLError.ts +16 -0
  42. package/src/errors/LeaveError.ts +13 -0
  43. package/src/errors/NetworkError.ts +12 -0
  44. package/src/errors/classifyError.ts +46 -0
  45. package/src/errors/errorMessages.ts +69 -0
  46. package/src/errors/index.ts +13 -0
  47. package/src/forms/index.ts +2 -0
  48. package/src/graphql/codegen-gateway.ts +26 -0
  49. package/src/graphql/codegen-hr-core.ts +31 -0
  50. package/src/graphql/generated-gateway/fragment-masking.ts +84 -0
  51. package/src/graphql/generated-gateway/gql.ts +140 -0
  52. package/src/graphql/generated-gateway/graphql.ts +10828 -0
  53. package/src/graphql/generated-gateway/index.ts +2 -0
  54. package/src/graphql/generated-hr-core/fragment-masking.ts +84 -0
  55. package/src/graphql/generated-hr-core/gql.ts +185 -0
  56. package/src/graphql/generated-hr-core/graphql.ts +19385 -0
  57. package/src/graphql/generated-hr-core/index.ts +2 -0
  58. package/src/graphql/index.ts +278 -0
  59. package/src/graphql/operations/gateway/leave-change/mutations.graphql +74 -0
  60. package/src/graphql/operations/gateway/leave-change/queries.graphql +51 -0
  61. package/src/graphql/operations/gateway/leave-policy-employee-reference/mutations.graphql +26 -0
  62. package/src/graphql/operations/gateway/leave-self-certified/mutations.graphql +45 -0
  63. package/src/graphql/operations/gateway/leave-self-certified/queries.graphql +80 -0
  64. package/src/graphql/operations/gateway/leave-type-code/mutations.graphql +25 -0
  65. package/src/graphql/operations/gateway/self-certified-policy/mutations.graphql +29 -0
  66. package/src/graphql/operations/gateway/self-certified-policy/queries.graphql +34 -0
  67. package/src/graphql/operations/gateway/time-bank/mutations.graphql +23 -0
  68. package/src/graphql/operations/gateway/time-bank/queries.graphql +5 -0
  69. package/src/graphql/operations/gateway/time-off-settings/mutations.graphql +19 -0
  70. package/src/graphql/operations/gateway/time-off-settings/queries.graphql +15 -0
  71. package/src/graphql/operations/gateway/user/queries.graphql +11 -0
  72. package/src/graphql/operations/hr-core/balance/mutations.graphql +34 -0
  73. package/src/graphql/operations/hr-core/balance/queries.graphql +21 -0
  74. package/src/graphql/operations/hr-core/employee/queries.graphql +27 -0
  75. package/src/graphql/operations/hr-core/employment/queries.graphql +40 -0
  76. package/src/graphql/operations/hr-core/file/mutations.graphql +15 -0
  77. package/src/graphql/operations/hr-core/group/queries.graphql +13 -0
  78. package/src/graphql/operations/hr-core/leave/mutations.graphql +68 -0
  79. package/src/graphql/operations/hr-core/leave/queries.graphql +150 -0
  80. package/src/graphql/operations/hr-core/leave-type/queries.graphql +33 -0
  81. package/src/graphql/operations/hr-core/member/queries.graphql +58 -0
  82. package/src/graphql/operations/hr-core/office/queries.graphql +26 -0
  83. package/src/graphql/operations/hr-core/policy/mutations.graphql +43 -0
  84. package/src/graphql/operations/hr-core/policy/queries.graphql +46 -0
  85. package/src/graphql/operations/hr-core/scope/mutations.graphql +19 -0
  86. package/src/graphql/operations/hr-core/team/queries.graphql +14 -0
  87. package/src/graphql/operations/hr-core/user/queries.graphql +37 -0
  88. package/src/graphql/operations/hr-core/work-calendar/queries.graphql +60 -0
  89. package/src/graphql/operations/hr-core/work-week/queries.graphql +139 -0
  90. package/src/hooks/index.ts +3 -0
  91. package/src/hooks/useBalance.ts +58 -0
  92. package/src/hooks/useCurrentEmployeeId.ts +15 -0
  93. package/src/hooks/useLeaveList.ts +91 -0
  94. package/src/i18n/index.ts +2 -0
  95. package/src/i18n/instance.ts +52 -0
  96. package/src/i18n/locale.ts +23 -0
  97. package/src/i18n/translations/en-GB.json +67 -0
  98. package/src/index.ts +19 -0
  99. package/src/mutations/index.ts +2 -0
  100. package/src/queries/employeeQueryFactory.ts +97 -0
  101. package/src/queries/index.ts +5 -0
  102. package/src/queries/leaveQueryFactory.ts +171 -0
  103. package/src/queries/policyQueryFactory.ts +87 -0
  104. package/src/queries/settingsQueryFactory.ts +31 -0
  105. package/src/queries/userQueryFactory.ts +13 -0
  106. package/src/stores/index.ts +2 -0
  107. package/src/utils/__tests__/formatDateRangeUtils.test.ts +61 -0
  108. package/src/utils/__tests__/leaveStatusUtils.test.ts +27 -0
  109. package/src/utils/__tests__/splitLeaveSectionsUtils.test.ts +71 -0
  110. package/src/utils/formatDateRangeUtils.ts +71 -0
  111. package/src/utils/index.ts +8 -0
  112. package/src/utils/leaveStatusUtils.ts +39 -0
  113. package/src/utils/splitLeaveSectionsUtils.ts +46 -0
  114. package/src/utils/typeSafeUtils.ts +4 -0
@@ -0,0 +1,489 @@
1
+ import { L as ListLeaveQueryVariables, a as ListLeaveQuery, E as Exact, I as InputMaybe, b as LeaveFilterInput, S as Scalars, c as LeaveSortInput, d as ListLeaveVisibleQuery, G as GetLeaveQuery, e as GetEmployeeVacationBalanceQuery, f as ListEmployeeVacationBalanceQueryVariables, g as ListEmployeeVacationBalanceQuery, h as EmployeeVacationBalanceFilterInput, i as GetLeaveUsageQueryVariables, j as GetLeaveUsageQuery, k as GetLeaveOverlapsQuery, l as GetLeaveApproversQueryVariables, m as GetLeaveApproversQuery, n as ListLeaveSelfCertifiedQueryVariables, o as ListLeaveSelfCertifiedQuery, p as Exact$1, q as InputMaybe$1, r as LeaveSelfCertifiedFiltersInput, s as Scalars$1, t as ListLeaveSelfCertifiedVisibleQueryVariables, u as ListLeaveSelfCertifiedVisibleQuery, v as GetLeaveSelfCertifiedQuery, w as ListLeaveChangesQueryVariables, x as ListLeaveChangesQuery, y as LeaveChangeFiltersInput, z as LeaveChangeSortInput, A as GetLeaveChangeQuery, B as GetTimeBankBalanceQuery, C as ListLeavePoliciesQueryVariables, D as ListLeavePoliciesQuery, F as LeavePolicyFilterInput, H as LeavePolicySortInput, J as GetLeavePolicyQuery, K as ListSelfCertifiedPoliciesQueryVariables, M as ListSelfCertifiedPoliciesQuery, N as LeaveSelfCertifiedPolicyFiltersInput, O as GetLeaveSelfCertifiedPolicyQuery, P as ListLeaveTypesQueryVariables, Q as ListLeaveTypesQuery, R as FilterGroupInput, T as SortByInput, U as GetEmployeeLeaveTypesQuery, V as GetEmployeeQuery, W as GetEmploymentQuery, X as ListEmploymentsQueryVariables, Y as ListEmploymentsQuery, Z as EmploymentFilter, _ as EmploymentSortInput, $ as GetWorkWeekQueryVariables, a0 as GetWorkWeekQuery, a1 as ListCompanyHolidaysQueryVariables, a2 as ListCompanyHolidaysQuery, a3 as CompanyHolidayFilterInput, a4 as CompanyHolidaySortInput, a5 as ListPublicHolidaysQueryVariables, a6 as ListPublicHolidaysQuery, a7 as PublicHolidayFilterInput, a8 as PublicHolidaySortInput, a9 as ListRestrictedDatesQueryVariables, aa as ListRestrictedDatesQuery, ab as RestrictedDateFilterInput, ac as RestrictedDateSortInput, ad as GetTimeOffSettingsQuery, ae as GetTimeOffSettingsByKeyQuery, af as MeQuery } from '../graphql-BI4OTV8N.js';
2
+ import * as _tanstack_react_query from '@tanstack/react-query';
3
+ import '@graphql-typed-document-node/core';
4
+
5
+ declare const leaveQueries: {
6
+ all: readonly ["leave"];
7
+ lists: () => readonly ["leave", "list"];
8
+ list: (variables?: ListLeaveQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveQuery, Error, ListLeaveQuery, readonly ["leave", "list", Exact<{
9
+ filters?: InputMaybe<LeaveFilterInput>;
10
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
11
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
12
+ sort?: InputMaybe<LeaveSortInput>;
13
+ }> | undefined]>, "queryFn"> & {
14
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveQuery, readonly ["leave", "list", Exact<{
15
+ filters?: InputMaybe<LeaveFilterInput>;
16
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
17
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
18
+ sort?: InputMaybe<LeaveSortInput>;
19
+ }> | undefined], never>;
20
+ } & {
21
+ queryKey: readonly ["leave", "list", Exact<{
22
+ filters?: InputMaybe<LeaveFilterInput>;
23
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
24
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
25
+ sort?: InputMaybe<LeaveSortInput>;
26
+ }> | undefined] & {
27
+ [dataTagSymbol]: ListLeaveQuery;
28
+ [dataTagErrorSymbol]: Error;
29
+ };
30
+ };
31
+ listVisible: () => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveVisibleQuery, Error, ListLeaveVisibleQuery, readonly ["leave", "list", "visible"]>, "queryFn"> & {
32
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveVisibleQuery, readonly ["leave", "list", "visible"], never>;
33
+ } & {
34
+ queryKey: readonly ["leave", "list", "visible"] & {
35
+ [dataTagSymbol]: ListLeaveVisibleQuery;
36
+ [dataTagErrorSymbol]: Error;
37
+ };
38
+ };
39
+ details: () => readonly ["leave", "detail"];
40
+ detail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveQuery, Error, GetLeaveQuery, readonly ["leave", "detail", string]>, "queryFn"> & {
41
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveQuery, readonly ["leave", "detail", string], never>;
42
+ } & {
43
+ queryKey: readonly ["leave", "detail", string] & {
44
+ [dataTagSymbol]: GetLeaveQuery;
45
+ [dataTagErrorSymbol]: Error;
46
+ };
47
+ };
48
+ balances: () => readonly ["leave", "balance"];
49
+ balance: (employeeId: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetEmployeeVacationBalanceQuery, Error, GetEmployeeVacationBalanceQuery, readonly ["leave", "balance", string]>, "queryFn"> & {
50
+ queryFn?: _tanstack_react_query.QueryFunction<GetEmployeeVacationBalanceQuery, readonly ["leave", "balance", string], never>;
51
+ } & {
52
+ queryKey: readonly ["leave", "balance", string] & {
53
+ [dataTagSymbol]: GetEmployeeVacationBalanceQuery;
54
+ [dataTagErrorSymbol]: Error;
55
+ };
56
+ };
57
+ balanceList: (variables?: ListEmployeeVacationBalanceQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListEmployeeVacationBalanceQuery, Error, ListEmployeeVacationBalanceQuery, readonly ["leave", "balance", "list", Exact<{
58
+ filters?: InputMaybe<EmployeeVacationBalanceFilterInput>;
59
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
60
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
61
+ }> | undefined]>, "queryFn"> & {
62
+ queryFn?: _tanstack_react_query.QueryFunction<ListEmployeeVacationBalanceQuery, readonly ["leave", "balance", "list", Exact<{
63
+ filters?: InputMaybe<EmployeeVacationBalanceFilterInput>;
64
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
65
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
66
+ }> | undefined], never>;
67
+ } & {
68
+ queryKey: readonly ["leave", "balance", "list", Exact<{
69
+ filters?: InputMaybe<EmployeeVacationBalanceFilterInput>;
70
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
71
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
72
+ }> | undefined] & {
73
+ [dataTagSymbol]: ListEmployeeVacationBalanceQuery;
74
+ [dataTagErrorSymbol]: Error;
75
+ };
76
+ };
77
+ usages: () => readonly ["leave", "usage"];
78
+ usage: (variables: GetLeaveUsageQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveUsageQuery, Error, GetLeaveUsageQuery, readonly ["leave", "usage", Exact<{
79
+ employeeId: Scalars["ID"]["input"];
80
+ typeIds: Array<InputMaybe<Scalars["ID"]["input"]>> | InputMaybe<Scalars["ID"]["input"]>;
81
+ from: Scalars["DateTime"]["input"];
82
+ to: Scalars["DateTime"]["input"];
83
+ childId?: InputMaybe<Scalars["ID"]["input"]>;
84
+ }>]>, "queryFn"> & {
85
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveUsageQuery, readonly ["leave", "usage", Exact<{
86
+ employeeId: Scalars["ID"]["input"];
87
+ typeIds: Array<InputMaybe<Scalars["ID"]["input"]>> | InputMaybe<Scalars["ID"]["input"]>;
88
+ from: Scalars["DateTime"]["input"];
89
+ to: Scalars["DateTime"]["input"];
90
+ childId?: InputMaybe<Scalars["ID"]["input"]>;
91
+ }>], never>;
92
+ } & {
93
+ queryKey: readonly ["leave", "usage", Exact<{
94
+ employeeId: Scalars["ID"]["input"];
95
+ typeIds: Array<InputMaybe<Scalars["ID"]["input"]>> | InputMaybe<Scalars["ID"]["input"]>;
96
+ from: Scalars["DateTime"]["input"];
97
+ to: Scalars["DateTime"]["input"];
98
+ childId?: InputMaybe<Scalars["ID"]["input"]>;
99
+ }>] & {
100
+ [dataTagSymbol]: GetLeaveUsageQuery;
101
+ [dataTagErrorSymbol]: Error;
102
+ };
103
+ };
104
+ overlaps: () => readonly ["leave", "overlap"];
105
+ overlap: (leaveId: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveOverlapsQuery, Error, GetLeaveOverlapsQuery, readonly ["leave", "overlap", string]>, "queryFn"> & {
106
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveOverlapsQuery, readonly ["leave", "overlap", string], never>;
107
+ } & {
108
+ queryKey: readonly ["leave", "overlap", string] & {
109
+ [dataTagSymbol]: GetLeaveOverlapsQuery;
110
+ [dataTagErrorSymbol]: Error;
111
+ };
112
+ };
113
+ approvers: () => readonly ["leave", "approver"];
114
+ approver: (variables: GetLeaveApproversQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveApproversQuery, Error, GetLeaveApproversQuery, readonly ["leave", "approver", Exact<{
115
+ companyId: Scalars["ObjectId"]["input"];
116
+ employeeId: Scalars["ObjectId"]["input"];
117
+ leaveTypeId: Scalars["ObjectId"]["input"];
118
+ }>]>, "queryFn"> & {
119
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveApproversQuery, readonly ["leave", "approver", Exact<{
120
+ companyId: Scalars["ObjectId"]["input"];
121
+ employeeId: Scalars["ObjectId"]["input"];
122
+ leaveTypeId: Scalars["ObjectId"]["input"];
123
+ }>], never>;
124
+ } & {
125
+ queryKey: readonly ["leave", "approver", Exact<{
126
+ companyId: Scalars["ObjectId"]["input"];
127
+ employeeId: Scalars["ObjectId"]["input"];
128
+ leaveTypeId: Scalars["ObjectId"]["input"];
129
+ }>] & {
130
+ [dataTagSymbol]: GetLeaveApproversQuery;
131
+ [dataTagErrorSymbol]: Error;
132
+ };
133
+ };
134
+ selfCertified: () => readonly ["leave", "self-certified"];
135
+ selfCertifiedList: (variables?: ListLeaveSelfCertifiedQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveSelfCertifiedQuery, Error, ListLeaveSelfCertifiedQuery, readonly ["leave", "self-certified", "list", Exact$1<{
136
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
137
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
138
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
139
+ }> | undefined]>, "queryFn"> & {
140
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveSelfCertifiedQuery, readonly ["leave", "self-certified", "list", Exact$1<{
141
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
142
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
143
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
144
+ }> | undefined], never>;
145
+ } & {
146
+ queryKey: readonly ["leave", "self-certified", "list", Exact$1<{
147
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
148
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
149
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
150
+ }> | undefined] & {
151
+ [dataTagSymbol]: ListLeaveSelfCertifiedQuery;
152
+ [dataTagErrorSymbol]: Error;
153
+ };
154
+ };
155
+ selfCertifiedListVisible: (variables?: ListLeaveSelfCertifiedVisibleQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveSelfCertifiedVisibleQuery, Error, ListLeaveSelfCertifiedVisibleQuery, readonly ["leave", "self-certified", "listVisible", Exact$1<{
156
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
157
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
158
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
159
+ }> | undefined]>, "queryFn"> & {
160
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveSelfCertifiedVisibleQuery, readonly ["leave", "self-certified", "listVisible", Exact$1<{
161
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
162
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
163
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
164
+ }> | undefined], never>;
165
+ } & {
166
+ queryKey: readonly ["leave", "self-certified", "listVisible", Exact$1<{
167
+ filters?: InputMaybe$1<LeaveSelfCertifiedFiltersInput>;
168
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
169
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
170
+ }> | undefined] & {
171
+ [dataTagSymbol]: ListLeaveSelfCertifiedVisibleQuery;
172
+ [dataTagErrorSymbol]: Error;
173
+ };
174
+ };
175
+ selfCertifiedDetail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveSelfCertifiedQuery, Error, GetLeaveSelfCertifiedQuery, readonly ["leave", "self-certified", "detail", string]>, "queryFn"> & {
176
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveSelfCertifiedQuery, readonly ["leave", "self-certified", "detail", string], never>;
177
+ } & {
178
+ queryKey: readonly ["leave", "self-certified", "detail", string] & {
179
+ [dataTagSymbol]: GetLeaveSelfCertifiedQuery;
180
+ [dataTagErrorSymbol]: Error;
181
+ };
182
+ };
183
+ approvals: () => readonly ["leave", "approval"];
184
+ approvalQueue: (variables?: ListLeaveChangesQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveChangesQuery, Error, ListLeaveChangesQuery, readonly ["leave", "approval", "list", Exact$1<{
185
+ filters?: InputMaybe$1<LeaveChangeFiltersInput>;
186
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
187
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
188
+ sort?: InputMaybe$1<LeaveChangeSortInput>;
189
+ }> | undefined]>, "queryFn"> & {
190
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveChangesQuery, readonly ["leave", "approval", "list", Exact$1<{
191
+ filters?: InputMaybe$1<LeaveChangeFiltersInput>;
192
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
193
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
194
+ sort?: InputMaybe$1<LeaveChangeSortInput>;
195
+ }> | undefined], never>;
196
+ } & {
197
+ queryKey: readonly ["leave", "approval", "list", Exact$1<{
198
+ filters?: InputMaybe$1<LeaveChangeFiltersInput>;
199
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
200
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
201
+ sort?: InputMaybe$1<LeaveChangeSortInput>;
202
+ }> | undefined] & {
203
+ [dataTagSymbol]: ListLeaveChangesQuery;
204
+ [dataTagErrorSymbol]: Error;
205
+ };
206
+ };
207
+ approvalDetail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveChangeQuery, Error, GetLeaveChangeQuery, readonly ["leave", "approval", "detail", string]>, "queryFn"> & {
208
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveChangeQuery, readonly ["leave", "approval", "detail", string], never>;
209
+ } & {
210
+ queryKey: readonly ["leave", "approval", "detail", string] & {
211
+ [dataTagSymbol]: GetLeaveChangeQuery;
212
+ [dataTagErrorSymbol]: Error;
213
+ };
214
+ };
215
+ timeBanks: () => readonly ["leave", "time-bank"];
216
+ timeBank: (employeeId: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetTimeBankBalanceQuery, Error, GetTimeBankBalanceQuery, readonly ["leave", "time-bank", string]>, "queryFn"> & {
217
+ queryFn?: _tanstack_react_query.QueryFunction<GetTimeBankBalanceQuery, readonly ["leave", "time-bank", string], never>;
218
+ } & {
219
+ queryKey: readonly ["leave", "time-bank", string] & {
220
+ [dataTagSymbol]: GetTimeBankBalanceQuery;
221
+ [dataTagErrorSymbol]: Error;
222
+ };
223
+ };
224
+ };
225
+
226
+ declare const policyQueries: {
227
+ all: readonly ["policy"];
228
+ lists: () => readonly ["policy", "list"];
229
+ list: (variables?: ListLeavePoliciesQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeavePoliciesQuery, Error, ListLeavePoliciesQuery, readonly ["policy", "list", Exact<{
230
+ filters?: InputMaybe<LeavePolicyFilterInput>;
231
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
232
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
233
+ sort?: InputMaybe<LeavePolicySortInput>;
234
+ }> | undefined]>, "queryFn"> & {
235
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeavePoliciesQuery, readonly ["policy", "list", Exact<{
236
+ filters?: InputMaybe<LeavePolicyFilterInput>;
237
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
238
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
239
+ sort?: InputMaybe<LeavePolicySortInput>;
240
+ }> | undefined], never>;
241
+ } & {
242
+ queryKey: readonly ["policy", "list", Exact<{
243
+ filters?: InputMaybe<LeavePolicyFilterInput>;
244
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
245
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
246
+ sort?: InputMaybe<LeavePolicySortInput>;
247
+ }> | undefined] & {
248
+ [dataTagSymbol]: ListLeavePoliciesQuery;
249
+ [dataTagErrorSymbol]: Error;
250
+ };
251
+ };
252
+ details: () => readonly ["policy", "detail"];
253
+ detail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeavePolicyQuery, Error, GetLeavePolicyQuery, readonly ["policy", "detail", string]>, "queryFn"> & {
254
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeavePolicyQuery, readonly ["policy", "detail", string], never>;
255
+ } & {
256
+ queryKey: readonly ["policy", "detail", string] & {
257
+ [dataTagSymbol]: GetLeavePolicyQuery;
258
+ [dataTagErrorSymbol]: Error;
259
+ };
260
+ };
261
+ selfCertified: () => readonly ["policy", "self-certified"];
262
+ selfCertifiedList: (variables?: ListSelfCertifiedPoliciesQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListSelfCertifiedPoliciesQuery, Error, ListSelfCertifiedPoliciesQuery, readonly ["policy", "self-certified", "list", Exact$1<{
263
+ filters?: InputMaybe$1<LeaveSelfCertifiedPolicyFiltersInput>;
264
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
265
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
266
+ }> | undefined]>, "queryFn"> & {
267
+ queryFn?: _tanstack_react_query.QueryFunction<ListSelfCertifiedPoliciesQuery, readonly ["policy", "self-certified", "list", Exact$1<{
268
+ filters?: InputMaybe$1<LeaveSelfCertifiedPolicyFiltersInput>;
269
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
270
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
271
+ }> | undefined], never>;
272
+ } & {
273
+ queryKey: readonly ["policy", "self-certified", "list", Exact$1<{
274
+ filters?: InputMaybe$1<LeaveSelfCertifiedPolicyFiltersInput>;
275
+ limit?: InputMaybe$1<Scalars$1["Float"]["input"]>;
276
+ offset?: InputMaybe$1<Scalars$1["Float"]["input"]>;
277
+ }> | undefined] & {
278
+ [dataTagSymbol]: ListSelfCertifiedPoliciesQuery;
279
+ [dataTagErrorSymbol]: Error;
280
+ };
281
+ };
282
+ selfCertifiedDetail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetLeaveSelfCertifiedPolicyQuery, Error, GetLeaveSelfCertifiedPolicyQuery, readonly ["policy", "self-certified", "detail", string]>, "queryFn"> & {
283
+ queryFn?: _tanstack_react_query.QueryFunction<GetLeaveSelfCertifiedPolicyQuery, readonly ["policy", "self-certified", "detail", string], never>;
284
+ } & {
285
+ queryKey: readonly ["policy", "self-certified", "detail", string] & {
286
+ [dataTagSymbol]: GetLeaveSelfCertifiedPolicyQuery;
287
+ [dataTagErrorSymbol]: Error;
288
+ };
289
+ };
290
+ leaveTypes: () => readonly ["policy", "leave-type"];
291
+ leaveTypeList: (variables: ListLeaveTypesQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListLeaveTypesQuery, Error, ListLeaveTypesQuery, readonly ["policy", "leave-type", "list", Exact<{
292
+ filters: FilterGroupInput;
293
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
294
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
295
+ sortBy?: InputMaybe<Array<InputMaybe<SortByInput>> | InputMaybe<SortByInput>>;
296
+ }>]>, "queryFn"> & {
297
+ queryFn?: _tanstack_react_query.QueryFunction<ListLeaveTypesQuery, readonly ["policy", "leave-type", "list", Exact<{
298
+ filters: FilterGroupInput;
299
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
300
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
301
+ sortBy?: InputMaybe<Array<InputMaybe<SortByInput>> | InputMaybe<SortByInput>>;
302
+ }>], never>;
303
+ } & {
304
+ queryKey: readonly ["policy", "leave-type", "list", Exact<{
305
+ filters: FilterGroupInput;
306
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
307
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
308
+ sortBy?: InputMaybe<Array<InputMaybe<SortByInput>> | InputMaybe<SortByInput>>;
309
+ }>] & {
310
+ [dataTagSymbol]: ListLeaveTypesQuery;
311
+ [dataTagErrorSymbol]: Error;
312
+ };
313
+ };
314
+ employeeLeaveTypes: (employeeId: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetEmployeeLeaveTypesQuery, Error, GetEmployeeLeaveTypesQuery, readonly ["policy", "leave-type", "employee", string]>, "queryFn"> & {
315
+ queryFn?: _tanstack_react_query.QueryFunction<GetEmployeeLeaveTypesQuery, readonly ["policy", "leave-type", "employee", string], never>;
316
+ } & {
317
+ queryKey: readonly ["policy", "leave-type", "employee", string] & {
318
+ [dataTagSymbol]: GetEmployeeLeaveTypesQuery;
319
+ [dataTagErrorSymbol]: Error;
320
+ };
321
+ };
322
+ };
323
+
324
+ declare const employeeQueries: {
325
+ all: readonly ["employee"];
326
+ details: () => readonly ["employee", "detail"];
327
+ detail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetEmployeeQuery, Error, GetEmployeeQuery, readonly ["employee", "detail", string]>, "queryFn"> & {
328
+ queryFn?: _tanstack_react_query.QueryFunction<GetEmployeeQuery, readonly ["employee", "detail", string], never>;
329
+ } & {
330
+ queryKey: readonly ["employee", "detail", string] & {
331
+ [dataTagSymbol]: GetEmployeeQuery;
332
+ [dataTagErrorSymbol]: Error;
333
+ };
334
+ };
335
+ employments: () => readonly ["employee", "employment"];
336
+ employment: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetEmploymentQuery, Error, GetEmploymentQuery, readonly ["employee", "employment", string]>, "queryFn"> & {
337
+ queryFn?: _tanstack_react_query.QueryFunction<GetEmploymentQuery, readonly ["employee", "employment", string], never>;
338
+ } & {
339
+ queryKey: readonly ["employee", "employment", string] & {
340
+ [dataTagSymbol]: GetEmploymentQuery;
341
+ [dataTagErrorSymbol]: Error;
342
+ };
343
+ };
344
+ employmentList: (variables: ListEmploymentsQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListEmploymentsQuery, Error, ListEmploymentsQuery, readonly ["employee", "employment", "list", Exact<{
345
+ filters?: InputMaybe<EmploymentFilter>;
346
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
347
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
348
+ sort?: InputMaybe<EmploymentSortInput>;
349
+ }>]>, "queryFn"> & {
350
+ queryFn?: _tanstack_react_query.QueryFunction<ListEmploymentsQuery, readonly ["employee", "employment", "list", Exact<{
351
+ filters?: InputMaybe<EmploymentFilter>;
352
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
353
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
354
+ sort?: InputMaybe<EmploymentSortInput>;
355
+ }>], never>;
356
+ } & {
357
+ queryKey: readonly ["employee", "employment", "list", Exact<{
358
+ filters?: InputMaybe<EmploymentFilter>;
359
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
360
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
361
+ sort?: InputMaybe<EmploymentSortInput>;
362
+ }>] & {
363
+ [dataTagSymbol]: ListEmploymentsQuery;
364
+ [dataTagErrorSymbol]: Error;
365
+ };
366
+ };
367
+ workWeeks: () => readonly ["employee", "work-week"];
368
+ workWeek: (variables: GetWorkWeekQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetWorkWeekQuery, Error, GetWorkWeekQuery, readonly ["employee", "work-week", Exact<{
369
+ id: Scalars["ID"]["input"];
370
+ }>]>, "queryFn"> & {
371
+ queryFn?: _tanstack_react_query.QueryFunction<GetWorkWeekQuery, readonly ["employee", "work-week", Exact<{
372
+ id: Scalars["ID"]["input"];
373
+ }>], never>;
374
+ } & {
375
+ queryKey: readonly ["employee", "work-week", Exact<{
376
+ id: Scalars["ID"]["input"];
377
+ }>] & {
378
+ [dataTagSymbol]: GetWorkWeekQuery;
379
+ [dataTagErrorSymbol]: Error;
380
+ };
381
+ };
382
+ holidays: () => readonly ["employee", "holiday"];
383
+ companyHolidays: (variables: ListCompanyHolidaysQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListCompanyHolidaysQuery, Error, ListCompanyHolidaysQuery, readonly ["employee", "holiday", "company", Exact<{
384
+ filters?: InputMaybe<CompanyHolidayFilterInput>;
385
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
386
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
387
+ sort?: InputMaybe<CompanyHolidaySortInput>;
388
+ }>]>, "queryFn"> & {
389
+ queryFn?: _tanstack_react_query.QueryFunction<ListCompanyHolidaysQuery, readonly ["employee", "holiday", "company", Exact<{
390
+ filters?: InputMaybe<CompanyHolidayFilterInput>;
391
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
392
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
393
+ sort?: InputMaybe<CompanyHolidaySortInput>;
394
+ }>], never>;
395
+ } & {
396
+ queryKey: readonly ["employee", "holiday", "company", Exact<{
397
+ filters?: InputMaybe<CompanyHolidayFilterInput>;
398
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
399
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
400
+ sort?: InputMaybe<CompanyHolidaySortInput>;
401
+ }>] & {
402
+ [dataTagSymbol]: ListCompanyHolidaysQuery;
403
+ [dataTagErrorSymbol]: Error;
404
+ };
405
+ };
406
+ publicHolidays: (variables: ListPublicHolidaysQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListPublicHolidaysQuery, Error, ListPublicHolidaysQuery, readonly ["employee", "holiday", "public", Exact<{
407
+ filters?: InputMaybe<PublicHolidayFilterInput>;
408
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
409
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
410
+ sort?: InputMaybe<PublicHolidaySortInput>;
411
+ }>]>, "queryFn"> & {
412
+ queryFn?: _tanstack_react_query.QueryFunction<ListPublicHolidaysQuery, readonly ["employee", "holiday", "public", Exact<{
413
+ filters?: InputMaybe<PublicHolidayFilterInput>;
414
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
415
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
416
+ sort?: InputMaybe<PublicHolidaySortInput>;
417
+ }>], never>;
418
+ } & {
419
+ queryKey: readonly ["employee", "holiday", "public", Exact<{
420
+ filters?: InputMaybe<PublicHolidayFilterInput>;
421
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
422
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
423
+ sort?: InputMaybe<PublicHolidaySortInput>;
424
+ }>] & {
425
+ [dataTagSymbol]: ListPublicHolidaysQuery;
426
+ [dataTagErrorSymbol]: Error;
427
+ };
428
+ };
429
+ restrictedDates: () => readonly ["employee", "restricted-date"];
430
+ restrictedDateList: (variables: ListRestrictedDatesQueryVariables) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ListRestrictedDatesQuery, Error, ListRestrictedDatesQuery, readonly ["employee", "restricted-date", Exact<{
431
+ filters?: InputMaybe<RestrictedDateFilterInput>;
432
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
433
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
434
+ sort?: InputMaybe<RestrictedDateSortInput>;
435
+ }>]>, "queryFn"> & {
436
+ queryFn?: _tanstack_react_query.QueryFunction<ListRestrictedDatesQuery, readonly ["employee", "restricted-date", Exact<{
437
+ filters?: InputMaybe<RestrictedDateFilterInput>;
438
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
439
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
440
+ sort?: InputMaybe<RestrictedDateSortInput>;
441
+ }>], never>;
442
+ } & {
443
+ queryKey: readonly ["employee", "restricted-date", Exact<{
444
+ filters?: InputMaybe<RestrictedDateFilterInput>;
445
+ limit?: InputMaybe<Scalars["Int"]["input"]>;
446
+ skip?: InputMaybe<Scalars["Int"]["input"]>;
447
+ sort?: InputMaybe<RestrictedDateSortInput>;
448
+ }>] & {
449
+ [dataTagSymbol]: ListRestrictedDatesQuery;
450
+ [dataTagErrorSymbol]: Error;
451
+ };
452
+ };
453
+ };
454
+
455
+ declare const settingsQueries: {
456
+ all: readonly ["settings"];
457
+ details: () => readonly ["settings", "detail"];
458
+ detail: (id: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetTimeOffSettingsQuery, Error, GetTimeOffSettingsQuery, readonly ["settings", "detail", string]>, "queryFn"> & {
459
+ queryFn?: _tanstack_react_query.QueryFunction<GetTimeOffSettingsQuery, readonly ["settings", "detail", string], never>;
460
+ } & {
461
+ queryKey: readonly ["settings", "detail", string] & {
462
+ [dataTagSymbol]: GetTimeOffSettingsQuery;
463
+ [dataTagErrorSymbol]: Error;
464
+ };
465
+ };
466
+ keys: () => readonly ["settings", "key"];
467
+ byKey: (key: string) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetTimeOffSettingsByKeyQuery, Error, GetTimeOffSettingsByKeyQuery, readonly ["settings", "key", string]>, "queryFn"> & {
468
+ queryFn?: _tanstack_react_query.QueryFunction<GetTimeOffSettingsByKeyQuery, readonly ["settings", "key", string], never>;
469
+ } & {
470
+ queryKey: readonly ["settings", "key", string] & {
471
+ [dataTagSymbol]: GetTimeOffSettingsByKeyQuery;
472
+ [dataTagErrorSymbol]: Error;
473
+ };
474
+ };
475
+ };
476
+
477
+ declare const userQueries: {
478
+ all: readonly ["user"];
479
+ me: () => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<MeQuery, Error, MeQuery, readonly ["user", "me"]>, "queryFn"> & {
480
+ queryFn?: _tanstack_react_query.QueryFunction<MeQuery, readonly ["user", "me"], never>;
481
+ } & {
482
+ queryKey: readonly ["user", "me"] & {
483
+ [dataTagSymbol]: MeQuery;
484
+ [dataTagErrorSymbol]: Error;
485
+ };
486
+ };
487
+ };
488
+
489
+ export { employeeQueries, leaveQueries, policyQueries, settingsQueries, userQueries };
@@ -0,0 +1,15 @@
1
+ import {
2
+ employeeQueries,
3
+ leaveQueries,
4
+ policyQueries,
5
+ settingsQueries,
6
+ userQueries
7
+ } from "../chunk-P5WZALLT.mjs";
8
+ import "../chunk-TUQKZ7GW.mjs";
9
+ export {
10
+ employeeQueries,
11
+ leaveQueries,
12
+ policyQueries,
13
+ settingsQueries,
14
+ userQueries
15
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export { }
File without changes
@@ -0,0 +1,40 @@
1
+ export { D as DisplayStatus, L as LeaveChangeType, r as resolveDisplayStatus } from '../leaveStatusUtils-C26heVdh.js';
2
+
3
+ /**
4
+ * Formats a date range for display on leave cards.
5
+ *
6
+ * - Single day, current year: "20 Mar"
7
+ * - Single day, other year: "20 Mar 2025"
8
+ * - Multi-day, same year, current year: "14 Apr – 18 Apr"
9
+ * - Cross-year: "23 Dec 2025 – 2 Jan 2026"
10
+ * - Null end date (open-ended): "1 Apr – ongoing"
11
+ */
12
+ declare function formatDateRange(localStartDate: string, localEndDate: string | null | undefined, ongoingLabel?: string): string;
13
+
14
+ interface SplittableLeaveItem {
15
+ localStartDate: string;
16
+ localEndDate: string | null;
17
+ }
18
+ /**
19
+ * Splits leave items into "upcoming" and "history" sections.
20
+ *
21
+ * - Upcoming: leaves where `localEndDate >= today` or `localEndDate` is null (open-ended).
22
+ * Sorted ascending by `localStartDate`.
23
+ * - History: leaves where `localEndDate < today`.
24
+ * Sorted descending by `localStartDate`.
25
+ *
26
+ * @param today - YYYY-MM-DD string in local timezone. Injected for testability.
27
+ */
28
+ declare function splitLeaveSections<T extends SplittableLeaveItem>(items: readonly T[], today: string): {
29
+ upcoming: T[];
30
+ history: T[];
31
+ };
32
+ /**
33
+ * Returns today's date as a YYYY-MM-DD string in the local timezone.
34
+ */
35
+ declare function getLocalToday(): string;
36
+
37
+ /** Equivalent of `.filter(Boolean)`, but type-safe. */
38
+ declare const isDefined: <T>(value: T | null | undefined) => value is NonNullable<T>;
39
+
40
+ export { type SplittableLeaveItem, formatDateRange, getLocalToday, isDefined, splitLeaveSections };
@@ -0,0 +1,53 @@
1
+ import {
2
+ getLocalToday,
3
+ isDefined,
4
+ resolveDisplayStatus,
5
+ splitLeaveSections
6
+ } from "../chunk-R7NHFDIU.mjs";
7
+
8
+ // src/utils/formatDateRangeUtils.ts
9
+ var shortDateFormatter = new Intl.DateTimeFormat("en-GB", {
10
+ day: "numeric",
11
+ month: "short"
12
+ });
13
+ var shortDateWithYearFormatter = new Intl.DateTimeFormat("en-GB", {
14
+ day: "numeric",
15
+ month: "short",
16
+ year: "numeric"
17
+ });
18
+ var EN_DASH = "\u2013";
19
+ function parseLocalDate(dateStr) {
20
+ const [year, month, day] = dateStr.split("-").map(Number);
21
+ return new Date(year, month - 1, day);
22
+ }
23
+ function getCurrentYear() {
24
+ return (/* @__PURE__ */ new Date()).getFullYear();
25
+ }
26
+ function formatDateRange(localStartDate, localEndDate, ongoingLabel = "ongoing") {
27
+ const start = parseLocalDate(localStartDate);
28
+ const startYear = start.getFullYear();
29
+ const currentYear = getCurrentYear();
30
+ if (localEndDate == null) {
31
+ const startStr = startYear !== currentYear ? shortDateWithYearFormatter.format(start) : shortDateFormatter.format(start);
32
+ return `${startStr} ${EN_DASH} ${ongoingLabel}`;
33
+ }
34
+ const end = parseLocalDate(localEndDate);
35
+ const endYear = end.getFullYear();
36
+ if (localStartDate === localEndDate) {
37
+ return startYear !== currentYear ? shortDateWithYearFormatter.format(start) : shortDateFormatter.format(start);
38
+ }
39
+ if (startYear !== endYear) {
40
+ return `${shortDateWithYearFormatter.format(start)} ${EN_DASH} ${shortDateWithYearFormatter.format(end)}`;
41
+ }
42
+ if (startYear !== currentYear) {
43
+ return `${shortDateWithYearFormatter.format(start)} ${EN_DASH} ${shortDateWithYearFormatter.format(end)}`;
44
+ }
45
+ return `${shortDateFormatter.format(start)} ${EN_DASH} ${shortDateFormatter.format(end)}`;
46
+ }
47
+ export {
48
+ formatDateRange,
49
+ getLocalToday,
50
+ isDefined,
51
+ resolveDisplayStatus,
52
+ splitLeaveSections
53
+ };