@timestamp-js/core 0.1.0-alpha.2 → 0.1.0-beta.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/dist/index.d.ts CHANGED
@@ -97,6 +97,10 @@ export declare const HOURS_IN_DAY: number;
97
97
  * Number of milliseconds in one minute.
98
98
  */
99
99
  export declare const MILLISECONDS_IN_MINUTE: number;
100
+ /**
101
+ * Number of milliseconds in one second.
102
+ */
103
+ export declare const MILLISECONDS_IN_SECOND: number;
100
104
  /**
101
105
  * Number of milliseconds in one hour.
102
106
  */
@@ -109,6 +113,18 @@ export declare const MILLISECONDS_IN_DAY: number;
109
113
  * Number of milliseconds in one week.
110
114
  */
111
115
  export declare const MILLISECONDS_IN_WEEK: number;
116
+ /**
117
+ * Number of seconds in one minute.
118
+ */
119
+ export declare const SECONDS_IN_MINUTE: number;
120
+ /**
121
+ * Number of seconds in one hour.
122
+ */
123
+ export declare const SECONDS_IN_HOUR: number;
124
+ /**
125
+ * Number of seconds in one day.
126
+ */
127
+ export declare const SECONDS_IN_DAY: number;
112
128
  /**
113
129
  * Inline style metadata that can be attached to disabled timestamp ranges.
114
130
  */
@@ -134,11 +150,11 @@ export interface DisabledDayConfig {
134
150
  */
135
151
  to?: string;
136
152
  /**
137
- * Alias for {@link DisabledDayConfig.from}.
153
+ * Alias for DisabledDayConfig.from.
138
154
  */
139
155
  start?: string;
140
156
  /**
141
- * Alias for {@link DisabledDayConfig.to}.
157
+ * Alias for DisabledDayConfig.to.
142
158
  */
143
159
  end?: string;
144
160
  /**
@@ -308,10 +324,78 @@ export interface TimeObject {
308
324
  */
309
325
  readonly millisecond?: number;
310
326
  }
327
+ /**
328
+ * Immutable inclusive range between two Timestamp values.
329
+ *
330
+ * Range helpers normalize start/end order when created with createTimestampRange().
331
+ */
332
+ export interface TimestampRange {
333
+ /**
334
+ * Inclusive range start.
335
+ */
336
+ readonly start: Timestamp;
337
+ /**
338
+ * Inclusive range end.
339
+ */
340
+ readonly end: Timestamp;
341
+ }
342
+ /**
343
+ * Immutable elapsed duration broken into convenient absolute components.
344
+ *
345
+ * `totalMilliseconds` is signed. The component fields are absolute values so
346
+ * callers can display or inspect them without repeatedly applying Math.abs().
347
+ */
348
+ export interface TimestampDuration {
349
+ /**
350
+ * Signed elapsed milliseconds from the first timestamp to the second.
351
+ */
352
+ readonly totalMilliseconds: number;
353
+ /**
354
+ * Absolute elapsed milliseconds.
355
+ */
356
+ readonly absoluteMilliseconds: number;
357
+ /**
358
+ * Direction of the duration: `-1`, `0`, or `1`.
359
+ */
360
+ readonly sign: -1 | 0 | 1;
361
+ /**
362
+ * Full days in the absolute duration.
363
+ */
364
+ readonly days: number;
365
+ /**
366
+ * Remaining hours after full days are removed.
367
+ */
368
+ readonly hours: number;
369
+ /**
370
+ * Remaining minutes after full hours are removed.
371
+ */
372
+ readonly minutes: number;
373
+ /**
374
+ * Remaining seconds after full minutes are removed.
375
+ */
376
+ readonly seconds: number;
377
+ /**
378
+ * Remaining milliseconds after full seconds are removed.
379
+ */
380
+ readonly milliseconds: number;
381
+ }
382
+ /**
383
+ * Options for formatting a TimestampDuration.
384
+ */
385
+ export interface FormatDurationOptions {
386
+ /**
387
+ * Include the millisecond component when true.
388
+ */
389
+ readonly milliseconds?: boolean;
390
+ /**
391
+ * Preserve a leading `-` for negative durations when true.
392
+ */
393
+ readonly signed?: boolean;
394
+ }
311
395
  /**
312
396
  * Frozen empty timestamp template.
313
397
  *
314
- * Use {@link copyTimestamp} or parser helpers to create new timestamp objects
398
+ * Use copyTimestamp or parser helpers to create new timestamp objects
315
399
  * instead of mutating this shared default.
316
400
  */
317
401
  export declare const Timestamp: Timestamp;
@@ -330,20 +414,33 @@ export declare function validateTimestamp(input: string): boolean;
330
414
  * Fast low-level parser for date and date-time strings.
331
415
  *
332
416
  * This parser fills numeric fields, but does not update formatted date,
333
- * weekday, day-of-year, workweek, or relative flags. Use
334
- * {@link parseTimestamp} when those derived fields are needed.
417
+ * weekday, day-of-year, workweek, or relative flags. Use parseTimestamp()
418
+ * when those derived fields are needed.
335
419
  *
336
420
  * @param {string} input In the form `YYYY-MM-DD`, `YYYY-MM-DD HH:mm:ss`, or an ISO-like date time with optional milliseconds and timezone suffix.
337
- * @returns {Timestamp} This {@link Timestamp} is minimally filled in. The {@link Timestamp.date} and {@link Timestamp.time} as well as relative data will not be filled in.
421
+ * @returns {Timestamp} Minimal Timestamp object, or `null` when the input cannot be parsed.
338
422
  */
339
423
  export declare function parsed(input: string): Timestamp | null;
340
424
  /**
341
- * Takes a JavaScript Date and returns a {@link Timestamp}. The {@link Timestamp} is not updated with relative information.
342
- * @param {Date} date JavaScript Date
343
- * @param {boolean} utc If set the {@link Timestamp} will parse the Date as UTC
344
- * @returns {Timestamp} A minimal {@link Timestamp} without updated or relative updates.
425
+ * Converts a JavaScript Date into a formatted Timestamp using host-local fields.
426
+ *
427
+ * Use parseDateUTC() when the Date represents an instant that should be read
428
+ * with UTC getters instead of host-local getters.
429
+ *
430
+ * @param {Date} date JavaScript Date to convert.
431
+ * @returns {Timestamp} Formatted Timestamp object, or `null` for invalid input.
432
+ */
433
+ export declare function parseDate(date: Date): Timestamp | null;
434
+ /**
435
+ * Converts a JavaScript Date into a formatted Timestamp using UTC fields.
436
+ *
437
+ * Use this when server and client output should agree on the same UTC calendar
438
+ * and time fields for a native Date instant.
439
+ *
440
+ * @param {Date} date JavaScript Date to convert.
441
+ * @returns {Timestamp} Formatted Timestamp object, or `null` for invalid input.
345
442
  */
346
- export declare function parseDate(date: Date, utc?: boolean): Timestamp | null;
443
+ export declare function parseDateUTC(date: Date): Timestamp | null;
347
444
  /**
348
445
  * Pads a number to a requested string length.
349
446
  *
@@ -367,22 +464,51 @@ export declare function isLeapYear(year: number): boolean;
367
464
  */
368
465
  export declare function daysInMonth(year: number, month: number): number;
369
466
  /**
370
- * Returns a {@link Timestamp} of next day from passed in {@link Timestamp}
371
- * @param {Timestamp} timestamp The {@link Timestamp} to use
372
- * @returns {Timestamp} A new {@link Timestamp} representing the next day
467
+ * Returns a new Timestamp for the next calendar day.
468
+ *
469
+ * @param {Timestamp} timestamp Base Timestamp object.
470
+ * @returns {Timestamp} New Timestamp representing the next day.
373
471
  */
374
472
  export declare function nextDay(timestamp: Timestamp): Timestamp;
375
473
  /**
376
- * Returns a {@link Timestamp} of previous day from passed in {@link Timestamp}
377
- * @param {Timestamp} timestamp The {@link Timestamp} to use
378
- * @returns {Timestamp} A new {@link Timestamp} representing the previous day
474
+ * Returns a new Timestamp for the previous calendar day.
475
+ *
476
+ * @param {Timestamp} timestamp Base Timestamp object.
477
+ * @returns {Timestamp} New Timestamp representing the previous day.
379
478
  */
380
479
  export declare function prevDay(timestamp: Timestamp): Timestamp;
