nhb-toolbox 3.9.39 → 3.9.60

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.
@@ -1,19 +1,96 @@
1
1
  import type { LocaleCode } from '../number/types';
2
2
  import { ORIGIN } from './constants';
3
- import type { ChronosMethods, ChronosObject, FormatOptions, StrictFormat, TimeUnit, TimeZone, UTCOffSet } from './types';
3
+ import type { ChronosInput, ChronosMethods, ChronosObject, DayPart, DayPartConfig, FormatOptions, StrictFormat, TimeUnit, TimeZone, UTCOffSet } from './types';
4
+ /**
5
+ * * Creates a new immutable `Chronos` instance.
6
+ *
7
+ * @param value - A date value (`number`, `string`, `Date`, or `Chronos` object).
8
+ * - If a string is provided, it should be in a format that can be parsed by the Date constructor.
9
+ * - If a number is provided, it should be a timestamp (milliseconds since the Unix epoch).
10
+ * - If a Date object is provided, it will be used as is.
11
+ * - If a Chronos object is provided, it will be converted to a Date object.
12
+ *
13
+ * **It also accepts number values as following:**
14
+ * - **`year, month, date, hours, minutes, seconds, milliseconds`**: Individual components of a date-time to construct a `Chronos` instance.
15
+ * - **`year`**: A number representing the year. If the year is between 0 and 99, it will be assumed to be the year 1900 + the provided year.
16
+ * - **`month`**: A number between 1 and 12 representing the month (1 for January, 12 for December). It is adjusted internally to a 0-based index (0 for January, 11 for December).
17
+ * - **`date`**: A number between 1 and 31 representing the day of the month.
18
+ * - **`hours`**: A number between 0 and 23 representing the hour of the day.
19
+ * - **`minutes`**: A number between 0 and 59 representing the minutes past the hour.
20
+ * - **`seconds`**: A number between 0 and 59 representing the seconds past the minute.
21
+ * - **`milliseconds`**: A number between 0 and 999 representing the milliseconds past the second.
22
+ *
23
+ * @returns Instance of `Chronos` with all methods and properties.
24
+ */
4
25
  export declare class Chronos {
5
26
  #private;
6
27
  [ORIGIN]?: ChronosMethods | 'root';
28
+ /**
29
+ * * Creates a new immutable `Chronos` instance.
30
+ *
31
+ * Accepts no arguments (defaults to now).
32
+ *
33
+ * @returns Instance of `Chronos` with all methods and properties.
34
+ */
35
+ constructor();
36
+ /**
37
+ * * Creates a new immutable `Chronos` instance.
38
+ *
39
+ * @param value - A date value in `number`, it should be a timestamp (milliseconds since the Unix epoch).
40
+ *
41
+ * @returns Instance of `Chronos` with all methods and properties.
42
+ */
43
+ constructor(value: number);
44
+ /**
45
+ * * Creates a new immutable `Chronos` instance.
46
+ *
47
+ * @param value - A date value in `string`, it should be in a format that can be parsed by the `Date` constructor.
48
+ *
49
+ * @returns Instance of `Chronos` with all methods and properties.
50
+ */
51
+ constructor(value: string);
52
+ /**
53
+ * * Creates a new immutable `Chronos` instance.
54
+ *
55
+ * @param value - A date value as `Date` object, it will be used as is.
56
+ *
57
+ * @returns Instance of `Chronos` with all methods and properties.
58
+ */
59
+ constructor(value: Date);
60
+ /**
61
+ * * Creates a new immutable `Chronos` instance.
62
+ *
63
+ * @param value - A date value as `Chronos` object.
64
+ *
65
+ * @returns Instance of `Chronos` with all methods and properties.
66
+ */
67
+ constructor(value: Chronos);
68
+ /**
69
+ * * Creates a new immutable `Chronos` instance.
70
+ *
71
+ * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
72
+ * @param month The month as a number between 1 and 12 (January to December).
73
+ * @param date The date as a number between 1 and 31.
74
+ * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
75
+ * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
76
+ * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
77
+ * @param ms A number from 0 to 999 that specifies the milliseconds.
78
+ *
79
+ * @returns Instance of `Chronos` with all methods and properties.
80
+ */
81
+ constructor(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number);
7
82
  /**
8
83
  * * Creates a new immutable `Chronos` instance.
9
84
  *
10
85
  * @param value - A date value (`number`, `string`, `Date`, or `Chronos` object).
11
- * - If a string is provided, it should be in a format that can be parsed by the Date constructor.
86
+ * - If a string is provided, it should be in a format that can be parsed by the `Date` constructor.
12
87
  * - If a number is provided, it should be a timestamp (milliseconds since the Unix epoch).
13
88
  * - If a Date object is provided, it will be used as is.
14
- * - If a Chronos object is provided, it will be converted to a Date object.
89
+ * - If a Chronos object is provided, it will be used directly.
90
+ *
91
+ * @returns Instance of `Chronos` with all methods and properties.
15
92
  */
16
- constructor(value?: number | string | Date | Chronos);
93
+ constructor(value?: ChronosInput);
17
94
  [Symbol.iterator](): IterableIterator<[string, number]>;
18
95
  /**
19
96
  * * Enables primitive coercion like `console.log`, `${chronos}`, etc.
@@ -47,42 +124,36 @@ export declare class Chronos {
47
124
  get isoMonth(): number;
48
125
  /** Gets the time value in milliseconds since midnight, January 1, 1970 UTC. */
49
126
  get unix(): number;
50
- /** @public @instance Returns a debug-friendly string for `console.log` or `util.inspect`. */
127
+ /** Gets the time value in milliseconds since midnight, January 1, 1970 UTC. */
128
+ get timestamp(): number;
129
+ /** @instance Returns a debug-friendly string for `console.log` or `util.inspect`. */
51
130
  inspect(): string;
52
- /** @public @instance Clones and returns a new Chronos instance with the same date. */
131
+ /** @instance Clones and returns a new Chronos instance with the same date. */
53
132
  clone(): Chronos;
54
- /** @public @instance Enables JSON.stringify and console logging to show readable output. */
133
+ /** @instance Enables JSON.stringify and console logging to show readable output. */
55
134
  toJSON(): string;
56
- /** @public @instance Enables arithmetic and comparison operations (e.g., +new Chronos()). */
135
+ /** @instance Enables arithmetic and comparison operations (e.g., +new Chronos()). */
57
136
  valueOf(): number;
58
- /** @public @instance Gets the native `Date` instance (read-only). */
137
+ /** @instance Gets the native `Date` instance (read-only). */
59
138
  toDate(): Date;
60
- /** @public @instance Returns a string representation of a date. The format of the string depends on the locale. */
139
+ /** @instance Returns a string representation of a date. The format of the string depends on the locale. */
61
140
  toString(): string;
62
- /** @public @instance Returns ISO string with local time zone offset */
141
+ /** @instance Returns ISO string with local time zone offset */
63
142
  toLocalISOString(): string;
64
- /** @public @instance Returns a date as a string value in ISO format. */
143
+ /** @instance Returns a date as a string value in ISO format. */
65
144
  toISOString(): string;
66
145
  /**
67
- * @public @instance Wrapper over native `toLocaleString`
146
+ * @instance Wrapper over native `toLocaleString`
68
147
  * @description Converts a date and time to a string by using the current or specified locale.
69
148
  *
70
149
  * @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
71
150
  * @param options An object that contains one or more properties that specify comparison options.
72
151
  */
73
152
  toLocaleString(locale?: LocaleCode | Intl.Locale | (LocaleCode | Intl.Locale)[], options?: Intl.DateTimeFormatOptions): string;
74
- /** @public @instance Returns the time value in milliseconds since midnight, January 1, 1970 UTC. */
153
+ /** @instance Returns the time value in milliseconds since midnight, January 1, 1970 UTC. */
75
154
  getTimeStamp(): number;
76
155
  /**
77
- * @public @instance Returns the current date and time in a specified format in local time.
78
- * @description Default format is dd, `mmm DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55:379`
79
- *
80
- * @param options - Configure format string and whether to format using utc offset.
81
- * @returns Formatted date string in desired format.
82
- */
83
- today(options?: FormatOptions): string;
84
- /**
85
- * @public @instance Formats the date into a custom string format (local time).
156
+ * @instance Formats the date into a custom string format (local time).
86
157
  *
87
158
  * @param format - The desired format (Default format is `dd, mmm DD, YYYY HH:mm:ss:mss` = `Sun, Apr 06, 2025 16:11:55:379`).
88
159
  * @param useUTC - Optional `useUTC` to get the formatted time using UTC Offset, defaults to `false`. Equivalent to `formatUTC()` method if set to `true`.
@@ -90,7 +161,7 @@ export declare class Chronos {
90
161
  */
91
162
  format(format?: string, useUTC?: boolean): string;
92
163
  /**
93
- * @public @instance Formats the date into a strict custom string format (local time).
164
+ * @instance Formats the date into a strict custom string format (local time).
94
165
  * @description Select from `21,000+` pre-defined formats.
95
166
  *
96
167
  * @param format - The desired format (Default format is `dd, mmm DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55`).
@@ -99,94 +170,94 @@ export declare class Chronos {
99
170
  */
100
171
  formatStrict(format?: StrictFormat, useUTC?: boolean): string;
101
172
  /**
102
- * @public @instance Formats the date into a custom string format (UTC time).
173
+ * @instance Formats the date into a custom string format (UTC time).
103
174
  *
104
175
  * @param format - The desired format (Default format is `dd, mmm DD, YYYY HH:mm:ss:mss` = `Sun, Apr 06, 2025 16:11:55:379`).
105
176
  * @returns Formatted date string in desired format (UTC time).
106
177
  */
107
178
  formatUTC(format?: string): string;
108
179
  /**
109
- * @public @instance Adds seconds and returns a new immutable instance.
180
+ * @instance Adds seconds and returns a new immutable instance.
110
181
  * @param seconds - Number of seconds to add.
111
182
  * @returns A new `Chronos` instance with the updated date.
112
183
  */
113
184
  addSeconds(seconds: number): Chronos;
114
185
  /**
115
- * @public @instance Adds minutes and returns a new immutable instance.
186
+ * @instance Adds minutes and returns a new immutable instance.
116
187
  * @param minutes - Number of minutes to add.
117
188
  * @returns A new `Chronos` instance with the updated date.
118
189
  */
119
190
  addMinutes(minutes: number): Chronos;
120
191
  /**
121
- * @public @instance Adds hours and returns a new immutable instance.
192
+ * @instance Adds hours and returns a new immutable instance.
122
193
  * @param hours - Number of hours to add.
123
194
  * @returns A new `Chronos` instance with the updated date.
124
195
  */
125
196
  addHours(hours: number): Chronos;
126
197
  /**
127
- * @public @instance Adds days and returns a new immutable instance.
198
+ * @instance Adds days and returns a new immutable instance.
128
199
  * @param days - Number of days to add.
129
200
  * @returns A new `Chronos` instance with the updated date.
130
201
  */
131
202
  addDays(days: number): Chronos;
132
203
  /**
133
- * @public @instance Adds weeks and returns a new immutable instance.
204
+ * @instance Adds weeks and returns a new immutable instance.
134
205
  * @param weeks - Number of weeks to add.
135
206
  * @returns A new `Chronos` instance with the updated date.
136
207
  */
137
208
  addWeeks(weeks: number): Chronos;
138
209
  /**
139
- * @public @instance Adds months and returns a new immutable instance.
210
+ * @instance Adds months and returns a new immutable instance.
140
211
  * @param months - Number of months to add.
141
212
  * @returns A new `Chronos` instance with the updated date.
142
213
  */
143
214
  addMonths(months: number): Chronos;
144
215
  /**
145
- * @public @instance Adds years and returns a new immutable instance.
216
+ * @instance Adds years and returns a new immutable instance.
146
217
  * @param years - Number of years to add.
147
218
  * @returns A new `Chronos` instance with the updated date.
148
219
  */
149
220
  addYears(years: number): Chronos;
150
221
  /**
151
- * @public @instance Create a new instance of `Chronos` in the specified timezone.
222
+ * @instance Create a new instance of `Chronos` in the specified timezone.
152
223
  *
153
224
  * @param zone - Standard timezone abbreviation (e.g., 'IST', 'UTC', 'EST') or UTC Offset in `UTC-01:30` format.
154
225
  * @returns A new instance of `Chronos` with time in the given timezone. Invalid input sets time-zone to `UTC`.
155
226
  */
156
227
  timeZone(zone: TimeZone | UTCOffSet): Chronos;
157
228
  /**
158
- * @public @instance Checks if the year is a leap year.
229
+ * @instance Checks if the year is a leap year.
159
230
  * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
160
231
  * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
161
232
  * @returns `true` if the year is a leap year, `false` otherwise.
162
233
  */
163
234
  isLeapYear(): boolean;
164
- /** @public @instance Checks if the current date is today. */
235
+ /** @instance Checks if the current date is today. */
165
236
  isToday(): boolean;
166
- /** @public @instance Checks if the current date is tomorrow. */
237
+ /** @instance Checks if the current date is tomorrow. */
167
238
  isTomorrow(): boolean;
168
- /** @public @instance Checks if the current date is yesterday. */
239
+ /** @instance Checks if the current date is yesterday. */
169
240
  isYesterday(): boolean;
170
241
  /**
171
- * @public @instance Checks if another date is the same as this one in a specific unit.
242
+ * @instance Checks if another date is the same as this one in a specific unit.
172
243
  * @param other The other date to compare.
173
244
  * @param unit The unit to compare.
174
245
  */
175
- isSame(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
246
+ isSame(other: ChronosInput, unit: TimeUnit): boolean;
176
247
  /**
177
- * @public @instance Checks if this date is before another date in a specific unit.
248
+ * @instance Checks if this date is before another date in a specific unit.
178
249
  * @param other The other date to compare.
179
250
  * @param unit The unit to compare.
180
251
  */
181
- isBefore(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
252
+ isBefore(other: ChronosInput, unit: TimeUnit): boolean;
182
253
  /**
183
- * @public @instance Checks if this date is after another date in a specific unit.
254
+ * @instance Checks if this date is after another date in a specific unit.
184
255
  * @param other The other date to compare.
185
256
  * @param unit The unit to compare.
186
257
  */
187
- isAfter(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
258
+ isAfter(other: ChronosInput, unit: TimeUnit): boolean;
188
259
  /**
189
- * @public @instance Checks if the current date is between the given start and end dates.
260
+ * @instance Checks if the current date is between the given start and end dates.
190
261
  *
191
262
  * @param start - The start of the range.
192
263
  * @param end - The end of the range.
@@ -198,32 +269,66 @@ export declare class Chronos {
198
269
  *
199
270
  * @returns `true` if the current date is within the specified range based on the `inclusive` mode.
200
271
  */
201
- isBetween(start: number | string | Date | Chronos, end: number | string | Date | Chronos, inclusive?: '[]' | '[)' | '(]' | '()'): boolean;
202
- /** @public @instance Checks if currently in DST */
272
+ isBetween(start: ChronosInput, end: ChronosInput, inclusive?: '[]' | '[)' | '(]' | '()'): boolean;
273
+ /** @instance Checks if currently in DST */
203
274
  isDST(): boolean;
204
275
  /**
205
- * @public @instance Returns full time difference from now (or a specified time) down to a given level.
276
+ * @instance Returns full time difference from now (or a specified time) down to a given level.
206
277
  *
207
278
  * @param level Determines the smallest unit to include in the output (e.g., 'minute' will show up to minutes, ignoring seconds). Defaults to `minute`.
208
279
  * @param withSuffixPrefix If `true`, adds `"in"` or `"ago"` depending on whether the time is in the future or past. Defaults to `true`.
209
280
  * @param time An optional time value to compare with (`string`, `number`, `Date`, or `Chronos` instance). Defaults to `now`.
210
281
  * @returns The difference as a human-readable string, e.g., `2 years 1 month 9 days 18 hours 56 minutes ago`.
211
282
  */
212
- fromNow(level?: Exclude<TimeUnit, 'millisecond'>, withSuffixPrefix?: boolean, time?: number | string | Date | Chronos): string;
283
+ fromNow(level?: Exclude<TimeUnit, 'millisecond'>, withSuffixPrefix?: boolean, time?: ChronosInput): string;
213
284
  /**
214
- * @public @instance Returns the number of full years between the input date and now.
285
+ * * Returns the part of day (`'midnight', 'lateNight', 'night', 'morning', 'afternoon', 'evening'`) based on the current hour.
286
+ *
287
+ * *Supports both normal and wraparound (overnight) ranges.*
288
+ *
289
+ * @param config - Optional custom hour ranges for each part of day.
290
+ * Each range must be a tuple of strings as `[startHour, endHour]` in 24-hour format (e.g., `['06', '11']`).
291
+ * Supports wraparound ranges like `['22', '04']` that cross midnight.
292
+ *
293
+ * **Default Ranges:**
294
+ * - night: ['21', '23']
295
+ * - midnight: ['00', '01']
296
+ * - lateNight: ['02', '04']
297
+ * - morning: ['05', '11']
298
+ * - afternoon: ['12', '16']
299
+ * - evening: ['17', '20']
300
+ *
301
+ * @returns The current part of the day as a string.
302
+ *
303
+ * @example
304
+ * chronosInstance.getPartOfDay(); // e.g., 'morning'
305
+ *
306
+ * @example
307
+ * // Example with custom ranges
308
+ * chronosInstance.getPartOfDay({
309
+ * night: ['22', '04'],
310
+ * morning: ['05', '11'],
311
+ * afternoon: ['12', '16'],
312
+ * evening: ['17', '21'],
313
+ * lateNight: ['01', '03'],
314
+ * midnight: ['00', '00'],
315
+ * });
316
+ */
317
+ getPartOfDay(config?: Partial<DayPartConfig>): DayPart;
318
+ /**
319
+ * @instance Returns the number of full years between the input date and now.
215
320
  * @param time Optional time to compare with the `Chronos` date/time.
216
321
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
217
322
  */
218
- getRelativeYear(time?: number | string | Date | Chronos): number;
323
+ getRelativeYear(time?: ChronosInput): number;
219
324
  /**
220
- * @public @instance Returns the number of full months between the input date and now.
325
+ * @instance Returns the number of full months between the input date and now.
221
326
  * @param time Optional time to compare with the `Chronos` date/time.
222
327
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
223
328
  */
224
- getRelativeMonth(time?: number | string | Date | Chronos): number;
329
+ getRelativeMonth(time?: ChronosInput): number;
225
330
  /**
226
- * @public @instance Determines if the given date is today, tomorrow, yesterday or any relative day.
331
+ * @instance Determines if the given date is today, tomorrow, yesterday or any relative day.
227
332
  * @param date - The date to compare (Date object).
228
333
  * @param time Optional time to compare with the `Chronos` date/time.
229
334
  * @returns
@@ -232,93 +337,93 @@ export declare class Chronos {
232
337
  * - `1` if the date is tomorrow.
233
338
  * - Other positive or negative numbers for other relative days (e.g., `-2` for two days ago, `2` for two days ahead).
234
339
  */
235
- getRelativeDay(time?: number | string | Date | Chronos): number;
340
+ getRelativeDay(time?: ChronosInput): number;
236
341
  /**
237
- * @public @instance Determines how many full weeks apart the input date is from the `Chronos` instance.
342
+ * @instance Determines how many full weeks apart the input date is from the `Chronos` instance.
238
343
  * @param time Optional time to compare with the `Chronos` date/time.
239
344
  * @returns Difference in weeks; negative if past, positive if future.
240
345
  */
241
- getRelativeWeek(time?: number | string | Date | Chronos): number;
346
+ getRelativeWeek(time?: ChronosInput): number;
242
347
  /**
243
- * @public @instance Returns the number of full hours between the input date and now.
348
+ * @instance Returns the number of full hours between the input date and now.
244
349
  * @param time Optional time to compare with the `Chronos` date/time.
245
350
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
246
351
  */
247
- getRelativeHour(time?: number | string | Date | Chronos): number;
352
+ getRelativeHour(time?: ChronosInput): number;
248
353
  /**
249
- * @public @instance Returns the number of full minutes between the input date and now.
354
+ * @instance Returns the number of full minutes between the input date and now.
250
355
  * @param time Optional time to compare with the `Chronos` date/time.
251
356
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
252
357
  */
253
- getRelativeMinute(time?: number | string | Date | Chronos): number;
358
+ getRelativeMinute(time?: ChronosInput): number;
254
359
  /**
255
- * @public @instance Returns the number of full seconds between the input date and now.
360
+ * @instance Returns the number of full seconds between the input date and now.
256
361
  * @param time Optional time to compare with the `Chronos` date/time.
257
362
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
258
363
  */
259
- getRelativeSecond(time?: number | string | Date | Chronos): number;
364
+ getRelativeSecond(time?: ChronosInput): number;
260
365
  /**
261
- * @public @instance Returns the number of milliseconds between the input date and now.
366
+ * @instance Returns the number of milliseconds between the input date and now.
262
367
  * @param time Optional time to compare with the `Chronos` date/time.
263
368
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
264
369
  */
265
- getRelativeMilliSecond(time?: number | string | Date | Chronos): number;
370
+ getRelativeMilliSecond(time?: ChronosInput): number;
266
371
  /**
267
- * @public @instance Compares the stored date with now, returning the difference in the specified unit.
372
+ * @instance Compares the stored date with now, returning the difference in the specified unit.
268
373
  *
269
374
  * @param unit The time unit to compare by. Defaults to 'minute'.
270
375
  * @param time Optional time to compare with the `Chronos` date/time.
271
376
  * @returns The difference in number, negative is `Chronos` time is a past time else positive.
272
377
  */
273
- compare(unit?: TimeUnit, time?: number | string | Date | Chronos): number;
378
+ compare(unit?: TimeUnit, time?: ChronosInput): number;
274
379
  /**
275
- * @public @instance Returns a new Chronos instance at the start of a given unit.
380
+ * @instance Returns a new Chronos instance at the start of a given unit.
276
381
  * @param unit The unit to reset (e.g., year, month, day).
277
382
  */
278
383
  startOf(unit: TimeUnit): Chronos;
279
384
  /**
280
- * @public @instance Returns a new Chronos instance at the end of a given unit.
385
+ * @instance Returns a new Chronos instance at the end of a given unit.
281
386
  * @param unit The unit to adjust (e.g., year, month, day).
282
387
  */
283
388
  endOf(unit: TimeUnit): Chronos;
284
389
  /**
285
- * @public @instance Returns a new Chronos instance with the specified unit added.
390
+ * @instance Returns a new Chronos instance with the specified unit added.
286
391
  * @param amount The amount to add (can be negative).
287
392
  * @param unit The time unit to add.
288
393
  */
289
394
  add(amount: number, unit: TimeUnit): Chronos;
290
395
  /**
291
- * @public @instance Returns a new Chronos instance with the specified unit subtracted.
396
+ * @instance Returns a new Chronos instance with the specified unit subtracted.
292
397
  * @param amount The amount to subtract (can be negative).
293
398
  * @param unit The time unit to add.
294
399
  */
295
400
  subtract(amount: number, unit: TimeUnit): Chronos;
296
401
  /**
297
- * @public @instance Gets the value of a specific time unit from the date.
402
+ * @instance Gets the value of a specific time unit from the date.
298
403
  * @param unit The unit to retrieve.
299
404
  */
300
405
  get(unit: TimeUnit): number;
301
406
  /**
302
- * @public @instance Returns a new Chronos instance with the specified unit set to the given value.
407
+ * @instance Returns a new Chronos instance with the specified unit set to the given value.
303
408
  * @param unit The unit to modify.
304
409
  * @param value The value to set for the unit.
305
410
  */
306
411
  set(unit: TimeUnit, value: number): Chronos;
307
412
  /**
308
- * @public @instance Returns the difference between this and another date in the given unit.
413
+ * @instance Returns the difference between this and another date in the given unit.
309
414
  * @param other The other date to compare.
310
415
  * @param unit The unit in which to return the difference.
311
416
  */
312
- diff(other: number | string | Date | Chronos, unit: TimeUnit): number;
417
+ diff(other: ChronosInput, unit: TimeUnit): number;
313
418
  /**
314
- * @public @instance Returns a human-readable relative calendar time like "Today at 3:00 PM"
419
+ * @instance Returns a human-readable relative calendar time like "Today at 3:00 PM"
315
420
  * @param baseDate Optional base date to compare with.
316
421
  */
317
- calendar(baseDate?: number | string | Date | Chronos): string;
318
- /** @public @instance Returns a short human-readable string like "2h ago", "in 5m" */
422
+ calendar(baseDate?: ChronosInput): string;
423
+ /** @instance Returns a short human-readable string like "2h ago", "in 5m" */
319
424
  fromNowShort(): string;
320
425
  /**
321
- * @public @instance Sets the date to the Monday of the specified ISO week number within the current year.
426
+ * @instance Sets the date to the Monday of the specified ISO week number within the current year.
322
427
  * This method assumes ISO week logic, where week 1 is the week containing January 4th.
323
428
  *
324
429
  * @param week The ISO week number (1–53) to set the date to.
@@ -326,41 +431,28 @@ export declare class Chronos {
326
431
  */
327
432
  setWeek(week: number): Chronos;
328
433
  /**
329
- * @public @instance Calculates the ISO week number of the year.
434
+ * @instance Calculates the ISO week number of the year.
330
435
  * @returns Week number (1-53).
331
436
  */
332
437
  getWeek(): number;
333
- /** @public @instance Returns ISO week year */
438
+ /** @instance Returns ISO week year */
334
439
  getWeekYear(): number;
335
- /** @public @instance Returns day of year (1 - 366) */
440
+ /** @instance Returns day of year (1 - 366) */
336
441
  getDayOfYear(): number;
337
- /** @public @instance Returns number of days in current month */
442
+ /** @instance Returns number of days in current month */
338
443
  daysInMonth(): number;
339
- /** @public @instance Converts to object with all date unit parts */
444
+ /** @instance Converts to object with all date unit parts */
340
445
  toObject(): ChronosObject;
341
- /** @public @instance Converts to array with all date unit parts */
446
+ /** @instance Converts to array with all date unit parts */
342
447
  toArray(): any[];
343
- /** @public @instance Returns offset like +06:00 */
448
+ /** @instance Returns offset like +06:00 */
344
449
  getUTCOffset(): string;
345
- /** @public @instance Returns new Chronos instance in UTC */
450
+ /** @instance Returns new Chronos instance in UTC */
346
451
  toUTC(): Chronos;
347
- /** @public @instance Returns new Chronos instance in local time */
452
+ /** @instance Returns new Chronos instance in local time */
348
453
  toLocal(): Chronos;
349
454
  /**
350
- * @public @static Returns the current date and time in a specified format in local time.
351
- * * Default format is dd, `mmm DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55:379`
352
- * @param options - Configure format string and whether to format using utc offset.
353
- * @returns Formatted date string in desired format.
354
- */
355
- static today(options?: FormatOptions): string;
356
- /**
357
- * @public @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
358
- * * It basically calls `Date.now()`.
359
- * @returns The number of milliseconds elapsed since the Unix epoch.
360
- */
361
- static now(): number;
362
- /**
363
- * @public @static Parses a date string with a given format (partial support)
455
+ * @static Parses a date string with a given format (partial support)
364
456
  *
365
457
  * * **Supported format tokens**:
366
458
  * - `YYYY`: Full year (e.g., 2023)
@@ -377,29 +469,54 @@ export declare class Chronos {
377
469
  * // returns Chronos instance with the parsed date 2023-12-31T15:30:45
378
470
  * ```
379
471
  *
380
- * @param {string} dateStr - The date string to be parsed
381
- * @param {string} format - The format of the date string. Tokens like `YYYY`, `MM`, `DD`, `HH`, `mm`, `ss` are used to specify the structure.
382
- * @returns {Chronos} - A new `Chronos` instance representing the parsed date.
383
- * @throws {Error} - If the date string does not match the format.
472
+ * @param dateStr - The date string to be parsed
473
+ * @param format - The format of the date string. Tokens like `YYYY`, `MM`, `DD`, `HH`, `mm`, `ss` are used to specify the structure.
474
+ * @returns A new `Chronos` instance representing the parsed date.
475
+ * @throws `Error` If the date string does not match the format.
384
476
  */
385
477
  static parse(dateStr: string, format: string): Chronos;
386
478
  /**
387
- * @public @static Creates UTC Chronos
479
+ * @static Returns the current date and time in a specified format in local time.
480
+ * * Default format is dd, `mmm DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55`
481
+ * @param options - Configure format string and whether to format using utc offset.
482
+ * @returns Formatted date string in desired format.
483
+ */
484
+ static today(options?: FormatOptions): string;
485
+ /**
486
+ * @static Returns a new `Chronos` instance representing yesterday's date.
487
+ *
488
+ * @returns A `Chronos` instance for the previous calendar day.
489
+ */
490
+ static yesterday(): Chronos;
491
+ /**
492
+ * @static Returns a new `Chronos` instance representing tomorrow's date.
493
+ *
494
+ * @returns A `Chronos` instance for the next calendar day.
495
+ */
496
+ static tomorrow(): Chronos;
497
+ /**
498
+ * @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
499
+ * * It basically calls `Date.now()`.
500
+ * @returns The number of milliseconds elapsed since the Unix epoch.
501
+ */
502
+ static now(): number;
503
+ /**
504
+ * @static Creates UTC Chronos
388
505
  * @param dateLike Date input to create utc time.
389
506
  */
390
- static utc(dateLike: number | string | Date | Chronos): Chronos;
507
+ static utc(dateLike: ChronosInput): Chronos;
391
508
  /**
392
- * @public @static Returns earliest Chronos
509
+ * @static Returns earliest Chronos
393
510
  * @param dates Date inputs.
394
511
  */
395
- static min(...dates: (number | string | Date | Chronos)[]): Chronos;
512
+ static min(...dates: ChronosInput[]): Chronos;
396
513
  /**
397
- * @public @static Returns latest Chronos
514
+ * @static Returns latest Chronos
398
515
  * @param dates Date inputs.
399
516
  */
400
- static max(...dates: (number | string | Date | Chronos)[]): Chronos;
517
+ static max(...dates: ChronosInput[]): Chronos;
401
518
  /**
402
- * @public @static Checks if the year in the date string or year (from 0 - 9999) is a leap year.
519
+ * @static Checks if the year in the date string or year (from 0 - 9999) is a leap year.
403
520
  * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
404
521
  * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
405
522
  *
@@ -413,9 +530,9 @@ export declare class Chronos {
413
530
  * @param date - A `number` (year or Unix timestamp), `string`, `Date`, or `Chronos` instance representing a date.
414
531
  * @returns `true` if the year is a leap year, `false` otherwise.
415
532
  */
416
- static isLeapYear(date: number | string | Date | Chronos): boolean;
533
+ static isLeapYear(date: ChronosInput): boolean;
417
534
  /**
418
- * @public @static Checks if the given value is a valid `Date` object.
535
+ * @static Checks if the given value is a valid `Date` object.
419
536
  * - A value is considered valid if it is an instance of the built-in `Date` class.
420
537
  * - This does not check whether the date itself is valid (e.g., `new Date('invalid')`).
421
538
  * @param value - The value to test.
@@ -423,7 +540,7 @@ export declare class Chronos {
423
540
  */
424
541
  static isValidDate(value: unknown): value is Date;
425
542
  /**
426
- * @public @static Checks if the given value is a valid date string.
543
+ * @static Checks if the given value is a valid date string.
427
544
  * - A value is considered a valid date string if it is a string and can be parsed by `Date.parse()`.
428
545
  * - This uses the native JavaScript date parser internally.
429
546
  * @param value - The value to test.
@@ -431,7 +548,7 @@ export declare class Chronos {
431
548
  */
432
549
  static isDateString(value: unknown): value is string;
433
550
  /**
434
- * @public @static Checks if the given value is an instance of `Chronos`.
551
+ * @static Checks if the given value is an instance of `Chronos`.
435
552
  * - Useful for verifying Chronos objects in type guards or validations.
436
553
  * @param value - The value to test.
437
554
  * @returns `true` if the value is an instance of `Chronos`, otherwise `false`.