@dereekb/date 13.4.0 → 13.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "peerDependencies": {
5
- "@dereekb/model": "13.4.0",
6
- "@dereekb/rxjs": "13.4.0",
7
- "@dereekb/util": "13.4.0",
5
+ "@dereekb/model": "13.4.1",
6
+ "@dereekb/rxjs": "13.4.1",
7
+ "@dereekb/util": "13.4.1",
8
8
  "@vvo/tzdb": "^6.0.0",
9
9
  "arktype": "^2.2.0",
10
10
  "date-fns": "^4.0.0",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {},
16
16
  "devDependencies": {
17
- "@dereekb/rxjs": "13.4.0"
17
+ "@dereekb/rxjs": "13.4.1"
18
18
  },
19
19
  "exports": {
20
20
  "./package.json": "./package.json",
@@ -228,6 +228,11 @@ export declare function isValidDateCellTimingStartDate(date: Date): boolean;
228
228
  * The end date is used just to determine the number of days, but a minimum of 1 day is always enforced as a DateCellTiming must contain atleast 1 day.
229
229
  *
230
230
  * The start date from the inputDate is considered to to have the offset noted in DateCell, and will be retained.
231
+ *
232
+ * @param durationInput - the duration span containing the startsAt time and event duration in minutes
233
+ * @param rangeInput - specifies the date range: a number of days, a DateRange, or a DateRangeDayDistanceInput
234
+ * @param timezoneInput - optional timezone configuration; defaults to the system timezone if omitted
235
+ * @returns a fully computed FullDateCellTiming with start, startsAt, end, duration, and timezone
231
236
  */
232
237
  export declare function dateCellTiming(durationInput: DateDurationSpan, rangeInput: DateCellTimingRangeInput, timezoneInput?: DateCellTimingTimezoneInput): FullDateCellTiming;
233
238
  export interface DateCellTimingStartPair {
@@ -60,6 +60,9 @@ export type DateCellRangeOfTimingFactory = (input?: Maybe<DateCellRangeOfTimingI
60
60
  * When `limitToCompletedIndexes` is true, only indexes whose timing duration has fully elapsed are included,
61
61
  * with the max boundary lazily refreshed as time passes.
62
62
  *
63
+ * @param config - Configuration specifying the timing, range fit, and completion constraints.
64
+ * @returns A factory function that produces a clamped {@link DateCellRangeWithRange} from optional start/end input.
65
+ *
63
66
  * @example
64
67
  * ```ts
65
68
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -78,6 +81,10 @@ export declare function dateCellRangeOfTimingFactory(config: DateCallIndexRangeF
78
81
  * Computes a {@link DateCellRangeWithRange} from a timing and optional start/end input.
79
82
  *
80
83
  * Shorthand for creating a {@link dateCellRangeOfTimingFactory} and immediately invoking it.
84
+ *
85
+ * @param config - A {@link DateCellTiming} or full factory configuration.
86
+ * @param input - Optional start/end boundaries for the range.
87
+ * @returns A clamped {@link DateCellRangeWithRange} derived from the timing and input.
81
88
  */
82
89
  export declare function dateCellRangeOfTiming(config: DateCellTiming | DateCallIndexRangeFromDatesFactoryConfig, input?: Maybe<DateCellRangeOfTimingInput>): DateCellRangeWithRange;
83
90
  /**
@@ -89,12 +96,20 @@ export type DateCellTimingCompleteTimeRangeConfig = Pick<DateCallIndexRangeFromD
89
96
  * of the timing schedule. Useful for determining which days have already finished.
90
97
  *
91
98
  * By default fitToTimingRange is true.
99
+ *
100
+ * @param timing - The timing schedule to evaluate.
101
+ * @param config - Optional configuration for the current time reference and range fitting.
102
+ * @returns A {@link DateCellRangeWithRange} covering only the completed day indexes.
92
103
  */
93
104
  export declare function dateCellTimingCompletedTimeRange(timing: DateCellTiming, config?: DateCellTimingCompleteTimeRangeConfig): DateCellRangeWithRange;
94
105
  /**
95
106
  * Returns the latest completed day index for a {@link DateCellTiming}.
96
107
  *
97
108
  * Returns -1 if no days have been completed yet.
109
+ *
110
+ * @param timing - The timing schedule to evaluate.
111
+ * @param now - Optional reference time; defaults to the current time.
112
+ * @returns The zero-based index of the last fully completed day, or -1 if none.
98
113
  */
99
114
  export declare function dateCellTimingLatestCompletedIndex(timing: DateCellTiming, now?: Date): IndexNumber;
100
115
  /**
@@ -106,10 +121,16 @@ export declare function dateCellTimingLatestCompletedIndex(timing: DateCellTimin
106
121
  export type DateCellIndexRange = IndexRange;
107
122
  /**
108
123
  * Converts a {@link DateCellRange} (inclusive `to`) to a {@link DateCellIndexRange} (exclusive `maxIndex`).
124
+ *
125
+ * @param range - The inclusive date cell range to convert.
126
+ * @returns A {@link DateCellIndexRange} with exclusive `maxIndex`.
109
127
  */
110
128
  export declare function dateCellRangeToDateCellIndexRange(range: DateCellRange): DateCellIndexRange;
111
129
  /**
112
130
  * Converts a {@link DateCellIndexRange} (exclusive `maxIndex`) back to a {@link DateCellRangeWithRange} (inclusive `to`).
131
+ *
132
+ * @param range - The exclusive date cell index range to convert.
133
+ * @returns A {@link DateCellRangeWithRange} with inclusive `to`.
113
134
  */
114
135
  export declare function dateCellIndexRangeToDateCellRange(range: DateCellIndexRange): DateCellRangeWithRange;
115
136
  /**
@@ -117,6 +138,11 @@ export declare function dateCellIndexRangeToDateCellRange(range: DateCellIndexRa
117
138
  *
118
139
  * An arbitrary limit can also be applied. When `fitToTimingRange` is true (default),
119
140
  * the limit is intersected with the timing's own range; otherwise the limit is used as-is.
141
+ *
142
+ * @param timing - The timing schedule to derive the range from.
143
+ * @param limit - Optional range input to constrain the output.
144
+ * @param fitToTimingRange - Whether to intersect the limit with the timing's own range. Defaults to true.
145
+ * @returns A {@link DateCellIndexRange} representing the computed index bounds.
120
146
  */
121
147
  export declare function dateCellIndexRange(timing: DateCellTiming, limit?: DateCellTimingRangeInput, fitToTimingRange?: boolean): DateCellIndexRange;
122
148
  /**
@@ -124,12 +150,19 @@ export declare function dateCellIndexRange(timing: DateCellTiming, limit?: DateC
124
150
  * by combining its timing and blocks.
125
151
  *
126
152
  * Shorthand for calling {@link expandDateCellTiming} with `collection.timing` and `collection.blocks`.
153
+ *
154
+ * @param collection - The date cell collection containing timing and blocks to expand.
155
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times and durations.
127
156
  */
128
157
  export declare function expandDateCellCollection<B extends DateCell = DateCell>(collection: DateCellCollection<B>): DateCellDurationSpan<B>[];
129
158
  /**
130
159
  * Expands the given blocks into {@link DateCellDurationSpan} values using the provided timing.
131
160
  *
132
161
  * Shorthand for creating a {@link dateCellTimingExpansionFactory} and immediately invoking it.
162
+ *
163
+ * @param timing - The timing schedule providing start times and duration.
164
+ * @param blocks - The date cell blocks to expand into duration spans.
165
+ * @returns An array of {@link DateCellDurationSpan} values with concrete start times.
133
166
  */
134
167
  export declare function expandDateCellTiming<B extends DateCell = DateCell>(timing: DateCellTiming, blocks: B[]): DateCellDurationSpan<B>[];
135
168
  /**
@@ -186,6 +219,9 @@ export interface DateCellTimingExpansionFactoryConfig<B extends DateCell | DateC
186
219
  * Filtering is applied both at the block level and at the computed duration span level,
187
220
  * and evaluation can be capped for performance with large datasets.
188
221
  *
222
+ * @param config - Configuration specifying the timing, range limits, filters, and output caps.
223
+ * @returns A factory function that expands date cell blocks into {@link DateCellDurationSpan} arrays.
224
+ *
189
225
  * @example
190
226
  * ```ts
191
227
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
@@ -312,6 +348,9 @@ export type DateCellDayTimingInfoFactory = ((date: DateOrDateCellIndex, now?: Da
312
348
  * const dateInfo = infoFactory(someDate);
313
349
  * console.log(dateInfo.dayIndex); // which day index this date falls on
314
350
  * ```
351
+ *
352
+ * @param config - Configuration providing the timing and optional range limit.
353
+ * @returns A factory that computes {@link DateCellDayTimingInfo} for any date or day index.
315
354
  */
316
355
  export declare function dateCellDayTimingInfoFactory(config: DateCellDayTimingInfoFactoryConfig): DateCellDayTimingInfoFactory;
317
356
  /**
@@ -337,6 +376,9 @@ export type DateCellTimingRelativeIndexFactory<T extends DateCellTimingStartsAt
337
376
  * Type guard that returns true if the input is a {@link DateCellTimingRelativeIndexFactory}.
338
377
  *
339
378
  * Checks for the presence of `_timing` and `_normalInstance` properties on a function.
379
+ *
380
+ * @param input - The value to check.
381
+ * @returns True if the input is a {@link DateCellTimingRelativeIndexFactory}.
340
382
  */
341
383
  export declare function isDateCellTimingRelativeIndexFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(input: unknown): input is DateCellTimingRelativeIndexFactory<T>;
342
384
  /**
@@ -365,6 +407,9 @@ export declare function isDateCellTimingRelativeIndexFactory<T extends DateCellT
365
407
  * indexFactory._timing; // the original timing
366
408
  * indexFactory._normalInstance; // timezone normalizer
367
409
  * ```
410
+ *
411
+ * @param input - A timing configuration or an existing factory (returned as-is).
412
+ * @returns A factory that converts dates, ISO8601 day strings, or indexes to zero-based day offsets.
368
413
  */
369
414
  export declare function dateCellTimingRelativeIndexFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(input: T | DateCellTimingRelativeIndexFactory<T>): DateCellTimingRelativeIndexFactory<T>;
370
415
  /**
@@ -382,6 +427,9 @@ export type DateCellTimingRelativeIndexArrayFactory<T extends DateCellTimingStar
382
427
  * dates, date ranges, and cell ranges into a flat array of day indexes.
383
428
  *
384
429
  * Date ranges and cell ranges are expanded to include every index within the range.
430
+ *
431
+ * @param indexFactory - The relative index factory used for date-to-index conversion.
432
+ * @returns A factory that flattens mixed date/range arrays into day index arrays.
385
433
  */
386
434
  export declare function dateCellTimingRelativeIndexArrayFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(indexFactory: DateCellTimingRelativeIndexFactory<T>): DateCellTimingRelativeIndexArrayFactory<T>;
387
435
  /**
@@ -400,6 +448,10 @@ export declare function dateCellTimingRelativeIndexArrayFactory<T extends DateCe
400
448
  * // Get the index for a specific date
401
449
  * const index = getRelativeIndexForDateCellTiming(timing, someDate);
402
450
  * ```
451
+ *
452
+ * @param timing - The timing providing the start date and timezone context.
453
+ * @param date - A date or index to convert; defaults to the current date/time.
454
+ * @returns The zero-based day index relative to the timing's start.
403
455
  */
404
456
  export declare function getRelativeIndexForDateCellTiming(timing: DateCellTimingStartsAt, date?: DateOrDateCellIndex): DateCellIndex;
405
457
  /**
@@ -433,6 +485,9 @@ export type DateCellTimingDateFactory<T extends DateCellTimingStartsAt = DateCel
433
485
  * // Convert index 3 to a date with a specific reference time
434
486
  * const dateForDay3AtNoon = dateFactory(3, noonDate);
435
487
  * ```
488
+ *
489
+ * @param timing - The timing providing the start date and timezone context.
490
+ * @returns A factory that maps day indexes to calendar dates preserving the current time-of-day.
436
491
  */
437
492
  export declare function dateCellTimingDateFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(timing: T): DateCellTimingDateFactory<T>;
438
493
  /**
@@ -446,6 +501,9 @@ export declare function dateCellTimingDateFactory<T extends DateCellTimingStarts
446
501
  * const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
447
502
  * const lastIndex = dateCellTimingEndIndex(timing); // 4 (zero-based, 5 days)
448
503
  * ```
504
+ *
505
+ * @param input - A timing or an existing relative index factory.
506
+ * @returns The zero-based index of the last day in the schedule.
449
507
  */
450
508
  export declare function dateCellTimingEndIndex(input: DateCellTiming | DateCellTimingRelativeIndexFactory<DateCellTiming>): IndexNumber;
451
509
  /**
@@ -471,6 +529,9 @@ export type DateCellTimingUseSystemAndIgnoreEnforcement = DateTimezoneConversion
471
529
  * for any day index relative to the timing's start.
472
530
  *
473
531
  * The returned date represents the beginning of the day in the timing's timezone context.
532
+ *
533
+ * @param input - A timing or an existing relative index factory.
534
+ * @returns A factory that maps day indexes to the start-of-day date in the timing's timezone.
474
535
  */
475
536
  export declare function dateCellTimingStartDateFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(input: T | DateCellTimingRelativeIndexFactory<T>): DateCellTimingStartDateFactory<T>;
476
537
  /**
@@ -502,6 +563,9 @@ export type DateCellTimingStartsAtDateFactory<T extends DateCellTimingStartsAt =
502
563
  * // Also works with dates
503
564
  * const startForDate = startsAtFactory(someDate);
504
565
  * ```
566
+ *
567
+ * @param input - A timing or an existing relative index factory.
568
+ * @returns A factory that computes the concrete event start time for any day index.
505
569
  */
506
570
  export declare function dateCellTimingStartsAtDateFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt>(input: T | DateCellTimingRelativeIndexFactory<T>): DateCellTimingStartsAtDateFactory<T>;
507
571
  /**
@@ -525,11 +589,18 @@ export type DateCellTimingEndDateFactory<T extends DateCellTiming = DateCellTimi
525
589
  * // Get the end time for day 2 (startsAt time + 60 minutes on day 2)
526
590
  * const day2End = endFactory(2);
527
591
  * ```
592
+ *
593
+ * @param input - A timing or an existing relative index factory.
594
+ * @returns A factory that computes the end time (startsAt + duration) for any day index.
528
595
  */
529
596
  export declare function dateCellTimingEndDateFactory<T extends DateCellTiming = DateCellTiming>(input: T | DateCellTimingRelativeIndexFactory<T>): DateCellTimingEndDateFactory<T>;
530
597
  /**
531
598
  * Convenience function that returns the calendar date for a given day index or date
532
599
  * relative to the timing. Shorthand for creating a {@link dateCellTimingDateFactory} and invoking it.
600
+ *
601
+ * @param timing - The timing providing the start date and timezone context.
602
+ * @param input - A date or day index to convert.
603
+ * @returns The calendar date corresponding to the input, preserving current time-of-day.
533
604
  */
534
605
  export declare function getRelativeDateForDateCellTiming(timing: DateCellTimingStartsAt, input: DateOrDateCellIndex): Date;
535
606
  /**
@@ -598,6 +669,9 @@ export interface UpdateDateCellTimingWithDateCellTimingEventInput {
598
669
  * });
599
670
  * // result has the same start day and end day, but new time-of-day and 90-minute duration
600
671
  * ```
672
+ *
673
+ * @param input - Configuration specifying the timing to update, the event source, and which aspects to replace.
674
+ * @returns A new {@link FullDateCellTiming} with the requested aspects replaced.
601
675
  */
602
676
  export declare function updateDateCellTimingWithDateCellTimingEvent(input: UpdateDateCellTimingWithDateCellTimingEventInput): FullDateCellTiming;
603
677
  /**
@@ -650,5 +724,8 @@ export interface IsDateWithinDateCellRangeConfig {
650
724
  * isInRange(6); // false - index 6 is outside [2, 5]
651
725
  * isInRange(someDate); // converts date to index, then checks containment
652
726
  * ```
727
+ *
728
+ * @param config - Configuration specifying the reference range and optional timezone context.
729
+ * @returns A predicate function that checks containment within the configured range.
653
730
  */
654
731
  export declare function isDateWithinDateCellRangeFunction(config: IsDateWithinDateCellRangeConfig): IsDateWithinDateCellRangeFunction;
@@ -12,6 +12,7 @@ export type DateCellDurationSpanFilterFunction<B extends DateCell = DateCell> =
12
12
  * Useful for identifying events or blocks that have already begun relative to a point in time.
13
13
  *
14
14
  * @param now - Reference time to compare against. Defaults to the current time.
15
+ * @returns a filter function that returns true for spans whose start time is at or before the reference time
15
16
  *
16
17
  * @example
17
18
  * ```ts
@@ -26,6 +27,7 @@ export declare function dateCellDurationSpanHasStartedFilterFunction<B extends D
26
27
  * The inverse of {@link dateCellDurationSpanHasStartedFilterFunction}. Useful for finding upcoming or future events.
27
28
  *
28
29
  * @param now - Reference time to compare against. Defaults to the current time.
30
+ * @returns a filter function that returns true for spans whose start time is strictly after the reference time
29
31
  *
30
32
  * @example
31
33
  * ```ts
@@ -41,6 +43,7 @@ export declare function dateCellDurationSpanHasNotStartedFilterFunction<B extend
41
43
  * Useful for identifying completed events.
42
44
  *
43
45
  * @param now - Reference time to compare against. Defaults to the current time.
46
+ * @returns a filter function that returns true for spans whose computed end time is at or before the reference time
44
47
  *
45
48
  * @example
46
49
  * ```ts
@@ -56,6 +59,7 @@ export declare function dateCellDurationSpanHasEndedFilterFunction<B extends Dat
56
59
  * still in progress or have not yet occurred.
57
60
  *
58
61
  * @param now - Reference time to compare against. Defaults to the current time.
62
+ * @returns a filter function that returns true for spans whose computed end time is strictly after the reference time
59
63
  *
60
64
  * @example
61
65
  * ```ts
@@ -79,6 +83,7 @@ export type ModifyDateCellsToFitRangeFunction = <B extends DateCell | DateCellRa
79
83
  * indices clamped to the range boundaries. Non-overlapping cells are excluded entirely.
80
84
  *
81
85
  * @param range - The target range to fit cells into.
86
+ * @returns a reusable function that clamps or filters date cells to the configured range
82
87
  *
83
88
  * @example
84
89
  * ```ts
@@ -95,6 +100,7 @@ export declare function modifyDateCellsToFitRangeFunction(range: DateCellRange):
95
100
  *
96
101
  * @param range - The target range to fit cells into.
97
102
  * @param input - The date cells to clamp or filter.
103
+ * @returns an array of date cells clamped to the range, with non-overlapping cells removed
98
104
  *
99
105
  * @example
100
106
  * ```ts
@@ -108,6 +114,7 @@ export declare function modifyDateCellsToFitRange<B extends DateCell | DateCellR
108
114
  *
109
115
  * @param range - The target range to fit the cell into.
110
116
  * @param input - The single date cell to clamp or exclude.
117
+ * @returns the clamped date cell, or `undefined` if it does not overlap the range
111
118
  *
112
119
  * @example
113
120
  * ```ts
@@ -18,6 +18,7 @@ export interface DateCellRange extends DateCell {
18
18
  * Does not check validity. Use {@link isValidDateCellRange} for that.
19
19
  *
20
20
  * @param input - value to check
21
+ * @returns true if the input is a DateCellRange
21
22
  */
22
23
  export declare function isDateCellRange(input: unknown): input is DateCellRange;
23
24
  /**
@@ -31,6 +32,7 @@ export type DateCellOrDateCellIndexOrDateCellRange = DateCellIndex | DateCell |
31
32
  * that is greater than or equal to `i`.
32
33
  *
33
34
  * @param input - range to validate
35
+ * @returns true if the range has valid non-negative indexes and `to` (when defined) is greater than or equal to `i`
34
36
  */
35
37
  export declare function isValidDateCellRange(input: DateCellRange): boolean;
36
38
  /**
@@ -39,6 +41,7 @@ export declare function isValidDateCellRange(input: DateCellRange): boolean;
39
41
  * Validates that each range is individually valid and that no ranges overlap or appear out of order.
40
42
  *
41
43
  * @param input - array of ranges to validate as a non-overlapping ascending series
44
+ * @returns true if the array is sorted in ascending order with no overlapping or duplicate indexes
42
45
  */
43
46
  export declare function isValidDateCellRangeSeries(input: DateCellRange[]): boolean;
44
47
  /**
@@ -47,6 +50,7 @@ export declare function isValidDateCellRangeSeries(input: DateCellRange[]): bool
47
50
  * The input range is not expected to be sorted.
48
51
  *
49
52
  * @param input - unsorted array of date cell ranges to scan
53
+ * @returns the smallest starting index found, or 0 if the input is empty
50
54
  */
51
55
  export declare function getLeastDateCellIndexInDateCellRanges(input: (DateCell | DateCellRange)[]): DateCellIndex;
52
56
  /**
@@ -55,6 +59,7 @@ export declare function getLeastDateCellIndexInDateCellRanges(input: (DateCell |
55
59
  * The input range is not expected to be sorted.
56
60
  *
57
61
  * @param input - unsorted array of date cell ranges to scan
62
+ * @returns the largest ending index found, or 0 if the input is empty
58
63
  */
59
64
  export declare function getGreatestDateCellIndexInDateCellRanges(input: (DateCell | DateCellRange)[]): DateCellIndex;
60
65
  /**
@@ -62,13 +67,21 @@ export declare function getGreatestDateCellIndexInDateCellRanges(input: (DateCel
62
67
  * along with references to the items that contain those extreme indexes.
63
68
  */
64
69
  export interface LeastAndGreatestDateCellIndexResult<T> {
65
- /** Smallest starting index found. */
70
+ /**
71
+ * Smallest starting index found.
72
+ */
66
73
  leastIndex: number;
67
- /** The item containing the smallest starting index. */
74
+ /**
75
+ * The item containing the smallest starting index.
76
+ */
68
77
  leastIndexItem: T;
69
- /** Largest ending index found (considers `to` values). */
78
+ /**
79
+ * Largest ending index found (considers `to` values).
80
+ */
70
81
  greatestIndex: number;
71
- /** The item containing the largest ending index. */
82
+ /**
83
+ * The item containing the largest ending index.
84
+ */
72
85
  greatestIndexItem: T;
73
86
  }
74
87
  /**
@@ -77,6 +90,7 @@ export interface LeastAndGreatestDateCellIndexResult<T> {
77
90
  * The input range is not expected to be sorted.
78
91
  *
79
92
  * @param input - unsorted array of date cell ranges to scan
93
+ * @returns an object with the least and greatest indexes and their source items, or null if the input is empty
80
94
  */
81
95
  export declare function getLeastAndGreatestDateCellIndexInDateCellRanges<T extends DateCellRange>(input: T[]): Maybe<LeastAndGreatestDateCellIndexResult<T>>;
82
96
  /**
@@ -100,12 +114,14 @@ export type DateOrDateRangeOrDateCellIndexOrDateCellRange = DateRange | DateOrDa
100
114
  *
101
115
  * @param i - starting cell index
102
116
  * @param to - ending cell index (inclusive); defaults to `i`
117
+ * @returns a DateCellRangeWithRange spanning from `i` to `to`
103
118
  */
104
119
  export declare function dateCellRange(i: number, to?: Maybe<number>): DateCellRangeWithRange;
105
120
  /**
106
121
  * Creates a single-cell {@link DateCellRangeWithRange} where both `i` and `to` equal the given index.
107
122
  *
108
123
  * @param dateCellIndex - the index for both start and end of the range
124
+ * @returns a DateCellRangeWithRange where `i` and `to` both equal the given index
109
125
  */
110
126
  export declare function dateCellRangeWithRangeFromIndex(dateCellIndex: DateCellIndex): DateCellRangeWithRange;
111
127
  /**
@@ -113,6 +129,7 @@ export declare function dateCellRangeWithRangeFromIndex(dateCellIndex: DateCellI
113
129
  * ensuring the result always has an explicit `to` value.
114
130
  *
115
131
  * @param input - index, cell, or range to normalize
132
+ * @returns a DateCellRangeWithRange with an explicit `to` value
116
133
  */
117
134
  export declare function dateCellRangeWithRange(input: DateCellOrDateCellIndexOrDateCellRange): DateCellRangeWithRange;
118
135
  /**
@@ -124,6 +141,7 @@ export type DateCellRangeIncludedByRangeFunction = (range: DateCellOrDateCellInd
124
141
  * fully contains the configured `inputRange`.
125
142
  *
126
143
  * @param inputRange - the range that must be fully included
144
+ * @returns a function that returns true when its argument fully contains `inputRange`
127
145
  */
128
146
  export declare function dateCellRangeIncludedByRangeFunction(inputRange: DateCellOrDateCellIndexOrDateCellRange): DateCellRangeIncludedByRangeFunction;
129
147
  /**
@@ -135,6 +153,7 @@ export type DateCellRangeOverlapsRangeFunction = (range: DateCellOrDateCellIndex
135
153
  * has any overlap with the configured `inputRange`.
136
154
  *
137
155
  * @param inputRange - the range to test for overlap against
156
+ * @returns a function that returns true when its argument overlaps with `inputRange`
138
157
  */
139
158
  export declare function dateCellRangeOverlapsRangeFunction(inputRange: DateCellOrDateCellIndexOrDateCellRange): DateCellRangeOverlapsRangeFunction;
140
159
  /**
@@ -142,18 +161,22 @@ export declare function dateCellRangeOverlapsRangeFunction(inputRange: DateCellO
142
161
  *
143
162
  * @param rangeA - first range to compare
144
163
  * @param rangeB - second range to compare
164
+ * @returns true if the two ranges share at least one common index
145
165
  */
146
166
  export declare function dateCellRangeOverlapsRange(rangeA: DateCellOrDateCellIndexOrDateCellRange, rangeB: DateCellOrDateCellIndexOrDateCellRange): boolean;
147
167
  /**
148
168
  * Returns a sort comparator that orders ranges first by starting index (`i`), then by ending index (`to`).
149
169
  *
150
170
  * In many cases {@link sortAscendingIndexNumberRefFunction} may be preferential when `to` ordering is not needed.
171
+ *
172
+ * @returns a comparator function that sorts ranges by `i` then by `to`
151
173
  */
152
174
  export declare function sortDateCellRangeAndSizeFunction<T extends DateCellRange>(): SortCompareFunction<T>;
153
175
  /**
154
176
  * Sorts the input date ranges in-place by ascending index using {@link sortAscendingIndexNumberRefFunction}.
155
177
  *
156
178
  * @param input - array of ranges to sort (mutated in place)
179
+ * @returns the same array, sorted in ascending index order
157
180
  */
158
181
  export declare function sortDateCellRanges<T extends DateCellRange>(input: T[]): T[];
159
182
  /**
@@ -169,6 +192,7 @@ export type DateCellRangeWithRange = Omit<DateCellRange, 'to'> & {
169
192
  * The input is sorted internally before grouping.
170
193
  *
171
194
  * @param input - cells or ranges to merge into contiguous groups
195
+ * @returns an array of non-overlapping contiguous DateCellRangeWithRange values
172
196
  *
173
197
  * @example
174
198
  * ```ts
@@ -186,18 +210,21 @@ export declare function groupToDateCellRanges(input: (DateCell | DateCellRange)[
186
210
  * Returns an array containing every individual index in the given date cell range (inclusive of both `i` and `to`).
187
211
  *
188
212
  * @param input - range to expand into individual indexes
213
+ * @returns an array of every DateCellIndex from `i` to `to` inclusive
189
214
  */
190
215
  export declare function allIndexesInDateCellRange(input: DateCellRange): DateCellIndex[];
191
216
  /**
192
217
  * Flattens an array of indexes and/or ranges into a single array of individual {@link DateCellIndex} values.
193
218
  *
194
219
  * @param input - mix of raw indexes and ranges to flatten
220
+ * @returns a flat array of all individual DateCellIndex values
195
221
  */
196
222
  export declare function allIndexesInDateCellRangesToArray(input: (DateCellIndex | DateCellRange)[]): DateCellIndex[];
197
223
  /**
198
224
  * Returns a deduplicated {@link Set} of all indexes within the input ranges.
199
225
  *
200
226
  * @param input - mix of raw indexes and ranges to collect
227
+ * @returns a Set containing every unique DateCellIndex from the input
201
228
  */
202
229
  export declare function allIndexesInDateCellRanges(input: (DateCellIndex | DateCellRange)[]): Set<DateCellIndex>;
203
230
  /**
@@ -205,6 +232,7 @@ export declare function allIndexesInDateCellRanges(input: (DateCellIndex | DateC
205
232
  *
206
233
  * @param blocks - cells or ranges to filter
207
234
  * @param range - bounding range that blocks must fall within
235
+ * @returns only the blocks that fall entirely within the given range
208
236
  */
209
237
  export declare function filterDateCellsInDateCellRange<T extends DateCell | DateCellRange>(blocks: T[], range: DateCellRangeWithRange): T[];
210
238
  /**
@@ -220,6 +248,7 @@ export type IsDateCellWithinDateCellRangeFunction = (input: IsDateCellWithinDate
220
248
  * is fully contained within `inputRange`.
221
249
  *
222
250
  * @param inputRange - the bounding range to test containment against
251
+ * @returns a function that returns true when its argument is fully contained within `inputRange`
223
252
  */
224
253
  export declare function isDateCellWithinDateCellRangeFunction(inputRange: IsDateCellWithinDateCellRangeInput): IsDateCellWithinDateCellRangeFunction;
225
254
  /**
@@ -227,6 +256,7 @@ export declare function isDateCellWithinDateCellRangeFunction(inputRange: IsDate
227
256
  *
228
257
  * @param range - the outer bounding range
229
258
  * @param contains - the cell or range to test for containment
259
+ * @returns true if `contains` is fully within `range`
230
260
  */
231
261
  export declare function isDateCellWithinDateCellRange(range: IsDateCellWithinDateCellRangeInput, contains: IsDateCellWithinDateCellRangeInput): boolean;
232
262
  /**
@@ -252,6 +282,7 @@ export interface DateCellRangeBlockCountInfo {
252
282
  * Internally groups overlapping ranges before counting so each index is counted only once.
253
283
  *
254
284
  * @param inputDateCellRange - one or more cells/ranges to analyze
285
+ * @returns count, total, and average statistics for the given ranges
255
286
  */
256
287
  export declare function dateCellRangeBlocksCountInfo(inputDateCellRange: ArrayOrValue<DateCell | DateCellRange>): DateCellRangeBlockCountInfo;
257
288
  /**
@@ -260,6 +291,7 @@ export declare function dateCellRangeBlocksCountInfo(inputDateCellRange: ArrayOr
260
291
  * Shorthand for `dateCellRangeBlocksCountInfo(input).count`.
261
292
  *
262
293
  * @param inputDateCellRange - one or more cells/ranges to count
294
+ * @returns the total number of individual cell indexes
263
295
  *
264
296
  * @example
265
297
  * ```ts
@@ -277,6 +309,7 @@ export type DateCellRangesFullyCoverDateCellRangeFunction = (range: DateCellRang
277
309
  * grouped range from `ranges` fully covers a given input range.
278
310
  *
279
311
  * @param ranges - the covering ranges to test against
312
+ * @returns a function that returns true when any single grouped range fully covers the input range
280
313
  */
281
314
  export declare function dateCellRangesFullyCoverDateCellRangeFunction(ranges: ArrayOrValue<DateCellRange>): DateCellRangesFullyCoverDateCellRangeFunction;
282
315
  /**
@@ -330,6 +363,7 @@ export interface GetNextDateCellTimingIndexResult<T extends DateCellRange> {
330
363
  * nearest future range's starting index is used.
331
364
  *
332
365
  * @param input - the current index and ranges to evaluate
366
+ * @returns classification of ranges as past/present/future and the next upcoming index
333
367
  *
334
368
  * @example
335
369
  * ```ts
@@ -352,6 +386,7 @@ export declare function getNextDateCellTimingIndex<T extends DateCellRange>(inpu
352
386
  *
353
387
  * @param range - the date cell range to classify
354
388
  * @param nowIndex - the reference index representing "now"
389
+ * @returns 'past', 'present', or 'future' depending on the range's position relative to `nowIndex`
355
390
  */
356
391
  export declare function dateRelativeStateForDateCellRangeComparedToIndex(range: DateCellRange, nowIndex: DateCellIndex): DateRelativeState;
357
392
  /**
@@ -359,6 +394,7 @@ export declare function dateRelativeStateForDateCellRangeComparedToIndex(range:
359
394
  * from `i` to `to` (inclusive). Each copy retains all properties of the original block.
360
395
  *
361
396
  * @param block - the range to expand
397
+ * @returns an array of single-cell copies, one per index from `i` to `to`
362
398
  *
363
399
  * @example
364
400
  * ```ts
@@ -381,12 +417,14 @@ export interface UniqueDateCellRange extends UniqueDateCell, DateCellRange {
381
417
  * Returns true if the input spans more than one cell (i.e., has a `to` value strictly greater than `i`).
382
418
  *
383
419
  * @param input - range or cell to check
420
+ * @returns true if `to` is defined and strictly greater than `i`
384
421
  */
385
422
  export declare function dateCellRangeHasRange(input: DateCellRange | UniqueDateCell): input is DateCellRangeWithRange;
386
423
  /**
387
424
  * Returns the effective ending index of a range: `to` if defined, otherwise `i`.
388
425
  *
389
426
  * @param input - range or cell to read
427
+ * @returns the `to` index if defined, otherwise `i`
390
428
  */
391
429
  export declare function dateCellEndIndex(input: DateCellRange | UniqueDateCell): IndexNumber;
392
430
  /**
@@ -404,6 +442,7 @@ export interface UniqueDateCellRangeGroup<B extends DateCellRange | UniqueDateCe
404
442
  * and `to` is the maximum ending index across all blocks.
405
443
  *
406
444
  * @param input - cells or ranges to group
445
+ * @returns a UniqueDateCellRangeGroup containing the sorted blocks with `i` at 0
407
446
  */
408
447
  export declare function groupUniqueDateCells<B extends DateCellRange | UniqueDateCell>(input: B[]): UniqueDateCellRangeGroup<B>;
409
448
  /**
@@ -472,6 +511,7 @@ export type ExpandUniqueDateCellsFunction<B extends DateCellRange | UniqueDateCe
472
511
  * according to the provided configuration. Handles overlap resolution, gap filling, and boundary clamping.
473
512
  *
474
513
  * @param config - controls start/end bounds, fill strategy, and overlap retention behavior
514
+ * @returns a function that merges, fills, and resolves overlaps in date cell range arrays
475
515
  *
476
516
  * @example
477
517
  * ```ts
@@ -555,6 +555,8 @@ export interface DateCellScheduleDateCellTimingFilterConfig {
555
555
  * Creates a DateCellScheduleDateCellTimingFilter that tests whether a DateCell block's index is allowed by the schedule within the given timing.
556
556
  *
557
557
  * @param config - timing and schedule to build the filter from
558
+ * @param config.timing - the DateCellTiming that defines the date range and event times for the filter
559
+ * @param config.schedule - the DateCellSchedule that controls which day codes and indices are included or excluded
558
560
  * @returns a decision function returning true for allowed blocks
559
561
  */
560
562
  export declare function dateCellScheduleDateCellTimingFilter<B extends DateCell = DateCell>({ timing, schedule }: DateCellScheduleDateCellTimingFilterConfig): DateCellScheduleDateCellTimingFilter<B>;
@@ -96,6 +96,8 @@ export declare function daysToMinutes(days?: number): Minutes;
96
96
  *
97
97
  * Useful as a default for "no expiration" comparisons.
98
98
  *
99
+ * @returns the MAX_FUTURE_DATE sentinel
100
+ *
99
101
  * @example
100
102
  * ```ts
101
103
  * const futureDate = maxFutureDate();
@@ -393,6 +395,10 @@ export declare function copyHoursAndMinutesFromUTCDate(target: Date, fromDate: D
393
395
  * Sets the hours and optionally minutes on a target date (defaults to now), with optional rounding to strip seconds/milliseconds.
394
396
  *
395
397
  * @param config - hours, optional minutes, and rounding options
398
+ * @param config.hours - the hours value to set
399
+ * @param config.minutes - optional minutes value to set
400
+ * @param config.removeSeconds - whether to zero out seconds
401
+ * @param config.roundDownToMinute - whether to zero out seconds and milliseconds (defaults to true)
396
402
  * @param target - date to modify (defaults to the current date/time)
397
403
  * @returns a new Date with the specified time values applied
398
404
  *