381
480
  /**
382
- * Returns today's date
481
+ * Returns today's date using the host runtime timezone.
482
+ *
483
+ * For SSR or static rendering, server and client runtimes can produce different
484
+ * values when they run in different timezones. Use todayUTC() when the app
485
+ * wants a stable UTC calendar date instead.
486
+ *
383
487
  * @returns {string} Date string in the form `YYYY-MM-DD`
384
488
  */
385
489
  export declare function today(): string;
490
+ /**
491
+ * Returns today's date using UTC calendar fields.
492
+ *
493
+ * Pass a Date fixture to make SSR, tests, and hydration-sensitive render paths
494
+ * deterministic. This helper reads UTC fields only; it does not convert an
495
+ * existing Timestamp or timezone-suffixed string.
496
+ *
497
+ * @param {Date} date Date source to read. Defaults to the current Date.
498
+ * @returns {string} UTC date string in the form `YYYY-MM-DD`
499
+ */
500
+ export declare function todayUTC(date?: Date): string;
501
+ /**
502
+ * Returns the current date-time as an immutable Timestamp using UTC fields.
503
+ *
504
+ * Use this when server and client output should agree on UTC calendar and time
505
+ * values. For fully deterministic SSR output, pass a Date captured by the
506
+ * caller instead of allowing each runtime to create its own current Date.
507
+ *
508
+ * @param {Date} date Date source to read. Defaults to the current Date.
509
+ * @returns {Timestamp} Immutable Timestamp built from UTC fields.
510
+ */
511
+ export declare function nowUTC(date?: Date): Timestamp;
386
512
  /**
387
513
  * Takes a date string ('YYYY-MM-DD') and validates if it is today's date
388
514
  * @param {string} date Date string in the form 'YYYY-MM-DD'
@@ -390,33 +516,44 @@ export declare function today(): string;
390
516
  */
391
517
  export declare function isToday(date: string): boolean;
392
518
  /**
393
- * Returns the start of the week give a {@link Timestamp} and weekdays (in which it finds the day representing the start of the week).
394
- * If today {@link Timestamp} is passed in then this is used to update relative information in the returned {@link Timestamp}.
395
- * @param {Timestamp} timestamp The {@link Timestamp} to use to find the start of the week
519
+ * Checks whether a date string matches today's UTC date.
520
+ *
521
+ * Pass a Date fixture when SSR, tests, or hydration-sensitive render paths need
522
+ * deterministic behavior.
523
+ *
524
+ * @param {string} date Date string in the form `YYYY-MM-DD`.
525
+ * @param {Date} now Date source to read. Defaults to the current Date.
526
+ * @returns {boolean} True when the date matches the UTC date.
527
+ */
528
+ export declare function isTodayUTC(date: string, now?: Date): boolean;
529
+ /**
530
+ * Returns the start of the week for a Timestamp and weekday set.
531
+ * If a current Timestamp is provided, the returned Timestamp includes updated relative information.
532
+ * @param {Timestamp} timestamp The Timestamp to use to find the start of the week
396
533
  * @param {number[]} weekdays The array is [0,1,2,3,4,5,6] where 0=Sunday and 6=Saturday
397
- * @param {Timestamp=} today If passed in then the {@link Timestamp} is updated with relative information
398
- * @returns {Timestamp} A new {@link Timestamp} representing the start of the week
534
+ * @param {Timestamp=} today Current timestamp used to update relative information
535
+ * @returns {Timestamp} A new Timestamp representing the start of the week
399
536
  */
400
537
  export declare function getStartOfWeek(timestamp: Timestamp, weekdays: number[], today: Timestamp): Timestamp;
401
538
  /**
402
- * Returns the end of the week give a {@link Timestamp} and weekdays (in which it finds the day representing the last of the week).
403
- * If today {@link Timestamp} is passed in then this is used to update relative information in the returned {@link Timestamp}.
404
- * @param {Timestamp} timestamp The {@link Timestamp} to use to find the end of the week
539
+ * Returns the end of the week for a Timestamp and weekday set.
540
+ * If a current Timestamp is provided, the returned Timestamp includes updated relative information.
541
+ * @param {Timestamp} timestamp The Timestamp to use to find the end of the week
405
542
  * @param {number[]} weekdays The array is [0,1,2,3,4,5,6] where 0=Sunday and 6=Saturday
406
- * @param {Timestamp=} today If passed in then the {@link Timestamp} is updated with relative information
407
- * @returns {Timestamp} A new {@link Timestamp} representing the end of the week
543
+ * @param {Timestamp=} today Current timestamp used to update relative information
544
+ * @returns {Timestamp} A new Timestamp representing the end of the week
408
545
  */
409
546
  export declare function getEndOfWeek(timestamp: Timestamp, weekdays: number[], today: Timestamp): Timestamp;
410
547
  /**
411
- * Finds the start of the month based on the passed in {@link Timestamp}
412
- * @param {Timestamp} timestamp The {@link Timestamp} to use to find the start of the month
413
- * @returns {Timestamp} A {@link Timestamp} of the start of the month
548
+ * Finds the start of the month based on the passed in Timestamp
549
+ * @param {Timestamp} timestamp The Timestamp to use to find the start of the month
550
+ * @returns {Timestamp} A Timestamp of the start of the month
414
551
  */
415
552
  export declare function getStartOfMonth(timestamp: Timestamp): Timestamp;
416
553
  /**
417
- * Finds the end of the month based on the passed in {@link Timestamp}
418
- * @param {Timestamp} timestamp The {@link Timestamp} to use to find the end of the month
419
- * @returns {Timestamp} A {@link Timestamp} of the end of the month
554
+ * Finds the end of the month based on the passed in Timestamp
555
+ * @param {Timestamp} timestamp The Timestamp to use to find the end of the month
556
+ * @returns {Timestamp} A Timestamp of the end of the month
420
557
  */
421
558
  export declare function getEndOfMonth(timestamp: Timestamp): Timestamp;
422
559
  /**
@@ -433,76 +570,88 @@ export declare function parseTime(input: number | string | {
433
570
  minute: number;
434
571
  }): number | false;
435
572
  /**
436
- * Compares two {@link Timestamp}s for exactness
437
- * @param {Timestamp} ts1 The first {@link Timestamp}
438
- * @param {Timestamp} ts2 The second {@link Timestamp}
439
- * @returns {boolean} True if the two {@link Timestamp}s are an exact match
573
+ * Compares two Timestamp objects for exact date, time, and timezone equality.
574
+ *
575
+ * @param {Timestamp} ts1 First Timestamp object.
576
+ * @param {Timestamp} ts2 Second Timestamp object.
577
+ * @returns {boolean} True when both timestamps match exactly.
440
578
  */
441
579
  export declare function compareTimestamps(ts1: Timestamp, ts2: Timestamp): boolean;
442
580
  /**
443
- * Compares the date of two {@link Timestamp}s that have been updated with relative data
444
- * @param {Timestamp} ts1 The first {@link Timestamp}
445
- * @param {Timestamp} ts2 The second {@link Timestamp}
446
- * @returns {boolean} True if the two dates are the same
581
+ * Compares the calendar date portion of two Timestamp objects.
582
+ *
583
+ * @param {Timestamp} ts1 First Timestamp object.
584
+ * @param {Timestamp} ts2 Second Timestamp object.
585
+ * @returns {boolean} True when both dates are the same.
447
586
  */
448
587
  export declare function compareDate(ts1: Timestamp, ts2: Timestamp): boolean;
449
588
  /**
450
- * Compares the time of two {@link Timestamp}s that have been updated with relative data
451
- * @param {Timestamp} ts1 The first {@link Timestamp}
452
- * @param {Timestamp} ts2 The second {@link Timestamp}
453
- * @returns {boolean} True if the two times are an exact match
589
+ * Compares the formatted time portion of two Timestamp objects.
590
+ *
591
+ * @param {Timestamp} ts1 First Timestamp object.
592
+ * @param {Timestamp} ts2 Second Timestamp object.
593
+ * @returns {boolean} True when both times are the same.
454
594
  */
455
595
  export declare function compareTime(ts1: Timestamp, ts2: Timestamp): boolean;
456
596
  /**
457
- * Compares the date and time of two {@link Timestamp}s that have been updated with relative data
458
- * @param {Timestamp} ts1 The first {@link Timestamp}
459
- * @param {Timestamp} ts2 The second {@link Timestamp}
460
- * @returns {boolean} True if the date and time are an exact match
597
+ * Compares the formatted date and time portions of two Timestamp objects.
598
+ *
599
+ * @param {Timestamp} ts1 First Timestamp object.
600
+ * @param {Timestamp} ts2 Second Timestamp object.
601
+ * @returns {boolean} True when both date-time values are the same.
461
602
  */
