speexjs-core 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/CONTRIBUTING.md +55 -0
  3. package/PUBLISH.md +45 -0
  4. package/README.md +174 -0
  5. package/ROADMAP.md +72 -0
  6. package/SECURITY.md +35 -0
  7. package/SUMMARY.md +321 -0
  8. package/dist/async/index.d.ts +232 -0
  9. package/dist/async/index.js +366 -0
  10. package/dist/async/index.js.map +1 -0
  11. package/dist/collection/index.d.ts +230 -0
  12. package/dist/collection/index.js +375 -0
  13. package/dist/collection/index.js.map +1 -0
  14. package/dist/color/index.d.ts +128 -0
  15. package/dist/color/index.js +167 -0
  16. package/dist/color/index.js.map +1 -0
  17. package/dist/core/index.d.ts +119 -0
  18. package/dist/core/index.js +324 -0
  19. package/dist/core/index.js.map +1 -0
  20. package/dist/crypto/index.d.ts +84 -0
  21. package/dist/crypto/index.js +144 -0
  22. package/dist/crypto/index.js.map +1 -0
  23. package/dist/date/index.d.ts +588 -0
  24. package/dist/date/index.js +737 -0
  25. package/dist/date/index.js.map +1 -0
  26. package/dist/dep-exray/analyzer/index.d.ts +7 -0
  27. package/dist/dep-exray/analyzer/index.js +68 -0
  28. package/dist/dep-exray/analyzer/index.js.map +1 -0
  29. package/dist/dep-exray/cli.d.ts +1 -0
  30. package/dist/dep-exray/cli.js +441 -0
  31. package/dist/dep-exray/cli.js.map +1 -0
  32. package/dist/dep-exray/index.d.ts +5 -0
  33. package/dist/dep-exray/index.js +454 -0
  34. package/dist/dep-exray/index.js.map +1 -0
  35. package/dist/dep-exray/known-mappings.d.ts +17 -0
  36. package/dist/dep-exray/known-mappings.js +122 -0
  37. package/dist/dep-exray/known-mappings.js.map +1 -0
  38. package/dist/dep-exray/reporter/index.d.ts +5 -0
  39. package/dist/dep-exray/reporter/index.js +89 -0
  40. package/dist/dep-exray/reporter/index.js.map +1 -0
  41. package/dist/dep-exray/scanner/index.d.ts +5 -0
  42. package/dist/dep-exray/scanner/index.js +299 -0
  43. package/dist/dep-exray/scanner/index.js.map +1 -0
  44. package/dist/dep-exray/types.d.ts +38 -0
  45. package/dist/dep-exray/types.js +1 -0
  46. package/dist/dep-exray/types.js.map +1 -0
  47. package/dist/error/index.d.ts +148 -0
  48. package/dist/error/index.js +115 -0
  49. package/dist/error/index.js.map +1 -0
  50. package/dist/index-BgG21uJC.d.ts +166 -0
  51. package/dist/index.d.ts +19 -0
  52. package/dist/index.js +4378 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/io/index.d.ts +39 -0
  55. package/dist/io/index.js +111 -0
  56. package/dist/io/index.js.map +1 -0
  57. package/dist/logger/index.d.ts +1 -0
  58. package/dist/logger/index.js +214 -0
  59. package/dist/logger/index.js.map +1 -0
  60. package/dist/logger/transports.d.ts +1 -0
  61. package/dist/logger/transports.js +122 -0
  62. package/dist/logger/transports.js.map +1 -0
  63. package/dist/math/index.d.ts +362 -0
  64. package/dist/math/index.js +372 -0
  65. package/dist/math/index.js.map +1 -0
  66. package/dist/path/index.d.ts +81 -0
  67. package/dist/path/index.js +134 -0
  68. package/dist/path/index.js.map +1 -0
  69. package/dist/string/index.d.ts +234 -0
  70. package/dist/string/index.js +411 -0
  71. package/dist/string/index.js.map +1 -0
  72. package/dist/type/index.d.ts +85 -0
  73. package/dist/type/index.js +107 -0
  74. package/dist/type/index.js.map +1 -0
  75. package/dist/validation/index.d.ts +203 -0
  76. package/dist/validation/index.js +402 -0
  77. package/dist/validation/index.js.map +1 -0
  78. package/package.json +172 -0
