chronos-date 1.0.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.
- package/LICENSE +201 -0
- package/README.md +31 -0
- package/dist/basic-CKxaRSHQ.cjs +1 -0
- package/dist/basic-e46DaNAi.mjs +1 -0
- package/dist/constants.cjs +1 -0
- package/dist/constants.d.cts +2 -0
- package/dist/constants.d.mts +2 -0
- package/dist/constants.mjs +1 -0
- package/dist/convert-Bmp63ats.mjs +1 -0
- package/dist/convert-DrLrcgqz.cjs +1 -0
- package/dist/greet-BBsrvmkn.mjs +1 -0
- package/dist/greet-C-6mruI9.cjs +1 -0
- package/dist/guards.cjs +1 -0
- package/dist/guards.d.cts +71 -0
- package/dist/guards.d.mts +71 -0
- package/dist/guards.mjs +1 -0
- package/dist/helpers-DGzYnP81.cjs +1 -0
- package/dist/helpers-N1X_Rj_V.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +1 -0
- package/dist/non-primitives-B2EE6D6s.mjs +1 -0
- package/dist/non-primitives-Bu3a4WL4.cjs +1 -0
- package/dist/plugins/banglaPlugin.cjs +1 -0
- package/dist/plugins/banglaPlugin.d.cts +225 -0
- package/dist/plugins/banglaPlugin.d.mts +225 -0
- package/dist/plugins/banglaPlugin.mjs +1 -0
- package/dist/plugins/businessPlugin.cjs +1 -0
- package/dist/plugins/businessPlugin.d.cts +446 -0
- package/dist/plugins/businessPlugin.d.mts +446 -0
- package/dist/plugins/businessPlugin.mjs +1 -0
- package/dist/plugins/dateRangePlugin.cjs +1 -0
- package/dist/plugins/dateRangePlugin.d.cts +71 -0
- package/dist/plugins/dateRangePlugin.d.mts +71 -0
- package/dist/plugins/dateRangePlugin.mjs +1 -0
- package/dist/plugins/dayPartPlugin.cjs +1 -0
- package/dist/plugins/dayPartPlugin.d.cts +45 -0
- package/dist/plugins/dayPartPlugin.d.mts +45 -0
- package/dist/plugins/dayPartPlugin.mjs +1 -0
- package/dist/plugins/durationPlugin.cjs +1 -0
- package/dist/plugins/durationPlugin.d.cts +30 -0
- package/dist/plugins/durationPlugin.d.mts +30 -0
- package/dist/plugins/durationPlugin.mjs +1 -0
- package/dist/plugins/fromNowPlugin.cjs +1 -0
- package/dist/plugins/fromNowPlugin.d.cts +24 -0
- package/dist/plugins/fromNowPlugin.d.mts +24 -0
- package/dist/plugins/fromNowPlugin.mjs +1 -0
- package/dist/plugins/greetingPlugin.cjs +1 -0
- package/dist/plugins/greetingPlugin.d.cts +29 -0
- package/dist/plugins/greetingPlugin.d.mts +29 -0
- package/dist/plugins/greetingPlugin.mjs +1 -0
- package/dist/plugins/palindromePlugin.cjs +1 -0
- package/dist/plugins/palindromePlugin.d.cts +38 -0
- package/dist/plugins/palindromePlugin.d.mts +38 -0
- package/dist/plugins/palindromePlugin.mjs +1 -0
- package/dist/plugins/relativeTimePlugin.cjs +1 -0
- package/dist/plugins/relativeTimePlugin.d.cts +82 -0
- package/dist/plugins/relativeTimePlugin.d.mts +82 -0
- package/dist/plugins/relativeTimePlugin.mjs +1 -0
- package/dist/plugins/roundPlugin.cjs +1 -0
- package/dist/plugins/roundPlugin.d.cts +29 -0
- package/dist/plugins/roundPlugin.d.mts +29 -0
- package/dist/plugins/roundPlugin.mjs +1 -0
- package/dist/plugins/seasonPlugin.cjs +1 -0
- package/dist/plugins/seasonPlugin.d.cts +26 -0
- package/dist/plugins/seasonPlugin.d.mts +26 -0
- package/dist/plugins/seasonPlugin.mjs +1 -0
- package/dist/plugins/timeZonePlugin.cjs +1 -0
- package/dist/plugins/timeZonePlugin.d.cts +88 -0
- package/dist/plugins/timeZonePlugin.d.mts +88 -0
- package/dist/plugins/timeZonePlugin.mjs +1 -0
- package/dist/plugins/zodiacPlugin.cjs +1 -0
- package/dist/plugins/zodiacPlugin.d.cts +41 -0
- package/dist/plugins/zodiacPlugin.d.mts +41 -0
- package/dist/plugins/zodiacPlugin.mjs +1 -0
- package/dist/primitives-Cxss_JVF.mjs +1 -0
- package/dist/primitives-Db2FUp4e.cjs +1 -0
- package/dist/seasons-ChAIVphi.mjs +1 -0
- package/dist/seasons-CioTH5Dm.d.mts +5285 -0
- package/dist/seasons-CsVeJ27s.d.cts +5285 -0
- package/dist/seasons-oABOhHcX.cjs +1 -0
- package/dist/timezone-B10UItNO.mjs +1 -0
- package/dist/timezone-CWxbK_7I.cjs +1 -0
- package/dist/types-B2fgrJ86.d.mts +2123 -0
- package/dist/types-DPTQ_yLx.d.cts +2123 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utilities-B8dOAQVD.cjs +1 -0
- package/dist/utilities-BJE06bms.mjs +1 -0
- package/dist/utilities-D2-p26DX.cjs +1 -0
- package/dist/utilities-DV_ohS37.mjs +1 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.cts +188 -0
- package/dist/utils.d.mts +188 -0
- package/dist/utils.mjs +1 -0
- package/package.json +162 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { C as $Chronos, D as ChronosInput, Dn as RangeTuple, Tn as NumberRange, Tt as Quarter, a as BusinessOptionsWeekends, i as BusinessOptionsBasic, r as AcademicYear, wn as Enumerate } from "../types-DPTQ_yLx.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/businessPlugin.d.ts
|
|
4
|
+
declare module '../' {
|
|
5
|
+
interface Chronos {
|
|
6
|
+
/**
|
|
7
|
+
* @instance Checks if the current date falls on a weekend using week start day and weekend length.
|
|
8
|
+
*
|
|
9
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
10
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
11
|
+
* @returns `true` if the current date is a weekend day according to the provided parameters; otherwise `false`.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Determines whether the current date is considered part of the weekend.
|
|
15
|
+
*
|
|
16
|
+
* **Behavior:**
|
|
17
|
+
* - By default (`weekStartsOn = 0`, `weekendLength = 2`), Saturday (6) and Friday (5) are considered weekend.
|
|
18
|
+
* - `weekStartsOn` sets the start of the week for calculating weekend days.
|
|
19
|
+
* - `weekendLength` sets how many days at the end of the week are treated as weekend.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Default: Saturday & Friday are weekend
|
|
23
|
+
* new Chronos().isWeekend();
|
|
24
|
+
*
|
|
25
|
+
* // Custom week start (Monday) with 2-day weekend (Saturday & Sunday)
|
|
26
|
+
* new Chronos().isWeekend(1, 2);
|
|
27
|
+
*
|
|
28
|
+
* // Custom 3-day weekend (Friday, Saturday, Sunday)
|
|
29
|
+
* new Chronos().isWeekend(1, 3);
|
|
30
|
+
*/
|
|
31
|
+
isWeekend(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @instance Checks if the current date falls on a weekend using indices of weekend days.
|
|
34
|
+
*
|
|
35
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Can pass only 1-4 elements.
|
|
36
|
+
* @returns `true` if the current date is a weekend day according to the provided `weekendDays`; otherwise `false`.
|
|
37
|
+
*
|
|
38
|
+
* @description
|
|
39
|
+
* Determines whether the current date is considered part of the weekend.
|
|
40
|
+
*
|
|
41
|
+
* **Behavior:**
|
|
42
|
+
* - `weekendDays` is used directly as the weekend days instead of calculating from `weekStartsOn` + `weekendLength`.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Fully custom weekend days (Sunday, Friday, Saturday)
|
|
46
|
+
* new Chronos().isWeekend([0, 5, 6]);
|
|
47
|
+
*/
|
|
48
|
+
isWeekend(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @instance Checks if the current date is a workday (non-weekend day) using week start day and weekend length.
|
|
51
|
+
*
|
|
52
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
53
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
54
|
+
* @returns `true` if the current date is a work day according to the provided parameters; otherwise `false`.
|
|
55
|
+
*
|
|
56
|
+
* @description
|
|
57
|
+
* Determines whether the current date is considered as workday. Internally uses {@link isWeekend} method.
|
|
58
|
+
*
|
|
59
|
+
* **Behavior:**
|
|
60
|
+
* - By default (`weekStartsOn = 0`, `weekendLength = 2`), Saturday (6) and Friday (5) are considered weekend.
|
|
61
|
+
* - `weekStartsOn` sets the start of the week for calculating weekend days.
|
|
62
|
+
* - `weekendLength` sets how many days at the end of the week are treated as weekend.
|
|
63
|
+
*/
|
|
64
|
+
isWorkday(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* @instance Checks if the current date is a workday (non-weekend day) using indices of weekend days.
|
|
67
|
+
*
|
|
68
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Can pass only 1-4 elements.
|
|
69
|
+
* @returns `true` if the current date is a work day according to the provided `weekendDays`; otherwise `false`.
|
|
70
|
+
*
|
|
71
|
+
* @description
|
|
72
|
+
* Determines whether the current date is considered as workday. Internally uses {@link isWeekend} method.
|
|
73
|
+
*
|
|
74
|
+
* **Behavior:**
|
|
75
|
+
* - `weekendDays` is used directly as the weekend days instead of calculating from `weekStartsOn` + `weekendLength`.
|
|
76
|
+
*/
|
|
77
|
+
isWorkday(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* @instance Returns the next business day (workday) after the current date using week start day and weekend length.
|
|
80
|
+
*
|
|
81
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
82
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
83
|
+
* @returns A new `Chronos` instance representing the next business day (work day), normalized to the start of that day.
|
|
84
|
+
*
|
|
85
|
+
* @description
|
|
86
|
+
* Moves forward one day at a time to find the nearest day that is **not** considered a weekend.
|
|
87
|
+
*
|
|
88
|
+
* **Behavior:**
|
|
89
|
+
* - Weekend days are automatically calculated from `weekStartsOn` and `weekendLength`.
|
|
90
|
+
* - The search begins on the day immediately after the current date.
|
|
91
|
+
* - Always returns a new immutable `Chronos` instance, normalized to the start of the day.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* // Default weekend (Friday & Saturday)
|
|
95
|
+
* new Chronos('2025-01-23').nextWorkday();
|
|
96
|
+
*
|
|
97
|
+
* // Custom start of week (Monday) with 2-day weekend (Saturday & Sunday)
|
|
98
|
+
* new Chronos().nextWorkday(1, 2);
|
|
99
|
+
*
|
|
100
|
+
* // Custom 3-day weekend (Fri, Sat, Sun)
|
|
101
|
+
* new Chronos().nextWorkday(1, 3);
|
|
102
|
+
*/
|
|
103
|
+
nextWorkday(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): Chronos;
|
|
104
|
+
/**
|
|
105
|
+
* @instance Returns the next business day (workday) after the current date using custom weekend day indices.
|
|
106
|
+
*
|
|
107
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain between 1 and 4 elements.
|
|
108
|
+
* @returns A new `Chronos` instance representing the next business day (workday), normalized to the start of that day.
|
|
109
|
+
*
|
|
110
|
+
* @description
|
|
111
|
+
* Moves forward one day at a time until a day is reached that is **not** included in `weekendDays`.
|
|
112
|
+
*
|
|
113
|
+
* **Behavior:**
|
|
114
|
+
* - `weekendDays` is used directly and overrides any automatic weekend calculation.
|
|
115
|
+
* - The search starts from the day immediately following the current date.
|
|
116
|
+
* - Returns a new immutable `Chronos` instance every time, normalized to the start of the day.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // Custom weekend days (Friday, Saturday, Sunday)
|
|
120
|
+
* new Chronos().nextWorkday([5, 6, 0]);
|
|
121
|
+
*/
|
|
122
|
+
nextWorkday(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): Chronos;
|
|
123
|
+
/**
|
|
124
|
+
* @instance Returns the next weekend day after the current date using week start day and weekend length.
|
|
125
|
+
*
|
|
126
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
127
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
128
|
+
* @returns A new `Chronos` instance representing the next weekend day, normalized to the start of that day.
|
|
129
|
+
*
|
|
130
|
+
* @description
|
|
131
|
+
* Moves forward one day at a time until a weekend day is reached.
|
|
132
|
+
*
|
|
133
|
+
* **Behavior:**
|
|
134
|
+
* - Weekend days are automatically determined from `weekStartsOn` and `weekendLength`.
|
|
135
|
+
* - The scan begins on the next calendar day.
|
|
136
|
+
* - Produces a new immutable `Chronos` instance, normalized to the start of the day.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* // Default weekend (Friday & Saturday)
|
|
140
|
+
* new Chronos('2025-01-23').nextWeekend();
|
|
141
|
+
*
|
|
142
|
+
* // Custom start of week (Monday) with 2-day weekend (Saturday & Sunday)
|
|
143
|
+
* new Chronos().nextWeekend(1, 2);
|
|
144
|
+
*
|
|
145
|
+
* // Custom 3-day weekend (Fri, Sat, Sun)
|
|
146
|
+
* new Chronos().nextWeekend(1, 3);
|
|
147
|
+
*/
|
|
148
|
+
nextWeekend(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): Chronos;
|
|
149
|
+
/**
|
|
150
|
+
* @instance Returns the next weekend day after the current date using custom weekend day indices.
|
|
151
|
+
*
|
|
152
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
153
|
+
* @returns A new `Chronos` instance representing the next weekend day, normalized to the start of that day.
|
|
154
|
+
*
|
|
155
|
+
* @description
|
|
156
|
+
* Moves ahead through the calendar until the date matches one of the provided `weekendDays`.
|
|
157
|
+
*
|
|
158
|
+
* **Behavior:**
|
|
159
|
+
* - `weekendDays` is used exactly as provided, skipping automatic weekend computation.
|
|
160
|
+
* - The search begins from the next day.
|
|
161
|
+
* - Always yields a new immutable `Chronos` instance, normalized to the start of the day.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* // Custom weekend days (Sunday, Friday, Saturday)
|
|
165
|
+
* new Chronos().nextWeekend([0, 5, 6]);
|
|
166
|
+
*/
|
|
167
|
+
nextWeekend(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): Chronos;
|
|
168
|
+
/**
|
|
169
|
+
* @instance Returns the previous workday before the current date using week start day and weekend length.
|
|
170
|
+
*
|
|
171
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
172
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
173
|
+
* @returns A new `Chronos` instance representing the previous workday, normalized to the start of that day.
|
|
174
|
+
*
|
|
175
|
+
* @description
|
|
176
|
+
* Moves backward one day at a time to find the nearest day that is **not** considered a weekend.
|
|
177
|
+
*
|
|
178
|
+
* **Behavior:**
|
|
179
|
+
* - Weekend days are automatically calculated from `weekStartsOn` and `weekendLength`.
|
|
180
|
+
* - The search begins on the day immediately before the current date.
|
|
181
|
+
* - Always returns a new immutable `Chronos` instance.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* // Default weekend (Friday & Saturday)
|
|
185
|
+
* new Chronos('2025-01-23').previousWorkday();
|
|
186
|
+
*
|
|
187
|
+
* // Custom start of week (Monday) with 2-day weekend (Saturday & Sunday)
|
|
188
|
+
* new Chronos().previousWorkday(1, 2);
|
|
189
|
+
*
|
|
190
|
+
* // Custom 3-day weekend (Fri, Sat, Sun)
|
|
191
|
+
* new Chronos().previousWorkday(1, 3);
|
|
192
|
+
*/
|
|
193
|
+
previousWorkday(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): Chronos;
|
|
194
|
+
/**
|
|
195
|
+
* @instance Returns the previous workday before the current date using custom weekend day indices.
|
|
196
|
+
*
|
|
197
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain between 1 and 4 elements.
|
|
198
|
+
* @returns A new `Chronos` instance representing the previous workday, normalized to the start of that day.
|
|
199
|
+
*
|
|
200
|
+
* @description
|
|
201
|
+
* Moves backward one day at a time until a day is reached that is **not** included in `weekendDays`.
|
|
202
|
+
*
|
|
203
|
+
* **Behavior:**
|
|
204
|
+
* - `weekendDays` is used directly and overrides any automatic weekend calculation.
|
|
205
|
+
* - The search starts from the day immediately before the current date.
|
|
206
|
+
* - Returns a new immutable `Chronos` instance every time.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* // Custom weekend days (Friday, Saturday, Sunday)
|
|
210
|
+
* new Chronos().previousWorkday([5, 6, 0]);
|
|
211
|
+
*/
|
|
212
|
+
previousWorkday(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): Chronos;
|
|
213
|
+
/**
|
|
214
|
+
* @instance Returns the previous weekend day before the current date using week start day and weekend length.
|
|
215
|
+
*
|
|
216
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
217
|
+
* @param weekendLength Optional. The number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
218
|
+
* @returns A new `Chronos` instance representing the previous weekend day, normalized to the start of that day.
|
|
219
|
+
*
|
|
220
|
+
* @description
|
|
221
|
+
* Moves backward one day at a time until a weekend day is reached.
|
|
222
|
+
*
|
|
223
|
+
* **Behavior:**
|
|
224
|
+
* - Weekend days are automatically determined from `weekStartsOn` and `weekendLength`.
|
|
225
|
+
* - The scan begins on the previous calendar day.
|
|
226
|
+
* - Produces a new immutable `Chronos` instance.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* // Default weekend (Friday & Saturday)
|
|
230
|
+
* new Chronos('2025-01-23').previousWeekend();
|
|
231
|
+
*
|
|
232
|
+
* // Custom start of week (Monday) with 2-day weekend (Saturday & Sunday)
|
|
233
|
+
* new Chronos().previousWeekend(1, 2);
|
|
234
|
+
*
|
|
235
|
+
* // Custom 3-day weekend (Fri, Sat, Sun)
|
|
236
|
+
* new Chronos().previousWeekend(1, 3);
|
|
237
|
+
*/
|
|
238
|
+
previousWeekend(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): Chronos;
|
|
239
|
+
/**
|
|
240
|
+
* @instance Returns the previous weekend day before the current date using custom weekend day indices.
|
|
241
|
+
*
|
|
242
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
243
|
+
* @returns A new `Chronos` instance representing the previous weekend day, normalized to the start of that day.
|
|
244
|
+
*
|
|
245
|
+
* @description
|
|
246
|
+
* Moves backward through the calendar until the date matches one of the provided `weekendDays`.
|
|
247
|
+
*
|
|
248
|
+
* **Behavior:**
|
|
249
|
+
* - `weekendDays` is used exactly as provided, skipping automatic weekend computation.
|
|
250
|
+
* - The search begins from the previous day.
|
|
251
|
+
* - Always yields a new immutable `Chronos` instance.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* // Custom weekend days (Sunday, Friday, Saturday)
|
|
255
|
+
* new Chronos().previousWeekend([0, 5, 6]);
|
|
256
|
+
*/
|
|
257
|
+
previousWeekend(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): Chronos;
|
|
258
|
+
/**
|
|
259
|
+
* @instance Calculates the number of workdays between the current date and another using week start day and weekend length.
|
|
260
|
+
*
|
|
261
|
+
* @param other The target date to compare against.
|
|
262
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
263
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
264
|
+
* @returns The total count of workdays between the two dates.
|
|
265
|
+
*
|
|
266
|
+
* @remarks This calculation is exclusive of the starting date and inclusive of the ending date.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* new Chronos('2025-12-15').workdaysBetween('2025-12-21');
|
|
270
|
+
* // default weekend Friday & Saturday -> 4
|
|
271
|
+
*/
|
|
272
|
+
workdaysBetween(other: ChronosInput, weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
273
|
+
/**
|
|
274
|
+
* @instance Calculates the number of workdays between the current date and another using custom weekend days.
|
|
275
|
+
*
|
|
276
|
+
* @param other The target date to compare against.
|
|
277
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
278
|
+
* @returns The total count of workdays between the two dates.
|
|
279
|
+
*
|
|
280
|
+
* @remarks This calculation is exclusive of the starting date and inclusive of the ending date.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* new Chronos('2025-12-15').workdaysBetween('2025-12-20', [0, 6]);
|
|
284
|
+
* // custom weekend Sunday & Saturday -> 4
|
|
285
|
+
*/
|
|
286
|
+
workdaysBetween(other: ChronosInput, weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
287
|
+
/**
|
|
288
|
+
* @instance Calculates the number of weekends between the current date and another using week start day and weekend length.
|
|
289
|
+
*
|
|
290
|
+
* @param other The target date to compare against.
|
|
291
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
292
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
293
|
+
* @returns The total count of weekends between the two dates.
|
|
294
|
+
*
|
|
295
|
+
* @remarks This calculation is exclusive of the starting date and inclusive of the ending date.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* new Chronos('2025-12-15').weekendsBetween('2025-12-21');
|
|
299
|
+
* // default weekend Friday & Saturday -> 2
|
|
300
|
+
*/
|
|
301
|
+
weekendsBetween(other: ChronosInput, weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
302
|
+
/**
|
|
303
|
+
* @instance Calculates the number of weekends between the current date and another using custom weekend days.
|
|
304
|
+
*
|
|
305
|
+
* @param other The target date to compare against.
|
|
306
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
307
|
+
* @returns The total count of weekends between the two dates.
|
|
308
|
+
*
|
|
309
|
+
* @remarks This calculation is exclusive of the starting date and inclusive of the ending date.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* new Chronos('2025-12-15').weekendsBetween('2025-12-20', [0, 6]);
|
|
313
|
+
* // custom weekend Sunday & Saturday -> 1
|
|
314
|
+
*/
|
|
315
|
+
weekendsBetween(other: ChronosInput, weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
316
|
+
/**
|
|
317
|
+
* @instance Counts the number of workdays in the current month using week start day and weekend length.
|
|
318
|
+
*
|
|
319
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
320
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
321
|
+
* @returns Number of workdays in the current month.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* new Chronos('2025-01-01').workdaysInMonth(); // default weekend Friday & Saturday -> 22
|
|
325
|
+
*/
|
|
326
|
+
workdaysInMonth(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
327
|
+
/**
|
|
328
|
+
* @instance Counts the number of workdays in the current month using custom weekend days.
|
|
329
|
+
*
|
|
330
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
331
|
+
* @returns Number of workdays in the current month.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* new Chronos('2025-01-01').workdaysInMonth([0, 6]); // Sunday & Saturday are weekends
|
|
335
|
+
*/
|
|
336
|
+
workdaysInMonth(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
337
|
+
/**
|
|
338
|
+
* @instance Counts the number of weekends in the current month using week start day and weekend length.
|
|
339
|
+
*
|
|
340
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
341
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1 and 4. Default is `2`.
|
|
342
|
+
* @returns Number of weekends in the current month.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* new Chronos('2025-01-01').weekendsInMonth(); // default weekend Friday & Saturday -> 8
|
|
346
|
+
*/
|
|
347
|
+
weekendsInMonth(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
348
|
+
/**
|
|
349
|
+
* @instance Counts the number of weekends in the current month using custom weekend days.
|
|
350
|
+
*
|
|
351
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
352
|
+
* @returns Number of weekends in the current month.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* new Chronos('2025-01-01').weekendsInMonth([0, 6]); // Sunday & Saturday are weekends
|
|
356
|
+
*/
|
|
357
|
+
weekendsInMonth(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
358
|
+
/**
|
|
359
|
+
* @instance Counts the number of workdays in the current year using week start day and weekend length.
|
|
360
|
+
*
|
|
361
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
362
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1–4. Default is `2`.
|
|
363
|
+
* @returns Number of workdays in the current year.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* new Chronos('2025-01-01').workdaysInYear(); // default weekend Friday & Saturday -> 261
|
|
367
|
+
*/
|
|
368
|
+
workdaysInYear(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
369
|
+
/**
|
|
370
|
+
* @instance Counts the number of workdays in the current year using custom weekend days.
|
|
371
|
+
*
|
|
372
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
373
|
+
* @returns Number of workdays in the current year.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* new Chronos('2025-01-01').workdaysInYear([0, 6]); // Sunday & Saturday are weekends
|
|
377
|
+
*/
|
|
378
|
+
workdaysInYear(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
379
|
+
/**
|
|
380
|
+
* @instance Counts the number of weekends in the current year using week start day and weekend length.
|
|
381
|
+
*
|
|
382
|
+
* @param weekStartsOn Optional. The day index (0–6) that the week starts on. Default is `0` (Sunday).
|
|
383
|
+
* @param weekendLength Optional. Number of consecutive days at the end of the week considered as weekend. Must be between 1–4. Default is `2`.
|
|
384
|
+
* @returns Number of weekends in the current year.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* new Chronos('2025-01-01').weekendsInYear(); // default weekend Friday & Saturday -> 104
|
|
388
|
+
*/
|
|
389
|
+
weekendsInYear(weekStartsOn?: Enumerate<7>, weekendLength?: NumberRange<1, 4>): number;
|
|
390
|
+
/**
|
|
391
|
+
* @instance Counts the number of weekends in the current year using custom weekend days.
|
|
392
|
+
*
|
|
393
|
+
* @param weekendDays A tuple of custom weekend day indices (0–6). Must contain 1–4 elements.
|
|
394
|
+
* @returns Number of weekends in the current year.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* new Chronos('2025-01-01').weekendsInYear([0, 6]); // Sunday & Saturday are weekends
|
|
398
|
+
*/
|
|
399
|
+
weekendsInYear(weekendDays: RangeTuple<Enumerate<7>, 1, 4>): number;
|
|
400
|
+
/**
|
|
401
|
+
* @instance Checks if the current time fall within business hours using week start day and weekend length & other options.
|
|
402
|
+
*
|
|
403
|
+
* @param options Options to configure business hour and weekends.
|
|
404
|
+
*
|
|
405
|
+
* @returns Whether the current time is within business hours.
|
|
406
|
+
*
|
|
407
|
+
* @remarks
|
|
408
|
+
* - Business hours are typically 9 AM to 5 PM on weekdays.
|
|
409
|
+
* - Supports standard and overnight business hours. Overnight means `end < start`.
|
|
410
|
+
* - Example: `businessStartHour = 22`, `businessEndHour = 6` will cover 10 PM to 6 AM next day.
|
|
411
|
+
*
|
|
412
|
+
* - *Weekends are determined by `weekStartsOn` and `weekendLength` using the {@link isWorkday} method.*
|
|
413
|
+
*/
|
|
414
|
+
isBusinessHour(options?: BusinessOptionsBasic): boolean;
|
|
415
|
+
/**
|
|
416
|
+
* @instance Checks if the current time fall within business hours using indices of weekend days & other options.
|
|
417
|
+
*
|
|
418
|
+
* @param options Options to configure business hour and weekends.
|
|
419
|
+
*
|
|
420
|
+
* @returns Whether the current time is within business hours.
|
|
421
|
+
*
|
|
422
|
+
* @remarks
|
|
423
|
+
* - Business hours are typically 9 AM to 5 PM on weekdays.
|
|
424
|
+
* - Supports standard and overnight business hours. Overnight means `end < start`.
|
|
425
|
+
* - Example: `businessStartHour = 22`, `businessEndHour = 6` will cover 10 PM to 6 AM next day.
|
|
426
|
+
*
|
|
427
|
+
* - *Weekends are determined by `weekendDays` tuple using the {@link isWorkday} method.*
|
|
428
|
+
*/
|
|
429
|
+
isBusinessHour(options?: BusinessOptionsWeekends): boolean;
|
|
430
|
+
/**
|
|
431
|
+
* @instance Returns the academic year based on a typical start in `July` and end in `June`.
|
|
432
|
+
* @returns The academic year in format `YYYY-YYYY`.
|
|
433
|
+
*/
|
|
434
|
+
toAcademicYear(): AcademicYear;
|
|
435
|
+
/**
|
|
436
|
+
* @instance Returns the fiscal quarter based on custom fiscal year start (defaults to July).
|
|
437
|
+
* @param startMonth - The fiscal year start month (1-12), default is July (`7`).
|
|
438
|
+
* @returns The fiscal quarter (1-4).
|
|
439
|
+
*/
|
|
440
|
+
toFiscalQuarter(startMonth?: NumberRange<1, 12>): Quarter;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/** * Plugin to inject `business` related methods */
|
|
444
|
+
declare const businessPlugin: ($Chronos: $Chronos) => void;
|
|
445
|
+
//#endregion
|
|
446
|
+
export { businessPlugin };
|