462
603
  export declare function compareDateTime(ts1: Timestamp, ts2: Timestamp): boolean;
463
604
  /**
464
- * High-level parser that converts a string to a fully formatted {@link Timestamp}.
605
+ * Converts a supported date or date-time string into a formatted Timestamp object.
465
606
  *
466
607
  * If `now` is supplied, the returned timestamp also includes relative flags
467
608
  * such as `past`, `current`, `future`, and `currentWeekday`.
468
609
  *
469
- * @param {string} input In the form `YYYY-MM-DD`, `YYYY-MM-DD HH:mm:ss`, or an ISO-like date time with optional milliseconds and timezone suffix.
470
- * @param {Timestamp} now A {@link Timestamp} to use for relative data updates
471
- * @returns {Timestamp} The {@link Timestamp.date} will be filled in as well as the {@link Timestamp.time} if a time is supplied and formatted fields (doy, weekday, workweek, etc). If 'now' is supplied, then relative data will also be updated.
610
+ * @param {string} input Date or date-time string, such as `YYYY-MM-DD`, `YYYY-MM-DD HH:mm:ss`, or an ISO-like value with optional milliseconds and timezone suffix.
611
+ * @param {Timestamp} now Optional Timestamp used to calculate relative flags.
612
+ * @returns {Timestamp} Formatted Timestamp object, or `null` when the input cannot be parsed.
472
613
  */
473
614
  export declare function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | null;
474
615
  /**
475
- * Converts a {@link Timestamp} into a numeric date identifier based on the passed {@link Timestamp}'s date
476
- * @param {Timestamp} timestamp The {@link Timestamp} to use
477
- * @returns {number} The numeric date identifier
616
+ * Converts a Timestamp date into a sortable numeric identifier.
617
+ *
618
+ * @param {Timestamp} timestamp Timestamp object to read.
619
+ * @returns {number} Numeric date identifier.
478
620
  */
479
621
  export declare function getDayIdentifier(timestamp: Timestamp): number;
480
622
  /**
481
- * Converts a {@link Timestamp} into a numeric time identifier based on the passed {@link Timestamp}'s time
482
- * @param {Timestamp} timestamp The {@link Timestamp} to use
483
- * @returns {number} The numeric time identifier
623
+ * Converts a Timestamp time into a sortable numeric identifier.
624
+ *
625
+ * @param {Timestamp} timestamp Timestamp object to read.
626
+ * @returns {number} Numeric time identifier.
484
627
  */
485
628
  export declare function getTimeIdentifier(timestamp: Timestamp): number;
486
629
  /**
487
- * Converts a {@link Timestamp} into a numeric date and time identifier based on the passed {@link Timestamp}'s date and time
488
- * @param {Timestamp} timestamp The {@link Timestamp} to use
489
- * @returns {number} The numeric date+time identifier
630
+ * Converts a Timestamp date and time into a sortable numeric identifier.
631
+ *
632
+ * @param {Timestamp} timestamp Timestamp object to read.
633
+ * @returns {number} Numeric date-time identifier.
490
634
  */
491
635
  export declare function getDayTimeIdentifier(timestamp: Timestamp): number;
492
636
  /**
493
- * Returns the difference between two {@link Timestamp}s
494
- * @param {Timestamp} ts1 The first {@link Timestamp}
495
- * @param {Timestamp} ts2 The second {@link Timestamp}
637
+ * Returns the difference between two Timestamps
638
+ * @param {Timestamp} ts1 The first Timestamp
639
+ * @param {Timestamp} ts2 The second Timestamp
496
640
  * @param {boolean=} strict Optional flag to not to return negative numbers
497
641
  * @returns {number} The difference
498
642
  */
499
643
  export declare function diffTimestamp(ts1: Timestamp, ts2: Timestamp, strict?: boolean): number;
500
644
  /**
501
- * Updates a {@link Timestamp} with relative data (past, current and future)
502
- * @param {Timestamp} timestamp The {@link Timestamp} that needs relative data updated
503
- * @param {Timestamp} now {@link Timestamp} that represents the current date (optional time)
504
- * @param {boolean=} time Optional flag to include time ('timestamp' and 'now' params should have time values)
505
- * @returns {Timestamp} A new {@link Timestamp}
645
+ * Returns a Timestamp with relative flags compared to a supplied `now` value.
646
+ *
647
+ * The returned object includes `past`, `current`, `future`, and
648
+ * `currentWeekday` flags. Pass `true` for `time` when both values should be
649
+ * compared at time-of-day precision.
650
+ *
651
+ * @param {Timestamp} timestamp Timestamp object to update.
652
+ * @param {Timestamp} now Timestamp representing the comparison point.
653
+ * @param {boolean=} time Include time-of-day in the comparison when true.
654
+ * @returns {Timestamp} New Timestamp object with relative flags.
506
655
  */
507
656
  export declare function updateRelative(timestamp: Timestamp, now: Timestamp, time?: boolean): Timestamp;
508
657
  /**
@@ -511,144 +660,184 @@ export declare function updateRelative(timestamp: Timestamp, now: Timestamp, tim
511
660
  * The returned timestamp has updated hour/minute fields and clears second and
512
661
  * millisecond precision because this helper is minute-oriented.
513
662
  *
514
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
663
+ * @param {Timestamp} timestamp The Timestamp to transform
515
664
  * @param {number} minutes The number of minutes to set from midnight
516
- * @param {Timestamp=} now Optional {@link Timestamp} representing current date and time
517
- * @returns {Timestamp} A new {@link Timestamp}
665
+ * @param {Timestamp=} now Optional Timestamp representing current date and time
666
+ * @returns {Timestamp} A new Timestamp
518
667
  */
519
668
  export declare function updateMinutes(timestamp: Timestamp, minutes: number, now?: Timestamp | null): Timestamp;
520
669
  /**
521
- * Updates the {@link Timestamp} with the weekday
522
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
670
+ * Updates the Timestamp with the weekday
671
+ * @param {Timestamp} timestamp The Timestamp to transform
523
672
  * @returns A new Timestamp
524
673
  */
525
674
  export declare function updateWeekday(timestamp: Timestamp): Timestamp;
526
675
  /**
527
- * Updates the {@link Timestamp} with the day of the year (doy)
528
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
676
+ * Updates the Timestamp with the day of the year (doy)
677
+ * @param {Timestamp} timestamp The Timestamp to transform
529
678
  * @returns A new Timestamp
530
679
  */
531
680
  export declare function updateDayOfYear(timestamp: Timestamp): Timestamp;
532
681
  /**
533
- * Updates the {@link Timestamp} with the workweek
534
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
535
- * @returns A new {@link Timestamp}
682
+ * Updates the Timestamp with the workweek
683
+ * @param {Timestamp} timestamp The Timestamp to transform
684
+ * @returns A new Timestamp
536
685
  */
537
686
  export declare function updateWorkWeek(timestamp: Timestamp): Timestamp;
538
687
  /**
539
- * Updates the passed {@link Timestamp} with disabled, if needed
540
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
688
+ * Updates the passed Timestamp with disabled, if needed
689
+ * @param {Timestamp} timestamp The Timestamp to transform
541
690
  * @param {string} [disabledBefore] In `YYYY-MM-DD` format
542
691
  * @param {string} [disabledAfter] In `YYYY-MM-DD` format
543
692
  * @param {number[]} [disabledWeekdays] An array of numbers representing weekdays [0 = Sun, ..., 6 = Sat]
544
693
  * @param {DisabledDays} [disabledDays] An array of days in 'YYYY-MM-DD' format. If an array with a pair of dates is in first array, then this is treated as a range. Object entries can include date/from/to plus color metadata.
545
- * @returns A new {@link Timestamp}
694
+ * @returns A new Timestamp
546
695
  */
547
696
  export declare function updateDisabled(timestamp: Timestamp, disabledBefore?: string, disabledAfter?: string, disabledWeekdays?: number[], disabledDays?: DisabledDays): Timestamp;
548
697
  /**
549
- * Updates the passed {@link Timestamp} with formatted data (time string, date string, weekday, day of year and workweek)
550
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
551
- * @returns A new {@link Timestamp}
698
+ * Updates the passed Timestamp with formatted data (time string, date string, weekday, day of year and workweek)
699
+ * @param {Timestamp} timestamp The Timestamp to transform
700
+ * @returns A new Timestamp
552
701
  */