@@ -0,0 +1,588 @@
1
+ /**
2
+ * Error thrown when a date value is invalid.
3
+ */
4
+ declare class InvalidDateError extends Error {
5
+ constructor(input: unknown);
6
+ }
7
+ interface DateDiff {
8
+ years: number;
9
+ months: number;
10
+ days: number;
11
+ hours: number;
12
+ minutes: number;
13
+ seconds: number;
14
+ }
15
+ /**
16
+ * Formats a Date to a string using the given format pattern.
17
+ *
18
+ * Supported tokens:
19
+ * - `YYYY` — 4-digit year
20
+ * - `YY` — 2-digit year
21
+ * - `MMMM` — full month name
22
+ * - `MMM` — abbreviated month name
23
+ * - `MM` — 2-digit month (01–12)
24
+ * - `DD` — 2-digit day (01–31)
25
+ * - `HH` — 2-digit hours (00–23)
26
+ * - `mm` — 2-digit minutes
27
+ * - `ss` — 2-digit seconds
28
+ * - `SSS` — milliseconds
29
+ *
30
+ * @param date - The date to format.
31
+ * @param format - The format string (default `'YYYY-MM-DD'`).
32
+ * @returns The formatted date string.
33
+ */
34
+ declare function formatDate(date: Date, format?: string): string;
35
+ /**
36
+ * Parses a date from a string, number (timestamp in ms), or Date object.
37
+ *
38
+ * Supported string formats:
39
+ * - ISO (`YYYY-MM-DD`, `YYYY-MM-DDTHH:mm:ss`)
40
+ * - `DD/MM/YYYY` or `DD-MM-YYYY`
41
+ * - `DD MMM YYYY` or `DD MMMM YYYY`
42
+ * - Unix timestamp (milliseconds)
43
+ *
44
+ * @param input - The value to parse.
45
+ * @returns A valid Date object.
46
+ * @throws {InvalidDateError} If the input cannot be parsed.
47
+ */
48
+ declare function parseDate(input: string | number | Date): Date;
49
+ /**
50
+ * Computes the difference between two dates.
51
+ *
52
+ * @param date1 - Start date.
53
+ * @param date2 - End date.
54
+ * @returns An object with years, months, days, hours, minutes, seconds.
55
+ * @throws {InvalidDateError} If either date is invalid.
56
+ */
57
+ declare function dateDiff(date1: Date, date2: Date): DateDiff;
58
+ /**
59
+ * Adds days to a date.
60
+ *
61
+ * @param date - The original date.
62
+ * @param days - Number of days to add (negative to subtract).
63
+ * @returns A new Date.
64
+ * @throws {InvalidDateError} If the input date is invalid.
65
+ */
66
+ declare function addDays(date: Date, days: number): Date;
67
+ /**
68
+ * Adds months to a date. Handles month-end overflow (e.g., Jan 31 + 1 month
69
+ * becomes Feb 28).
70
+ *
71
+ * @param date - The original date.
72
+ * @param months - Number of months to add (negative to subtract).
73
+ * @returns A new Date.
74
+ * @throws {InvalidDateError} If the input date is invalid.
75
+ */
76
+ declare function addMonths(date: Date, months: number): Date;
77
+ /**
78
+ * Adds years to a date. Handles leap-year overflow (e.g., Feb 29 + 1 year
79
+ * becomes Feb 28).
80
+ *
81
+ * @param date - The original date.
82
+ * @param years - Number of years to add (negative to subtract).
83
+ * @returns A new Date.
84
+ * @throws {InvalidDateError} If the input date is invalid.
85
+ */
86
+ declare function addYears(date: Date, years: number): Date;
87
+ /**
88
+ * Returns the start of the day (00:00:00.000) for the given date.
89
+ *
90
+ * @param date - The date.
91
+ * @returns A new Date set to midnight.
92
+ * @throws {InvalidDateError} If the input date is invalid.
93
+ */
94
+ declare function startOfDay(date: Date): Date;
95
+ /**
96
+ * Returns the end of the day (23:59:59.999) for the given date.
97
+ *
98
+ * @param date - The date.
99
+ * @returns A new Date set to the last millisecond of the day.
100
+ * @throws {InvalidDateError} If the input date is invalid.
101
+ */
102
+ declare function endOfDay(date: Date): Date;
103
+ /**
104
+ * Returns the first moment of the month for the given date.
105
+ *
106
+ * @param date - The date.
107
+ * @returns A new Date set to the start of the month.
108
+ * @throws {InvalidDateError} If the input date is invalid.
109
+ */
110
+ declare function startOfMonth(date: Date): Date;
111
+ /**
112
+ * Returns the last moment of the month for the given date.
113
+ *
114
+ * @param date - The date.
115
+ * @returns A new Date set to the end of the month.
116
+ * @throws {InvalidDateError} If the input date is invalid.
117
+ */
118
+ declare function endOfMonth(date: Date): Date;
119
+ /**
120
+ * Returns the first moment of the year for the given date.
121
+ *
122
+ * @param date - The date.
123
+ * @returns A new Date set to Jan 1 00:00:00.000.
124
+ * @throws {InvalidDateError} If the input date is invalid.
125
+ */
126
+ declare function startOfYear(date: Date): Date;
127
+ /**
128
+ * Returns the last moment of the year for the given date.
129
+ *
130
+ * @param date - The date.
131
+ * @returns A new Date set to Dec 31 23:59:59.999.
132
+ * @throws {InvalidDateError} If the input date is invalid.
133
+ */
134
+ declare function endOfYear(date: Date): Date;
135
+ /**
136
+ * Checks if the date falls on a weekend (Saturday or Sunday).
137
+ *
138
+ * @param date - The date to check.
139
+ * @returns Whether the date is a weekend.
140
+ * @throws {InvalidDateError} If the input date is invalid.
141
+ */
142
+ declare function isWeekend(date: Date): boolean;
143
+ /**
144
+ * Checks if a year is a leap year.
145
+ *
146
+ * @param year - The year to check.
147
+ * @returns Whether the year is a leap year.
148
+ */
149
+ declare function isLeapYear(year: number): boolean;
150
+ /**
151
+ * Checks if `date1` is before `date2`.
152
+ *
153
+ * @param date1 - First date.
154
+ * @param date2 - Second date.
155
+ * @returns Whether `date1` is before `date2`.
156
+ * @throws {InvalidDateError} If either date is invalid.
157
+ */
158
+ declare function isBefore(date1: Date, date2: Date): boolean;
159
+ /**
160
+ * Checks if `date1` is after `date2`.
161
+ *
162
+ * @param date1 - First date.
163
+ * @param date2 - Second date.
164
+ * @returns Whether `date1` is after `date2`.
165
+ * @throws {InvalidDateError} If either date is invalid.
166
+ */
167
+ declare function isAfter(date1: Date, date2: Date): boolean;
168
+ /**
169
+ * Checks if a date is within the inclusive range [start, end].
170
+ *
171
+ * @param date - The date to check.
172
+ * @param start - Start of the range.
173
+ * @param end - End of the range.
174
+ * @returns Whether the date is between start and end.
175
+ * @throws {InvalidDateError} If any date is invalid.
176
+ */
177
+ declare function isBetween(date: Date, start: Date, end: Date): boolean;
178
+ /**
179
+ * Checks if a date is a business day (Monday to Friday).
180
+ *
181
+ * @param date - The date to check.
182
+ * @returns Whether the date is a business day.
183
+ */
184
+ declare function isBusinessDay(date: Date): boolean;
185
+ /**
186
+ * Adds business days (skipping weekends) to a date.
187
+ *
188
+ * @param date - The starting date.
189
+ * @param days - Number of business days to add (negative to subtract).
190
+ * @returns A new Date.
191
+ * @throws {InvalidDateError} If the input date is invalid.
192
+ */
193
+ declare function addBusinessDays(date: Date, days: number): Date;
194
+ /**
195
+ * Calculates age in years from a birth date.
196
+ *
197
+ * @param birthDate - The date of birth.
198
+ * @returns The age in years.
199
+ * @throws {InvalidDateError} If the birth date is invalid.
200
+ */
201
+ declare function calculateAge(birthDate: Date): number;
202
+ /**
203
+ * Returns a human-readable relative time string (e.g. "5 menit yang lalu").
204
+ *
205
+ * @param date - The past date.
206
+ * @param options - Options with locale ('id' by default, 'en' supported).
207
+ * @returns A relative time string.
208
+ */
209
+ declare function timeAgo(date: Date, options?: {
210
+ locale?: string;
211
+ }): string;
212
+ /**
213
+ * Shows the time remaining until a future date.
214
+ *
215
+ * @param target - The target future date.
216
+ * @param options - Options with locale ('id' by default, 'en' supported).
217
+ * @returns A relative time string.
218
+ */
219
+ declare function timeRemaining(target: Date, options?: {
220
+ locale?: string;
221
+ }): string;
222
+ /**
223
+ * Represents a duration split into calendar and time components.
224
+ */
225
+ interface Duration {
226
+ years: number;
227
+ months: number;
228
+ days: number;
229
+ hours: number;
230
+ minutes: number;
231
+ seconds: number;
232
+ }
233
+ /**
234
+ * Formats a Duration object into a human-readable string.
235
+ *
236
+ * @example
237
+ * formatDuration({ hours: 2, minutes: 30, seconds: 15 }) // "2 jam 30 menit 15 detik"
238
+ * formatDuration({ hours: 2, minutes: 30 }, { locale: 'en' }) // "2 hours 30 minutes"
239
+ *
240
+ * @param duration - The duration to format.
241
+ * @param options - Options with locale ('id' by default, 'en' supported).
242
+ * @returns A formatted duration string.
243
+ */
244
+ declare function formatDuration(duration: Duration, options?: {
245
+ locale?: string;
246
+ }): string;
247
+ /** UTC+7 — Western Indonesia Time (WIB). */
248
+ declare const TIMEZONE_WIB = 7;
249
+ /** UTC+8 — Central Indonesia Time (WITA). */
250
+ declare const TIMEZONE_WITA = 8;
251
+ /** UTC+9 — Eastern Indonesia Time (WIT). */
252
+ declare const TIMEZONE_WIT = 9;
253
+ /**
254
+ * Converts a date to a specific timezone offset by returning a new Date whose
255
+ * local-time getters (getHours, getMinutes etc.) reflect the target timezone.
256
+ *
257
+ * @param date - The source date.
258
+ * @param offsetHours - The timezone offset in hours (e.g. 7 for WIB).
259
+ * @returns A new Date adjusted to the target timezone.
260
+ * @throws {InvalidDateError} If the input date is invalid.
261
+ */
262
+ declare function toTimezone(date: Date, offsetHours: number): Date;
263
+ /**
264
+ * Formats a date in a specific timezone using `formatDate` tokens.
265
+ *
266
+ * @param date - The source date.
267
+ * @param format - The format string (see `formatDate` for supported tokens).
268
+ * @param offsetHours - The timezone offset in hours.
269
+ * @returns The formatted date string.
270
+ */
271
+ declare function formatInTimezone(date: Date, format: string, offsetHours: number): string;
272
+ /**
273
+ * Checks if a date is today.
274
+ *
275
+ * @param date - The date to check.
276
+ * @returns Whether the date is today.
277
+ * @throws {InvalidDateError} If the input date is invalid.
278
+ *
279
+ * @example
280
+ * isToday(new Date()) // true
281
+ */
282
+ declare function isToday(date: Date): boolean;
283
+ /**
284
+ * Checks if a date is yesterday.
285
+ *
286
+ * @param date - The date to check.
287
+ * @returns Whether the date is yesterday.
288
+ * @throws {InvalidDateError} If the input date is invalid.
289
+ *
290
+ * @example
291
+ * isYesterday(new Date(Date.now() - 86400000)) // true
292
+ */
293
+ declare function isYesterday(date: Date): boolean;
294
+ /**
295
+ * Checks if a date is tomorrow.
296
+ *
297
+ * @param date - The date to check.
298
+ * @returns Whether the date is tomorrow.
299
+ * @throws {InvalidDateError} If the input date is invalid.
300
+ *
301
+ * @example
302
+ * isTomorrow(new Date(Date.now() + 86400000)) // true
303
+ */
304
+ declare function isTomorrow(date: Date): boolean;
305
+ /**
306
+ * Checks if a date is in the past (before now).
307
+ *
308
+ * @param date - The date to check.
309
+ * @returns Whether the date is in the past.
310
+ * @throws {InvalidDateError} If the input date is invalid.
311
+ *
312
+ * @example
313
+ * isPast(new Date('2020-01-01')) // true
314
+ */
315
+ declare function isPast(date: Date): boolean;
316
+ /**
317
+ * Checks if a date is in the future (after now).
318
+ *
319
+ * @param date - The date to check.
320
+ * @returns Whether the date is in the future.
321
+ * @throws {InvalidDateError} If the input date is invalid.
322
+ *
323
+ * @example
324
+ * isFuture(new Date('2099-01-01')) // true
325
+ */
326
+ declare function isFuture(date: Date): boolean;
327
+ /**
328
+ * Checks if two dates fall on the same calendar day.
329
+ *
330
+ * @param date1 - First date.
331
+ * @param date2 - Second date.
332
+ * @returns Whether the dates are the same day.
333
+ * @throws {InvalidDateError} If either date is invalid.
334
+ *
335
+ * @example
336
+ * isSameDay(new Date('2024-01-01'), new Date('2024-01-01')) // true
337
+ */
338
+ declare function isSameDay(date1: Date, date2: Date): boolean;
339
+ /**
340
+ * Returns the number of days in the month of the given date.
341
+ *
342
+ * @param date - The date.
343
+ * @returns Number of days in the month (28–31).
344
+ * @throws {InvalidDateError} If the input date is invalid.
345
+ *
346
+ * @example
347
+ * daysInMonth(new Date('2024-02-01')) // 29 (leap year)
348
+ */
349
+ declare function daysInMonth(date: Date): number;
350
+ /**
351
+ * Returns the day of the year (1–366).
352
+ *
353
+ * @param date - The date.
354
+ * @returns Day of the year (1-indexed).
355
+ * @throws {InvalidDateError} If the input date is invalid.
356
+ *
357
+ * @example
358
+ * dayOfYear(new Date('2024-01-01')) // 1
359
+ */
360
+ declare function dayOfYear(date: Date): number;
361
+ /**
362
+ * Returns the ISO week number (1–53).
363
+ *
364
+ * The algorithm uses the Thursday of the same week as the reference
365
+ * to determine which year the week belongs to, per ISO 8601.
366
+ *
367
+ * @param date - The date.
368
+ * @returns The ISO week number.
369
+ * @throws {InvalidDateError} If the input date is invalid.
370
+ *
371
+ * @example
372
+ * weekOfYear(new Date('2024-01-01')) // 1
373
+ */
374
+ declare function weekOfYear(date: Date): number;
375
+ /**
376
+ * Returns the quarter of the year (1–4).
377
+ *
378
+ * @param date - The date.
379
+ * @returns The quarter (1 for Jan–Mar, 2 for Apr–Jun, etc.).
380
+ * @throws {InvalidDateError} If the input date is invalid.
381
+ *
382
+ * @example
383
+ * quarter(new Date('2024-04-01')) // 2
384
+ */
385
+ declare function quarter(date: Date): number;
386
+ /**
387
+ * Returns the latest (maximum) date from an array of dates.
388
+ *
389
+ * @param dates - Array of Date objects.
390
+ * @returns The latest date.
391
+ * @throws {Error} If the array is empty.
392
+ * @throws {InvalidDateError} If any date is invalid.
393
+ *
394
+ * @example
395
+ * maxDate([new Date('2024-01-01'), new Date('2025-01-01')]) // 2025-01-01
396
+ */
397
+ declare function maxDate(dates: Date[]): Date;
398
+ /**
399
+ * Returns the earliest (minimum) date from an array of dates.
400
+ *
401
+ * @param dates - Array of Date objects.
402
+ * @returns The earliest date.
403
+ * @throws {Error} If the array is empty.
404
+ * @throws {InvalidDateError} If any date is invalid.
405
+ *
406
+ * @example
407
+ * minDate([new Date('2024-01-01'), new Date('2025-01-01')]) // 2024-01-01
408
+ */
409
+ declare function minDate(dates: Date[]): Date;
410
+ /**
411
+ * Returns the next Monday from the given date.
412
+ *
413
+ * @param date - Reference date.
414
+ * @returns The next Monday.
415
+ * @throws {InvalidDateError} If the input date is invalid.
416
+ *
417
+ * @example
418
+ * nextMonday(new Date('2024-01-01')) // 2024-01-08 (Monday)
419
+ */
420
+ declare function nextMonday(date: Date): Date;
421
+ /**
422
+ * Returns the next Tuesday from the given date.
423
+ *
424
+ * @param date - Reference date.
425
+ * @returns The next Tuesday.
426
+ * @throws {InvalidDateError} If the input date is invalid.
427
+ *
428
+ * @example
429
+ * nextTuesday(new Date('2024-01-01')) // 2024-01-02 (Tuesday)
430
+ */
431
+ declare function nextTuesday(date: Date): Date;
432
+ /**
433
+ * Returns the next Wednesday from the given date.
434
+ *
435
+ * @param date - Reference date.
436
+ * @returns The next Wednesday.
437
+ * @throws {InvalidDateError} If the input date is invalid.
438
+ */
439
+ declare function nextWednesday(date: Date): Date;
440
+ /**
441
+ * Returns the next Thursday from the given date.
442
+ *
443
+ * @param date - Reference date.
444
+ * @returns The next Thursday.
445
+ * @throws {InvalidDateError} If the input date is invalid.
446
+ */
447
+ declare function nextThursday(date: Date): Date;
448
+ /**
449
+ * Returns the next Friday from the given date.
450
+ *
451
+ * @param date - Reference date.
452
+ * @returns The next Friday.
453
+ * @throws {InvalidDateError} If the input date is invalid.
454
+ */
455
+ declare function nextFriday(date: Date): Date;
456
+ /**
457
+ * Returns the next Saturday from the given date.
458
+ *
459
+ * @param date - Reference date.
460
+ * @returns The next Saturday.
461
+ * @throws {InvalidDateError} If the input date is invalid.
462
+ */
463
+ declare function nextSaturday(date: Date): Date;
464
+ /**
465
+ * Returns the next Sunday from the given date.
466
+ *
467
+ * @param date - Reference date.
468
+ * @returns The next Sunday.
469
+ * @throws {InvalidDateError} If the input date is invalid.
470
+ */
471
+ declare function nextSunday(date: Date): Date;
472
+ /**
473
+ * Returns the last (previous) Monday from the given date.
474
+ *
475
+ * @param date - Reference date.
476
+ * @returns The last Monday.
477
+ * @throws {InvalidDateError} If the input date is invalid.
478
+ *
479
+ * @example
480
+ * lastMonday(new Date('2024-01-03')) // 2024-01-01 (Monday)
481
+ */
482
+ declare function lastMonday(date: Date): Date;
483
+ /**
484
+ * Returns the last (previous) Tuesday from the given date.
485
+ *
486
+ * @param date - Reference date.
487
+ * @returns The last Tuesday.
488
+ * @throws {InvalidDateError} If the input date is invalid.
489
+ */
490
+ declare function lastTuesday(date: Date): Date;
491
+ /**
492
+ * Returns the last (previous) Wednesday from the given date.
493
+ *
494
+ * @param date - Reference date.
495
+ * @returns The last Wednesday.
496
+ * @throws {InvalidDateError} If the input date is invalid.
497
+ */
498
+ declare function lastWednesday(date: Date): Date;
499
+ /**
500
+ * Returns the last (previous) Thursday from the given date.
501
+ *
502
+ * @param date - Reference date.
503
+ * @returns The last Thursday.
504
+ * @throws {InvalidDateError} If the input date is invalid.
505
+ */
506
+ declare function lastThursday(date: Date): Date;
507
+ /**
508
+ * Returns the last (previous) Friday from the given date.
509
+ *
510
+ * @param date - Reference date.
511
+ * @returns The last Friday.
512
+ * @throws {InvalidDateError} If the input date is invalid.
513
+ *
514
+ * @example
515
+ * lastFriday(new Date('2024-01-03')) // 2023-12-29 (Friday)
516
+ */
517
+ declare function lastFriday(date: Date): Date;
518
+ /**
519
+ * Returns the last (previous) Saturday from the given date.
520
+ *
521
+ * @param date - Reference date.
522
+ * @returns The last Saturday.
523
+ * @throws {InvalidDateError} If the input date is invalid.
524
+ */
525
+ declare function lastSaturday(date: Date): Date;
526
+ /**
527
+ * Returns the last (previous) Sunday from the given date.
528
+ *
529
+ * @param date - Reference date.
530
+ * @returns The last Sunday.
531
+ * @throws {InvalidDateError} If the input date is invalid.
532
+ */
533
+ declare function lastSunday(date: Date): Date;
534
+ /**
535
+ * Parses a human-readable duration string into milliseconds.
536
+ *
537
+ * Supported units:
538
+ * - `w` — weeks
539
+ * - `d` — days
540
+ * - `h` — hours
541
+ * - `m` — minutes
542
+ * - `s` — seconds
543
+ *
544
+ * @param input - Duration string (e.g. `"1h30m"`, `"2d"`, `"1w2d6h"`).
545
+ * @returns Total milliseconds.
546
+ *
547
+ * @example
548
+ * parseDuration('1h30m') // 5400000
549
+ * parseDuration('2d') // 172800000
550
+ * parseDuration('1w') // 604800000
551
+ */
552
+ declare function parseDuration(input: string): number;
553
+ /**
554
+ * Checks if a date is an Indonesian public holiday.
555
+ *
556
+ * Includes fixed-date holidays (New Year, Labor Day, Pancasila Day,
557
+ * Independence Day, National Awakening Day, National Heroes Day, Christmas),
558
+ * Easter-based holidays (Good Friday, Easter, Ascension), and lookup-based
559
+ * movable holidays (Chinese New Year, Nyepi, Vesak, Eid al-Fitr,
560
+ * Eid al-Adha, Islamic New Year, Prophet's Birthday, Isra' Mi'raj).
561
+ *
562
+ * Movable holidays (Chinese New Year, Nyepi, Vesak, Islamic holidays) are
563
+ * precomputed for years 2024–2030. Dates outside this range may return
564
+ * `false` for those holidays.
565
+ *
566
+ * @param date - The date to check.
567
+ * @returns Whether the date is an Indonesian public holiday.
568
+ * @throws {InvalidDateError} If the input date is invalid.
569
+ *
570
+ * @example
571
+ * isHolidayIndonesia(new Date('2024-08-17')) // true (Independence Day)
572
+ * isHolidayIndonesia(new Date('2024-12-25')) // true (Christmas)
573
+ */
574
+ declare function isHolidayIndonesia(date: Date): boolean;
575
+ /**
576
+ * Returns the name(s) of Indonesian public holidays for a given date, or an
577
+ * empty array if the date is not a holiday.
578
+ *
579
+ * @param date - The date to check.
580
+ * @returns Array of holiday names.
581
+ * @throws {InvalidDateError} If the input date is invalid.
582
+ *
583
+ * @example
584
+ * getIndonesianHolidayNames(new Date('2024-08-17')) // ['Independence Day']
585
+ */
586
+ declare function getIndonesianHolidayNames(date: Date): string[];
587
+
588
+ export { type DateDiff, type Duration, InvalidDateError, TIMEZONE_WIB, TIMEZONE_WIT, TIMEZONE_WITA, addBusinessDays, addDays, addMonths, addYears, calculateAge, dateDiff, dayOfYear, daysInMonth, endOfDay, endOfMonth, endOfYear, formatDate, formatDuration, formatInTimezone, getIndonesianHolidayNames, isAfter, isBefore, isBetween, isBusinessDay, isFuture, isHolidayIndonesia, isLeapYear, isPast, isSameDay, isToday, isTomorrow, isWeekend, isYesterday, lastFriday, lastMonday, lastSaturday, lastSunday, lastThursday, lastTuesday, lastWednesday, maxDate, minDate, nextFriday, nextMonday, nextSaturday, nextSunday, nextThursday, nextTuesday, nextWednesday, parseDate, parseDuration, quarter, startOfDay, startOfMonth, startOfYear, timeAgo, timeRemaining, toTimezone, weekOfYear };