553
702
  export declare function updateFormatted(timestamp: Timestamp): Timestamp;
554
703
  /**
555
- * Returns day of the year (doy) for the passed in {@link Timestamp}
556
- * @param {Timestamp} timestamp The {@link Timestamp} to use
704
+ * Returns day of the year (doy) for the passed in Timestamp
705
+ * @param {Timestamp} timestamp The Timestamp to use
557
706
  * @returns {number} The day of the year
558
707
  */
559
708
  export declare function getDayOfYear(timestamp: Timestamp): number | void;
560
709
  /**
561
- * Returns workweek for the passed in {@link Timestamp}
562
- * @param {Timestamp} timestamp The {@link Timestamp} to use
710
+ * Returns workweek for the passed in Timestamp
711
+ * @param {Timestamp} timestamp The Timestamp to use
563
712
  * @returns {number} The work week
564
713
  */
565
714
  export declare function getWorkWeek(timestamp: Timestamp): number;
566
715
  /**
567
- * Returns weekday for the passed in {@link Timestamp}
568
- * @param {Timestamp} timestamp The {@link Timestamp} to use
716
+ * Returns weekday for the passed in Timestamp
717
+ * @param {Timestamp} timestamp The Timestamp to use
569
718
  * @returns {number} The weekday
570
719
  */
571
720
  export declare function getWeekday(timestamp: Timestamp): number;
572
721
  /**
573
- * Makes a copy of the passed in {@link Timestamp}
574
- * @param {Timestamp} timestamp The original {@link Timestamp}
575
- * @returns {Timestamp} A copy of the original {@link Timestamp}
722
+ * Returns an immutable copy of a Timestamp object.
723
+ *
724
+ * @param {Timestamp} timestamp Timestamp object to copy.
725
+ * @returns {Timestamp} Frozen Timestamp copy.
576
726
  */
577
727
  export declare function copyTimestamp(timestamp: Timestamp): Timestamp;
578
728
  /**
579
- * Used internally to convert {@link Timestamp} used with 'parsed' or 'parseDate' so the 'date' portion of the {@link Timestamp} is correct.
580
- * @param {Timestamp} timestamp The (raw) {@link Timestamp}
581
- * @returns {string} A formatted date ('YYYY-MM-DD')
729
+ * Returns a Timestamp at the start of the same calendar day.
730
+ *
731
+ * @param {Timestamp} timestamp Timestamp object to transform.
732
+ * @returns {Timestamp} New Timestamp at `00:00`.
733
+ */
734
+ export declare function getStartOfDay(timestamp: Timestamp): Timestamp;
735
+ /**
736
+ * Returns a Timestamp at the end of the same calendar day.
737
+ *
738
+ * @param {Timestamp} timestamp Timestamp object to transform.
739
+ * @returns {Timestamp} New Timestamp at `23:59:59.999`.
740
+ */
741
+ export declare function getEndOfDay(timestamp: Timestamp): Timestamp;
742
+ /**
743
+ * Returns a Timestamp at the start of the same Gregorian year.
744
+ *
745
+ * @param {Timestamp} timestamp Timestamp object to transform.
746
+ * @returns {Timestamp} New Timestamp for January 1 at `00:00`.
747
+ */
748
+ export declare function getStartOfYear(timestamp: Timestamp): Timestamp;
749
+ /**
750
+ * Returns a Timestamp at the end of the same Gregorian year.
751
+ *
752
+ * @param {Timestamp} timestamp Timestamp object to transform.
753
+ * @returns {Timestamp} New Timestamp for December 31 at `23:59:59.999`.
754
+ */
755
+ export declare function getEndOfYear(timestamp: Timestamp): Timestamp;
756
+ /**
757
+ * Formats the date portion of a Timestamp object.
758
+ *
759
+ * @param {Timestamp} timestamp Timestamp object to format.
760
+ * @returns {string} Date string such as `YYYY-MM-DD`.
582
761
  */
583
762
  export declare function getDate(timestamp: Timestamp): string;
584
763
  /**
585
- * Used internally to convert {@link Timestamp} with 'parsed' or 'parseDate' so the 'time' portion of the {@link Timestamp} is correct.
586
- * @param {Timestamp} timestamp The (raw) {@link Timestamp}
587
- * @returns {string} A formatted time ('hh:mm')
764
+ * Formats the time portion of a Timestamp object.
765
+ *
766
+ * Minute precision is formatted as `HH:mm`; second precision as `HH:mm:ss`;
767
+ * millisecond precision as `HH:mm:ss.SSS`.
768
+ *
769
+ * @param {Timestamp} timestamp Timestamp object to format.
770
+ * @returns {string} Time string, or an empty string when the timestamp has no time.
588
771
  */
589
772
  export declare function getTime(timestamp: Timestamp): string;
590
773
  /**
591
- * Returns a formatted string date and time ('YYYY-YY-MM hh:mm')
592
- * @param {Timestamp} timestamp The {@link Timestamp}
593
- * @returns {string} A formatted date time ('YYYY-MM-DD HH:mm')
774
+ * Formats a Timestamp as date plus time.
775
+ *
776
+ * @param {Timestamp} timestamp Timestamp object to format.
777
+ * @returns {string} Date-time string such as `YYYY-MM-DD HH:mm`.
594
778
  */
595
779
  export declare function getDateTime(timestamp: Timestamp): string;
596
780
  /**
597
- * An alias for {relativeDays}
598
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
781
+ * Alias for relativeDays.
782
+ * @param {Timestamp} timestamp The Timestamp to transform
599
783
  * @param {function} [mover=nextDay] The mover function to use (ie: {nextDay} or {prevDay}).
600
784
  * @param {number} [days=1] The number of days to move.
601
785
  * @param {number[]} [allowedWeekdays=[ 0, 1, 2, 3, 4, 5, 6 ]] An array of numbers representing the weekdays. ie: [0 = Sun, ..., 6 = Sat].
602
- * @returns A new {@link Timestamp}
786
+ * @returns A new Timestamp
603
787
  */
604
788
  export declare function moveRelativeDays(timestamp: Timestamp, mover?: typeof nextDay, days?: number, allowedWeekdays?: number[]): Timestamp;
605
789
  /**
606
- * Moves the {@link Timestamp} the number of relative days
607
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
790
+ * Moves the Timestamp the number of relative days
791
+ * @param {Timestamp} timestamp The Timestamp to transform
608
792
  * @param {function} [mover=nextDay] The mover function to use (ie: {nextDay} or {prevDay}).
609
793
  * @param {number} [days=1] The number of days to move.
610
794
  * @param {number[]} [allowedWeekdays=[ 0, 1, 2, 3, 4, 5, 6 ]] An array of numbers representing the weekdays. ie: [0 = Sun, ..., 6 = Sat].
611
- * @returns A new {@link Timestamp}
795
+ * @returns A new Timestamp
612
796
  */
613
797
  export declare function relativeDays(timestamp: Timestamp, mover?: typeof nextDay, days?: number, allowedWeekdays?: number[]): Timestamp;
614
798
  /**
615
- * Finds the specified weekday (forward or back) based on the {@link Timestamp}
616
- * @param {Timestamp} timestamp The {@link Timestamp} to transform
799
+ * Finds the specified weekday (forward or back) based on the Timestamp
800
+ * @param {Timestamp} timestamp The Timestamp to transform
617
801
  * @param {number} weekday The weekday number (Sun = 0, ..., Sat = 6)
618
802
  * @param {function} [mover=nextDay] The function to use ({prevDay} or {nextDay}).
619
803
  * @param {number} [maxDays=6] The number of days to look forward or back.
620
- * @returns A new {@link Timestamp}
804
+ * @returns A new Timestamp
621
805
  */
622
806
  export declare function findWeekday(timestamp: Timestamp, weekday: number, mover?: typeof nextDay, maxDays?: number): Timestamp;
623
807
  /**
624
- * Creates an array of {@link Timestamp}s based on start and end params
625
- * @param {Timestamp} start The starting {@link Timestamp}
626
- * @param {Timestamp} end The ending {@link Timestamp}
627
- * @param {Timestamp} now The relative day
628
- * @param {number[]} weekdays An array of numbers (representing days of the week) that are 0 (=Sunday) to 6 (=Saturday)
629
- * @param {string} [disabledBefore] Days before this date are disabled (YYYY-MM-DD)
630
- * @param {string} [disabledAfter] Days after this date are disabled (YYYY-MM-DD)
631
- * @param {number[]} [disabledWeekdays] An array representing weekdays that are disabled [0 = Sun, ..., 6 = Sat]
632
- * @param {DisabledDays} [disabledDays] An array of days in 'YYYY-MM-DD' format. If an array with a pair of dates is in first array, then this is treated as a range.
633
- * @param {number} [max=42] Max days to do
634
- * @param {number} [min=0] Min days to do
635
- * @returns {Timestamp[]} The requested array of {@link Timestamp}s
808
+ * Creates an inclusive list of Timestamp days between start and end.
809
+ *
810
+ * The returned days are formatted, marked with relative flags against `now`,
811
+ * and can include disabled metadata when disabled options are supplied.
812
+ *
813
+ * @param {Timestamp} start First day in the list.
814
+ * @param {Timestamp} end Last day boundary for the list.
815
+ * @param {Timestamp} now Timestamp used to calculate relative flags.
816
+ * @param {number[]} weekdays Weekday numbers to include, from `0` Sunday to `6` Saturday.
817
+ * @param {string} [disabledBefore] Disable days before this `YYYY-MM-DD` date.
818
+ * @param {string} [disabledAfter] Disable days after this `YYYY-MM-DD` date.
819
+ * @param {number[]} [disabledWeekdays] Weekday numbers to mark disabled.
820
+ * @param {DisabledDays} [disabledDays] Specific dates or date ranges to mark disabled.
821
+ * @param {number} [max=42] Maximum number of days to return.
822
+ * @param {number} [min=0] Minimum number of days to return.
823
+ * @returns {Timestamp[]} Timestamp days.
636
824
  */
637
825
  export declare function createDayList(start: Timestamp, end: Timestamp, now: Timestamp, weekdays?: number[], disabledBefore?: string | undefined, disabledAfter?: string | undefined, disabledWeekdays?: number[], disabledDays?: DisabledDays, max?: number, min?: number): Timestamp[];
638
826
  /**
639
- * Creates an array of interval {@link Timestamp}s based on params
640
- * @param {Timestamp} timestamp The starting {@link Timestamp}
641
- * @param {number} first The starting interval time
642
- * @param {number} minutes How many minutes between intervals (ie: 60, 30, 15 would be common ones)
643
- * @param {number} count The number of intervals needed
644
- * @param {Timestamp} now A relative {@link Timestamp} with time
645
- * @returns {Timestamp[]} The requested array of interval {@link Timestamp}s
827
+ * Creates an array of interval Timestamp objects for one day.
828
+ *
829
+ * @param {Timestamp} timestamp Base date for the intervals.
830
+ * @param {number} first Starting interval index.
831
+ * @param {number} minutes Minutes between intervals, such as 60, 30, or 15.
832
+ * @param {number} count Number of intervals to create.
833
+ * @param {Timestamp} now Timestamp used to calculate relative flags.
834
+ * @returns {Timestamp[]} Interval Timestamp objects.
646
835
  */
647
836
  export declare function createIntervalList(timestamp: Timestamp, first: number, minutes: number, count: number, now: Timestamp): Timestamp[];
648
837
  /**
649
838
  * Callback that returns `Intl.DateTimeFormat` options for a timestamp.
650
839
  *
651
- * Used by {@link createNativeLocaleFormatter} to let callers switch between
840
+ * Used by createNativeLocaleFormatter to let callers switch between
652
841
  * long and short formatting styles per timestamp.
653
842
  */
654
843
  export type LocaleFormatter = (_timestamp: Timestamp, _short: boolean) => Intl.DateTimeFormatOptions;
@@ -661,50 +850,100 @@ export type WeekdayFormatter = (_weekday: keyof typeof weekdayDateMap, _type: st
661
850
  */
662
851
  export type MonthFormatter = (_month: number, _type?: string, _locale?: string) => string;
663
852
  /**
664
- * @callback getOptions
665
- * @param {Timestamp} timestamp A {@link Timestamp} object
666
- * @param {boolean} short True if using short options
667
- * @returns {Object} An Intl object representing options to be used
668
- */
669
- /**
670
- * @callback formatter
671
- * @param {Timestamp} timestamp The {@link Timestamp} being used
672
- * @param {boolean} short If short format is being requested
673
- * @returns {string} The localized string of the formatted {@link Timestamp}
674
- */
675
- /**
676
- * Returns a locale formatter backed by `Intl.DateTimeFormat`.
853
+ * Returns a host-local locale formatter backed by `Intl.DateTimeFormat`.
677
854
  *
678
855
  * The helper is SSR-safe: if `Intl.DateTimeFormat` is unavailable in a target
679
856
  * runtime, it returns a formatter that produces an empty string instead of
680
857
  * throwing during module load.
681
858
  *
859
+ * Use `createNativeLocaleFormatterUTC()` when Timestamp values should be read
860
+ * as UTC fields before formatting.
861
+ *
682
862
  * @param {string} locale The locale to use (ie: en-US)
683
863
  * @param {getOptions} cb The function to call for options. This function should return an Intl formatted object. The function is passed (timestamp, short).
684
864
  * @returns {formatter} The function has params (timestamp, short). The short is to use the short options.
685
865
  */
686
866
  export declare function createNativeLocaleFormatter(locale: string, cb: LocaleFormatter): (_timestamp: Timestamp, _short: boolean) => string;
687
867
  /**
688
- * Makes a JavaScript Date from the passed {@link Timestamp}
689
- * @param {Timestamp} timestamp The {@link Timestamp} to use
690
- * @param {boolean} utc True to get Date object using UTC
691
- * @returns {Date} A JavaScript Date
868
+ * Returns a UTC locale formatter backed by `Intl.DateTimeFormat`.
869
+ *
870
+ * This helper constructs the native `Date` with UTC fields before formatting.
871
+ * Pair it with `timeZone: "UTC"` when calendar labels must remain pinned to
872
+ * the Timestamp's UTC date instead of the viewer's local timezone.
873
+ *
874
+ * @param {string} locale The locale to use (ie: en-US)
875
+ * @param {getOptions} cb The function to call for options. This function should return an Intl formatted object. The function is passed (timestamp, short).
876
+ * @returns {formatter} The function has params (timestamp, short). The short is to use the short options.
877
+ */
878
+ export declare function createNativeLocaleFormatterUTC(locale: string, cb: LocaleFormatter): (_timestamp: Timestamp, _short: boolean) => string;
879
+ /**
880
+ * Converts a Timestamp date into a host-local JavaScript Date.
881
+ *
882
+ * @param {Timestamp} timestamp Timestamp object to convert.
883
+ * @returns {Date} Host-local JavaScript Date object.
884
+ */
885
+ export declare function makeDate(timestamp: Timestamp): Date;
886
+ /**
887
+ * Converts a Timestamp date into a UTC JavaScript Date.
888
+ *
889
+ * @param {Timestamp} timestamp Timestamp object to convert.
890
+ * @returns {Date} JavaScript Date object built with `Date.UTC()`.
891
+ */
892
+ export declare function makeDateUTC(timestamp: Timestamp): Date;
893
+ /**
894
+ * Converts a Timestamp date and time into a host-local JavaScript Date.
895
+ *
896
+ * @param {Timestamp} timestamp Timestamp object to convert.
897
+ * @returns {Date} Host-local JavaScript Date object.
898
+ */
899
+ export declare function makeDateTime(timestamp: Timestamp): Date;
900
+ /**
901
+ * Converts a Timestamp date and time into a UTC JavaScript Date.
902
+ *
903
+ * @param {Timestamp} timestamp Timestamp object to convert.
904
+ * @returns {Date} JavaScript Date object built with `Date.UTC()`.
905
+ */
906
+ export declare function makeDateTimeUTC(timestamp: Timestamp): Date;
907
+ /**
908
+ * Converts a Timestamp into Unix milliseconds by reading its fields as UTC.
909
+ *
910
+ * This is deterministic across server and client runtimes. It does not read or
911
+ * convert the optional `timezone` suffix stored on the Timestamp.
912
+ *
913
+ * @param {Timestamp} timestamp Timestamp object to convert.
914
+ * @returns {number} Unix milliseconds.
915
+ */
916
+ export declare function toUnixMilliseconds(timestamp: Timestamp): number;
917
+ /**
918
+ * Converts a Timestamp into Unix seconds by reading its fields as UTC.
919
+ *
920
+ * Milliseconds are floored because Unix seconds are integer-oriented.
921
+ *
922
+ * @param {Timestamp} timestamp Timestamp object to convert.
923
+ * @returns {number} Unix seconds.
924
+ */
925
+ export declare function toUnixSeconds(timestamp: Timestamp): number;
926
+ /**
927
+ * Converts Unix milliseconds into an immutable Timestamp using UTC fields.
928
+ *
929
+ * @param {number} milliseconds Unix milliseconds.
930
+ * @returns {Timestamp | null} Timestamp built from UTC fields, or `null` for invalid input.
692
931
  */
693
- export declare function makeDate(timestamp: Timestamp, utc?: boolean): Date;
932
+ export declare function fromUnixMilliseconds(milliseconds: number): Timestamp | null;
694
933
  /**
695
- * Makes a JavaScript Date from the passed {@link Timestamp} (with time)
696
- * @param {Timestamp} timestamp The {@link Timestamp} to use
697
- * @param {boolean} utc True to get Date object using UTC
698
- * @returns {Date} A JavaScript Date
934
+ * Converts Unix seconds into an immutable Timestamp using UTC fields.
935
+ *
936
+ * @param {number} seconds Unix seconds.
937
+ * @returns {Timestamp | null} Timestamp built from UTC fields, or `null` for invalid input.
699
938
  */
700
- export declare function makeDateTime(timestamp: Timestamp, utc?: boolean): Date;
939
+ export declare function fromUnixSeconds(seconds: number): Timestamp | null;
701
940
  /**
702
- * Converts a {@link Timestamp} to a local JavaScript `Date`.
941
+ * Converts a Timestamp to a local JavaScript Date.
703
942
  *
704
- * This is equivalent to `makeDateTime(timestamp, false)`.
943
+ * This is equivalent to `makeDateTime(timestamp)`.
705
944
  *
706
- * @param {Timestamp} timestamp The {@link Timestamp} to convert
707
- * @returns {Date} A local JavaScript Date
945
+ * @param {Timestamp} timestamp Timestamp object to convert.
946
+ * @returns {Date} Local JavaScript Date object.
708
947
  */
709
948
  export declare function getDateObject(timestamp: Timestamp): Date;
710
949
  /**
@@ -716,39 +955,115 @@ export declare function getDateObject(timestamp: Timestamp): Date;
716
955
  */
717
956
  export declare function validateNumber(input: string | number): boolean;
718
957
  /**
719
- * Given an array of {@link Timestamp}s, finds the max date (and possible time)
720
- * @param {Timestamp[]} timestamps This is an array of {@link Timestamp}s
721
- * @param {boolean=} useTime Default false; if true, uses time in the comparison as well
722
- * @returns The {@link Timestamp} with the highest date (and possibly time) value
958
+ * Finds the latest Timestamp in an array.
959
+ *
960
+ * @param {Timestamp[]} timestamps Timestamp objects to compare.
961
+ * @param {boolean=} useTime Include time-of-day in the comparison when true.
962
+ * @returns Latest Timestamp object.
723
963
  */
724
964
  export declare function maxTimestamp(timestamps: Timestamp[], useTime?: boolean): Timestamp;
725
965
  /**
726
- * Given an array of {@link Timestamp}s, finds the min date (and possible time)
727
- * @param {Timestamp[]} timestamps This is an array of {@link Timestamp}s
728
- * @param {boolean=} useTime Default false; if true, uses time in the comparison as well
729
- * @returns The {@link Timestamp} with the lowest date (and possibly time) value
966
+ * Finds the earliest Timestamp in an array.
967
+ *
968
+ * @param {Timestamp[]} timestamps Timestamp objects to compare.
969
+ * @param {boolean=} useTime Include time-of-day in the comparison when true.
970
+ * @returns Earliest Timestamp object.
730
971
  */
731
972
  export declare function minTimestamp(timestamps: Timestamp[], useTime?: boolean): Timestamp;
732
973
  /**
733
- * Determines if the passed {@link Timestamp} is between (or equal) to two {@link Timestamp}s (range)
734
- * @param {Timestamp} timestamp The {@link Timestamp} for testing
735
- * @param {Timestamp} startTimestamp The starting {@link Timestamp}
736
- * @param {Timestamp} endTimestamp The ending {@link Timestamp}
737
- * @param {boolean=} useTime If true, use time from the {@link Timestamp}s
738
- * @returns {boolean} True if {@link Timestamp} is between (or equal) to two {@link Timestamp}s (range)
974
+ * Creates an inclusive Timestamp range and normalizes start/end order.
975
+ *
976
+ * @param {Timestamp} start First boundary.
977
+ * @param {Timestamp} end Second boundary.
978
+ * @param {boolean=} useTime Include time-of-day when ordering boundaries.
979
+ * @returns {TimestampRange} Frozen inclusive Timestamp range.
980
+ */
981
+ export declare function createTimestampRange(start: Timestamp, end: Timestamp, useTime?: boolean): TimestampRange;
982
+ /**
983
+ * Checks whether a Timestamp falls inside an inclusive TimestampRange.
984
+ *
985
+ * @param {Timestamp} timestamp Timestamp object to test.
986
+ * @param {TimestampRange} range Inclusive range to test against.
987
+ * @param {boolean=} useTime Include time-of-day in the comparison.
988
+ * @returns {boolean} True when the timestamp is inside the range.
989
+ */
990
+ export declare function isTimestampInRange(timestamp: Timestamp, range: TimestampRange, useTime?: boolean): boolean;
991
+ /**
992
+ * Checks whether two inclusive TimestampRange values overlap.
993
+ *
994
+ * @param {TimestampRange} first First range.
995
+ * @param {TimestampRange} second Second range.
996
+ * @param {boolean=} useTime Include time-of-day in the comparison.
997
+ * @returns {boolean} True when the ranges overlap.
998
+ */
999
+ export declare function isRangeOverlapping(first: TimestampRange, second: TimestampRange, useTime?: boolean): boolean;
1000
+ /**
1001
+ * Returns the inclusive intersection of two TimestampRange values.
1002
+ *
1003
+ * @param {TimestampRange} first First range.
1004
+ * @param {TimestampRange} second Second range.
1005
+ * @param {boolean=} useTime Include time-of-day in the comparison.
1006
+ * @returns {TimestampRange | null} Intersected range, or `null` when the ranges do not overlap.
1007
+ */
1008
+ export declare function intersectRanges(first: TimestampRange, second: TimestampRange, useTime?: boolean): TimestampRange | null;
1009
+ /**
1010
+ * Merges overlapping or touching TimestampRange values.
1011
+ *
1012
+ * Date-only ranges touch when the next range starts on the next calendar day.
1013
+ * Time-aware ranges touch when the next range starts one millisecond after the
1014
+ * previous range ends.
1015
+ *
1016
+ * @param {TimestampRange[]} ranges Ranges to merge.
1017
+ * @param {boolean=} useTime Include time-of-day in the comparison.
1018
+ * @returns {TimestampRange[]} Merged ranges sorted by start boundary.
1019
+ */
1020
+ export declare function mergeRanges(ranges: TimestampRange[], useTime?: boolean): TimestampRange[];
1021
+ /**
1022
+ * Subtracts blocked ranges from a source range.
1023
+ *
1024
+ * The result is useful for availability windows because it returns the pieces
1025
+ * of the source range that remain after each blocked range is removed.
1026
+ *
1027
+ * @param {TimestampRange} source Source range.
1028
+ * @param {TimestampRange[]} blocked Ranges to remove from the source.
1029
+ * @param {boolean=} useTime Include time-of-day in the comparison.
1030
+ * @returns {TimestampRange[]} Remaining ranges.
1031
+ */
1032
+ export declare function subtractRanges(source: TimestampRange, blocked: TimestampRange[], useTime?: boolean): TimestampRange[];
1033
+ /**
1034
+ * Finds open gaps inside a source range after occupied ranges are removed.
1035
+ *
1036
+ * This is an alias for subtractRanges() with naming that reads naturally in
1037
+ * booking, resource, and availability workflows.
1038
+ *
1039
+ * @param {TimestampRange} source Source range.
1040
+ * @param {TimestampRange[]} occupied Ranges that are not available.
1041
+ * @param {boolean=} useTime Include time-of-day in the comparison.
1042
+ * @returns {TimestampRange[]} Gap ranges.
1043
+ */
1044
+ export declare function findRangeGaps(source: TimestampRange, occupied: TimestampRange[], useTime?: boolean): TimestampRange[];
1045
+ /**
1046
+ * Checks whether a Timestamp falls inside an inclusive range.
1047
+ *
1048
+ * @param {Timestamp} timestamp Timestamp object to test.
1049
+ * @param {Timestamp} startTimestamp Inclusive start boundary.
1050
+ * @param {Timestamp} endTimestamp Inclusive end boundary.
1051
+ * @param {boolean=} useTime Include time-of-day in the comparison when true.
1052
+ * @returns {boolean} True when the timestamp is inside the range.
739
1053
  */
740
1054
  export declare function isBetweenDates(timestamp: Timestamp, startTimestamp: Timestamp, endTimestamp: Timestamp, useTime?: boolean): boolean;
741
1055
  /**
742
- * Determine if two ranges of {@link Timestamp}s overlap each other
743
- * @param {Timestamp} startTimestamp The starting {@link Timestamp} of first range
744
- * @param {Timestamp} endTimestamp The endinging {@link Timestamp} of first range
745
- * @param {Timestamp} firstTimestamp The starting {@link Timestamp} of second range
746
- * @param {Timestamp} lastTimestamp The ending {@link Timestamp} of second range
747
- * @returns {boolean} True if the two ranges overlap each other
1056
+ * Checks whether two inclusive Timestamp ranges overlap.
1057
+ *
1058
+ * @param {Timestamp} startTimestamp Start of the first range.
1059
+ * @param {Timestamp} endTimestamp End of the first range.
1060
+ * @param {Timestamp} firstTimestamp Start of the second range.
1061
+ * @param {Timestamp} lastTimestamp End of the second range.
1062
+ * @returns {boolean} True when the ranges overlap.
748
1063
  */
749
1064
  export declare function isOverlappingDates(startTimestamp: Timestamp, endTimestamp: Timestamp, firstTimestamp: Timestamp, lastTimestamp: Timestamp): boolean;
750
1065
  /**
751
- * Date and time offsets accepted by {@link addToDate} and {@link addToDateClamped}.
1066
+ * Date and time offsets accepted by addToDate() and addToDateClamped().
752
1067
  *
753
1068
  * Positive values add time; negative values subtract time. The result is
754
1069
  * normalized through JavaScript Date rules, so overflowing months, days,
@@ -787,11 +1102,12 @@ export interface AddToDateOptions {
787
1102
  /**
788
1103
  * Adds or subtracts date/time units from a timestamp.
789
1104
  *
790
- * This function returns a new frozen {@link Timestamp}; it does not mutate the
791
- * timestamp passed in.
1105
+ * This function returns a new frozen Timestamp; it does not mutate the
1106
+ * timestamp passed in. Invalid target dates are normalized through JavaScript
1107
+ * Date rules, so month overflow can roll into the following month.
792
1108
  *
793
- * @param {Timestamp} timestamp The {@link Timestamp} object
794
- * @param {Object} options configuration data
1109
+ * @param {Timestamp} timestamp Timestamp object to offset.
1110
+ * @param {Object} options Date/time units to add or subtract.
795
1111
  * @param {number=} options.year If positive, adds years. If negative, removes years.
796
1112
  * @param {number=} options.month If positive, adds months. If negative, removes month.
797
1113
  * @param {number=} options.day If positive, adds days. If negative, removes days.
@@ -799,7 +1115,7 @@ export interface AddToDateOptions {
799
1115
  * @param {number=} options.minute If positive, adds minutes. If negative, removes minutes.
800
1116
  * @param {number=} options.second If positive, adds seconds. If negative, removes seconds.
801
1117
  * @param {number=} options.millisecond If positive, adds milliseconds. If negative, removes milliseconds.
802
- * @returns {Timestamp} A new normalized {@link Timestamp}
1118
+ * @returns {Timestamp} New normalized Timestamp object.
803
1119
  */
804
1120
  export declare function addToDate(timestamp: Timestamp, options: AddToDateOptions): Timestamp;
805
1121
  /**
@@ -811,11 +1127,11 @@ export declare function addToDate(timestamp: Timestamp, options: AddToDateOption
811
1127
  * March. Day and time offsets still use normal JavaScript Date normalization
812
1128
  * after the year/month clamp is applied.
813
1129
  *
814
- * This function returns a new frozen {@link Timestamp}; it does not mutate the
1130
+ * This function returns a new frozen Timestamp; it does not mutate the
815
1131
  * timestamp passed in.
816
1132
  *
817
- * @param {Timestamp} timestamp The {@link Timestamp} object
818
- * @param {Object} options configuration data
1133
+ * @param {Timestamp} timestamp Timestamp object to offset.
1134
+ * @param {Object} options Date/time units to add or subtract.
819
1135
  * @param {number=} options.year If positive, adds years. If negative, removes years.
820
1136
  * @param {number=} options.month If positive, adds months. If negative, removes month.
821
1137
  * @param {number=} options.day If positive, adds days. If negative, removes days.
@@ -823,22 +1139,94 @@ export declare function addToDate(timestamp: Timestamp, options: AddToDateOption
823
1139
  * @param {number=} options.minute If positive, adds minutes. If negative, removes minutes.
824
1140
  * @param {number=} options.second If positive, adds seconds. If negative, removes seconds.
825
1141
  * @param {number=} options.millisecond If positive, adds milliseconds. If negative, removes milliseconds.
826
- * @returns {Timestamp} A new normalized {@link Timestamp}
1142
+ * @returns {Timestamp} New normalized Timestamp object.
827
1143
  */
828
1144
  export declare function addToDateClamped(timestamp: Timestamp, options: AddToDateOptions): Timestamp;
829
1145
  /**
830
- * Returns number of days between two {@link Timestamp}s
831
- * @param {Timestamp} ts1 The first {@link Timestamp}
832
- * @param {Timestamp} ts2 The second {@link Timestamp}
1146
+ * Returns number of days between two Timestamps
1147
+ * @param {Timestamp} ts1 The first Timestamp
1148
+ * @param {Timestamp} ts2 The second Timestamp
833
1149
  * @returns Number of days
834
1150
  */
835
1151
  export declare function daysBetween(ts1: Timestamp, ts2: Timestamp): number;
836
1152
  /**
837
- * Returns number of weeks between two {@link Timestamp}s
838
- * @param {Timestamp} ts1 The first {@link Timestamp}
839
- * @param {Timestamp} ts2 The second {@link Timestamp}
1153
+ * Returns number of weeks between two Timestamps
1154
+ * @param {Timestamp} ts1 The first Timestamp
1155
+ * @param {Timestamp} ts2 The second Timestamp
840
1156
  */
841
1157
  export declare function weeksBetween(ts1: Timestamp, ts2: Timestamp): number;
1158
+ /**
1159
+ * Creates a TimestampDuration from signed milliseconds.
1160
+ *
1161
+ * @param {number} milliseconds Signed elapsed milliseconds.
1162
+ * @returns {TimestampDuration} Frozen duration object.
1163
+ */
1164
+ export declare function createDuration(milliseconds: number): TimestampDuration;
1165
+ /**
1166
+ * Measures the elapsed duration between two Timestamp values.
1167
+ *
1168
+ * Timestamp fields are read as UTC so the result is deterministic across
1169
+ * server and client runtimes.
1170
+ *
1171
+ * @param {Timestamp} start Start timestamp.
1172
+ * @param {Timestamp} end End timestamp.
1173
+ * @returns {TimestampDuration} Frozen duration object.
1174
+ */
1175
+ export declare function durationBetween(start: Timestamp, end: Timestamp): TimestampDuration;
1176
+ /**
1177
+ * Adds an elapsed duration to a Timestamp.
1178
+ *
1179
+ * This helper treats the Timestamp fields as UTC and returns a Timestamp built
1180
+ * from UTC fields. Use addToDate() for calendar-unit arithmetic such as
1181
+ * "one month from now".
1182
+ *
1183
+ * @param {Timestamp} timestamp Timestamp object to offset.
1184
+ * @param {TimestampDuration | number} duration Duration object or signed milliseconds.
1185
+ * @returns {Timestamp} Offset Timestamp.
1186
+ */
1187
+ export declare function addDuration(timestamp: Timestamp, duration: TimestampDuration | number): Timestamp;
1188
+ /**
1189
+ * Subtracts an elapsed duration from a Timestamp.
1190
+ *
1191
+ * @param {Timestamp} timestamp Timestamp object to offset.
1192
+ * @param {TimestampDuration | number} duration Duration object or signed milliseconds.
1193
+ * @returns {Timestamp} Offset Timestamp.
1194
+ */
1195
+ export declare function subtractDuration(timestamp: Timestamp, duration: TimestampDuration | number): Timestamp;
1196
+ /**
1197
+ * Formats a duration as `HH:mm:ss` or `HH:mm:ss.SSS`.
1198
+ *
1199
+ * Hours include full days, so a two-day duration formats as `48:00:00`.
1200
+ *
1201
+ * @param {TimestampDuration | number} duration Duration object or signed milliseconds.
1202
+ * @param {FormatDurationOptions=} options Formatting options.
1203
+ * @returns {string} Formatted duration.
1204
+ */
1205
+ export declare function formatDuration(duration: TimestampDuration | number, options?: FormatDurationOptions): string;
1206
+ /**
1207
+ * Floors a Timestamp down to the nearest interval.
1208
+ *
1209
+ * @param {Timestamp} timestamp Timestamp object to round.
1210
+ * @param {number} minutes Interval size in minutes.
1211
+ * @returns {Timestamp} Rounded Timestamp.
1212
+ */
1213
+ export declare function floorToInterval(timestamp: Timestamp, minutes: number): Timestamp;
1214
+ /**
1215
+ * Ceils a Timestamp up to the nearest interval.
1216
+ *
1217
+ * @param {Timestamp} timestamp Timestamp object to round.
1218
+ * @param {number} minutes Interval size in minutes.
1219
+ * @returns {Timestamp} Rounded Timestamp.
1220
+ */
1221
+ export declare function ceilToInterval(timestamp: Timestamp, minutes: number): Timestamp;
1222
+ /**
1223
+ * Rounds a Timestamp to the nearest interval.
1224
+ *
1225
+ * @param {Timestamp} timestamp Timestamp object to round.
1226
+ * @param {number} minutes Interval size in minutes.
1227
+ * @returns {Timestamp} Rounded Timestamp.
1228
+ */
1229
+ export declare function roundToInterval(timestamp: Timestamp, minutes: number): Timestamp;
842
1230
  declare const weekdayDateMap: {
843
1231
  Sun: Date;
844
1232
  Mon: Date;
@@ -867,11 +1255,11 @@ declare const weekdayDateMap: {
867
1255
  */
868
1256
  export declare function getWeekdayFormatter(): WeekdayFormatter;
869
1257
  /**
870
- * Retrieves an array of localized weekday names.
1258
+ * Retrieves localized weekday names.
871
1259
  *
872
- * @param {string} type - The format type for the weekday names. Can be 'narrow', 'short', or 'long'.
873
- * @param {string} [locale] - The locale to use for formatting. If not provided, the default locale is used.
874
- * @returns {string[]} An array of localized weekday names in the specified format.
1260
+ * @param {string} type Format type: `narrow`, `short`, or `long`.
1261
+ * @param {string} locale Locale to use for formatting, such as `en-US`.
1262
+ * @returns {string[]} Localized weekday names in Sunday-first order.
875
1263
  */
876
1264
  export declare function getWeekdayNames(type: string, locale: string): string[];
877
1265
  /**
@@ -888,118 +1276,12 @@ export declare function getWeekdayNames(type: string, locale: string): string[];
888
1276
  */
889
1277
  export declare function getMonthFormatter(): MonthFormatter;
890
1278
  /**
891
- * Retrieves an array of localized month names.
1279
+ * Retrieves localized month names.
892
1280
  *
893
- * @param {string} type - The format type for the month names. Can be 'narrow', 'short', or 'long'.
894
- * @param {string} [locale] - The locale to use for formatting. If not provided, the default locale is used.
895
- * @returns {string[]} An array of localized month names in the specified format.
1281
+ * @param {string} type Format type: `narrow`, `short`, or `long`.
1282
+ * @param {string} locale Locale to use for formatting, such as `en-US`.
1283
+ * @returns {string[]} Localized month names in January-first order.
896
1284
  */
897
1285
  export declare function getMonthNames(type: string, locale: string): string[];
898
- declare const _default: {
899
- PARSE_DATETIME: RegExp;
900
- PARSE_DATE: RegExp;
901
- PARSE_TIME: RegExp;
902
- DAYS_IN_MONTH: number[];
903
- DAYS_IN_MONTH_LEAP: number[];
904
- DAYS_IN_MONTH_MIN: number;
905
- DAYS_IN_MONTH_MAX: number;
906
- MONTH_MAX: number;
907
- MONTH_MIN: number;
908
- DAY_MIN: number;
909
- TIME_CONSTANTS: {
910
- MILLISECONDS_IN: {
911
- SECOND: number;
912
- MINUTE: number;
913
- HOUR: number;
914
- DAY: number;
915
- WEEK: number;
916
- };
917
- SECONDS_IN: {
918
- MINUTE: number;
919
- HOUR: number;
920
- DAY: number;
921
- WEEK: number;
922
- };
923
- MINUTES_IN: {
924
- MINUTE: number;
925
- HOUR: number;
926
- DAY: number;
927
- WEEK: number;
928
- };
929
- HOURS_IN: {
930
- DAY: number;
931
- WEEK: number;
932
- };
933
- DAYS_IN: {
934
- WEEK: number;
935
- };
936
- };
937
- DAYS_IN_WEEK: number;
938
- MINUTES_IN_HOUR: number;
939
- HOURS_IN_DAY: number;
940
- FIRST_HOUR: number;
941
- MILLISECONDS_IN_MINUTE: number;
942
- MILLISECONDS_IN_HOUR: number;
943
- MILLISECONDS_IN_DAY: number;
944
- MILLISECONDS_IN_WEEK: number;
945
- Timestamp: Timestamp;
946
- TimeObject: TimeObject;
947
- today: typeof today;
948
- getStartOfWeek: typeof getStartOfWeek;
949
- getEndOfWeek: typeof getEndOfWeek;
950
- getStartOfMonth: typeof getStartOfMonth;
951
- getEndOfMonth: typeof getEndOfMonth;
952
- parseTime: typeof parseTime;
953
- validateTimestamp: typeof validateTimestamp;
954
- parsed: typeof parsed;
955
- parseTimestamp: typeof parseTimestamp;
956
- parseDate: typeof parseDate;
957
- getDayIdentifier: typeof getDayIdentifier;
958
- getTimeIdentifier: typeof getTimeIdentifier;
959
- getDayTimeIdentifier: typeof getDayTimeIdentifier;
960
- diffTimestamp: typeof diffTimestamp;
961
- updateRelative: typeof updateRelative;
962
- updateMinutes: typeof updateMinutes;
963
- updateWeekday: typeof updateWeekday;
964
- updateDayOfYear: typeof updateDayOfYear;
965
- updateWorkWeek: typeof updateWorkWeek;
966
- updateDisabled: typeof updateDisabled;
967
- updateFormatted: typeof updateFormatted;
968
- getDayOfYear: typeof getDayOfYear;
969
- getWorkWeek: typeof getWorkWeek;
970
- getWeekday: typeof getWeekday;
971
- isLeapYear: typeof isLeapYear;
972
- daysInMonth: typeof daysInMonth;
973
- copyTimestamp: typeof copyTimestamp;
974
- padNumber: typeof padNumber;
975
- getDate: typeof getDate;
976
- getTime: typeof getTime;
977
- getDateTime: typeof getDateTime;
978
- nextDay: typeof nextDay;
979
- prevDay: typeof prevDay;
980
- relativeDays: typeof relativeDays;
981
- findWeekday: typeof findWeekday;
982
- createDayList: typeof createDayList;
983
- createIntervalList: typeof createIntervalList;
984
- createNativeLocaleFormatter: typeof createNativeLocaleFormatter;
985
- makeDate: typeof makeDate;
986
- makeDateTime: typeof makeDateTime;
987
- getDateObject: typeof getDateObject;
988
- validateNumber: typeof validateNumber;
989
- isBetweenDates: typeof isBetweenDates;
990
- isOverlappingDates: typeof isOverlappingDates;
991
- daysBetween: typeof daysBetween;
992
- weeksBetween: typeof weeksBetween;
993
- addToDate: typeof addToDate;
994
- addToDateClamped: typeof addToDateClamped;
995
- compareTimestamps: typeof compareTimestamps;
996
- compareDate: typeof compareDate;
997
- compareTime: typeof compareTime;
998
- compareDateTime: typeof compareDateTime;
999
- getWeekdayFormatter: typeof getWeekdayFormatter;
1000
- getWeekdayNames: typeof getWeekdayNames;
1001
- getMonthFormatter: typeof getMonthFormatter;
1002
- getMonthNames: typeof getMonthNames;
1003
- };
1004
- export default _default;
1286
+ export {};
1005
1287
  //# sourceMappingURL=index.d.ts.map