@dereekb/date 13.3.1 → 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.
@@ -57,6 +57,9 @@ export interface DateTimezoneConversionConfig {
57
57
  * isValidDateTimezoneConversionConfig({ timezone: 'America/Chicago' }); // true
58
58
  * isValidDateTimezoneConversionConfig({}); // false
59
59
  * ```
60
+ *
61
+ * @param input - the conversion config to validate
62
+ * @returns true if the config has at least one meaningful conversion property set
60
63
  */
61
64
  export declare function isValidDateTimezoneConversionConfig(input: DateTimezoneConversionConfig): boolean;
62
65
  /**
@@ -74,6 +77,10 @@ export type DateTimezoneConversionConfigUseSystemTimezone = {
74
77
  * isSameDateTimezoneConversionConfig({ timezone: 'UTC' }, { timezone: undefined }); // true
75
78
  * isSameDateTimezoneConversionConfig({ useSystemTimezone: true }, { timezone: 'America/Denver' }); // false
76
79
  * ```
80
+ *
81
+ * @param a - first conversion config to compare
82
+ * @param b - second conversion config to compare
83
+ * @returns true if both configs are logically equivalent
77
84
  */
78
85
  export declare function isSameDateTimezoneConversionConfig(a: DateTimezoneConversionConfig, b: DateTimezoneConversionConfig): boolean;
79
86
  /**
@@ -91,6 +98,7 @@ export declare function isSameDateTimezoneConversionConfig(a: DateTimezoneConver
91
98
  * ```
92
99
  *
93
100
  * @param date - required to determine the correct offset for that instant (DST-aware)
101
+ * @returns the system timezone UTC offset in milliseconds
94
102
  */
95
103
  export declare function getCurrentSystemOffsetInMs(date: Date): Milliseconds;
96
104
  /**
@@ -103,6 +111,7 @@ export declare function getCurrentSystemOffsetInMs(date: Date): Milliseconds;
103
111
  * ```
104
112
  *
105
113
  * @param date - required to determine the correct offset for that instant (DST-aware)
114
+ * @returns the system timezone UTC offset truncated to whole hours
106
115
  */
107
116
  export declare function getCurrentSystemOffsetInHours(date: Date): Hours;
108
117
  /**
@@ -118,6 +127,7 @@ export declare function getCurrentSystemOffsetInHours(date: Date): Hours;
118
127
  * ```
119
128
  *
120
129
  * @param date - required to determine the correct offset for that instant (DST-aware)
130
+ * @returns the system timezone UTC offset in minutes
121
131
  */
122
132
  export declare function getCurrentSystemOffsetInMinutes(date: Date): Minutes;
123
133
  /**
@@ -137,6 +147,7 @@ export declare function getCurrentSystemOffsetInMinutes(date: Date): Minutes;
137
147
  *
138
148
  * @param timezone - IANA timezone string (e.g. 'America/New_York')
139
149
  * @param date - the instant to evaluate, since DST may shift the offset
150
+ * @returns the UTC offset for the given timezone at the given instant, in milliseconds
140
151
  */
141
152
  export declare function calculateTimezoneOffset(timezone: TimezoneString, date: Date): Milliseconds;
142
153
  export type DateTimezoneConversionTarget = 'target' | 'base' | 'system';
@@ -194,6 +205,15 @@ export type DateTimezoneConversionMap<T = number> = {
194
205
  [key: string]: T;
195
206
  };
196
207
  export type DateTimezoneConversionFunction<T> = MapFunction<Milliseconds, T>;
208
+ /**
209
+ * Calculates offset values for every pair of conversion targets (target, base, system)
210
+ * and returns them as a keyed map (e.g. `'target-base'`, `'base-system'`).
211
+ *
212
+ * @param date - the reference date used to compute offsets
213
+ * @param converter - the converter instance providing offset calculations
214
+ * @param map - optional mapping function applied to each raw millisecond offset
215
+ * @returns a map of conversion-pair keys to their computed offset values
216
+ */
197
217
  export declare function calculateAllConversions<T = number>(date: Date, converter: DateTimezoneBaseDateConverter, map?: DateTimezoneConversionFunction<T>): DateTimezoneConversionMap<T>;
198
218
  export type DateTimezoneUtcNormalInstanceInput = Maybe<TimezoneString> | DateTimezoneConversionConfig;
199
219
  export type DateTimezoneUtcNormalInstanceTransformType = 'targetDateToBaseDate' | 'targetDateToSystemDate' | 'baseDateToTargetDate' | 'baseDateToSystemDate' | 'systemDateToTargetDate' | 'systemDateToBaseDate';
@@ -205,8 +225,32 @@ export type DateTimezoneUtcNormalInstanceTransformType = 'targetDateToBaseDate'
205
225
  * inverseDateTimezoneUtcNormalInstanceTransformType('targetDateToBaseDate'); // 'baseDateToTargetDate'
206
226
  * inverseDateTimezoneUtcNormalInstanceTransformType('systemDateToTargetDate'); // 'targetDateToSystemDate'
207
227
  * ```
228
+ *
229
+ * @param input - the transform type to invert
230
+ * @returns the inverse transform type for round-trip conversion
208
231
  */
209
232
  export declare function inverseDateTimezoneUtcNormalInstanceTransformType(input: DateTimezoneUtcNormalInstanceTransformType): DateTimezoneUtcNormalInstanceTransformType;
233
+ /**
234
+ * Configuration for {@link DateTimezoneUtcNormalInstance.safeMirroredConvertDate}.
235
+ */
236
+ export interface SafeMirroredConvertDateConfig {
237
+ /**
238
+ * The base date. Should have been derived from the originalContextDate using convertDate().
239
+ */
240
+ readonly baseDate: BaseDateAsUTC;
241
+ /**
242
+ * Original date used to derive the baseDate.
243
+ */
244
+ readonly originalContextDate: Date;
245
+ /**
246
+ * The "type" of date the originalContextDate is.
247
+ */
248
+ readonly contextType: DateTimezoneConversionTarget;
249
+ /**
250
+ * Whether to apply safe DST correction. Defaults to true.
251
+ */
252
+ readonly safeConvert?: boolean;
253
+ }
210
254
  /**
211
255
  * Central class for converting dates between the three date spaces (base, target, system).
212
256
  *
@@ -244,11 +288,10 @@ export declare class DateTimezoneUtcNormalInstance implements DateTimezoneBaseDa
244
288
  * For example, when daylight savings changed on November 3, 2024 the offset returned was 5 but to get back to the original an offset of 6 was required.
245
289
  * This is where some contextual data was not being used. This function uses that contextual data to make sure the reverse will be consistent.
246
290
  *
247
- * @param baseDate The base date. Should have been derived from the originalContextDate using the convertDate() function
248
- * @param originalContextDate Original date used to derive the baseDate.
249
- * @param fromOrTo the "type" of date the originalContextDate is
291
+ * @param config - configuration for the safe mirrored conversion
292
+ * @returns the converted date and the DST offset adjustment applied
250
293
  */
251
- safeMirroredConvertDate(baseDate: BaseDateAsUTC, originalContextDate: Date, contextType: DateTimezoneConversionTarget, safeConvert?: boolean): {
294
+ safeMirroredConvertDate(config: SafeMirroredConvertDateConfig): {
252
295
  date: Date;
253
296
  daylightSavingsOffset: number;
254
297
  };
@@ -277,46 +320,50 @@ export declare class DateTimezoneUtcNormalInstance implements DateTimezoneBaseDa
277
320
  /**
278
321
  * Returns true if the input is midnight in the target timezone.
279
322
  *
280
- * @param date
323
+ * @param date - the date to check
324
+ * @returns true if the date is at the start of the day in the target timezone
281
325
  */
282
326
  isStartOfDayInTargetTimezone(date: Date): boolean;
283
327
  /**
284
328
  * Start of the given day in the target timezone.
285
329
  *
286
- * @param date The input is treated as an instant in time.
330
+ * @param date - the input is treated as an instant in time
331
+ * @returns the start-of-day date in the target timezone
287
332
  */
288
333
  startOfDayInTargetTimezone(date?: Date | ISO8601DayString): Date;
289
334
  /**
290
335
  * Start of the given day in UTC.
291
336
  *
292
- * @param date
337
+ * @param date - the date or ISO8601 day string to get the start of day for
338
+ * @returns the start of the day as a BaseDateAsUTC
293
339
  */
294
340
  startOfDayInBaseDate(date?: Date | ISO8601DayString): BaseDateAsUTC;
295
341
  /**
296
342
  * End of the given day in UTC.
297
343
  *
298
- * @param date
299
- * @returns
344
+ * @param date - the date or ISO8601 day string to get the end of day for
345
+ * @returns the end of the day as a BaseDateAsUTC (23:59:59.999)
300
346
  */
301
347
  endOfDayInBaseDate(date?: Date | ISO8601DayString): BaseDateAsUTC;
302
348
  /**
303
349
  * Start of the given day for the system.
304
350
  *
305
- * @param date
306
- * @returns
351
+ * @param date - the date or ISO8601 day string to get the start of day for
352
+ * @returns the start of the day in the system timezone
307
353
  */
308
354
  startOfDayInSystemDate(date?: Date | ISO8601DayString): Date;
309
355
  /**
310
356
  * End of the given day for the system.
311
357
  *
312
- * @param date
313
- * @returns
358
+ * @param date - the date or ISO8601 day string to get the end of day for
359
+ * @returns the end of the day in the system timezone
314
360
  */
315
361
  endOfDayInSystemDate(date?: Date | ISO8601DayString): Date;
316
362
  /**
317
- * Whether or not the system experiences daylight savings for the given year.
363
+ * Whether or not the target timezone experiences daylight savings for the given year.
318
364
  *
319
- * @param year
365
+ * @param year - the year to check, as a Date or number; defaults to the current year
366
+ * @returns true if the target timezone has different offsets in January and July
320
367
  */
321
368
  targetTimezoneExperiencesDaylightSavings(year?: Date | YearNumber): boolean;
322
369
  /**
@@ -351,6 +398,8 @@ export type DateTimezoneUtcNormalFunctionInput = DateTimezoneUtcNormalInstanceIn
351
398
  * const same = dateTimezoneUtcNormal(denver); // same reference
352
399
  * ```
353
400
  *
401
+ * @param config - timezone input: an existing instance, timezone string, millisecond offset, or config object
402
+ * @returns a DateTimezoneUtcNormalInstance for the given input
354
403
  * @throws Error if the input type is not recognized
355
404
  */
356
405
  export declare function dateTimezoneUtcNormal(config: DateTimezoneUtcNormalFunctionInput): DateTimezoneUtcNormalInstance;
@@ -370,6 +419,8 @@ export declare const UTC_DATE_TIMEZONE_UTC_NORMAL_INSTANCE: DateTimezoneUtcNorma
370
419
  *
371
420
  * Prefer this over constructing a new instance when you need system-timezone conversions,
372
421
  * as the singleton avoids unnecessary allocations.
422
+ *
423
+ * @returns the shared system-timezone DateTimezoneUtcNormalInstance singleton
373
424
  */
374
425
  export declare function systemDateTimezoneUtcNormal(): DateTimezoneUtcNormalInstance;
375
426
  /**
@@ -385,6 +436,10 @@ export declare function systemDateTimezoneUtcNormal(): DateTimezoneUtcNormalInst
385
436
  * const target = baseDateToTargetDate(base, 'America/Denver');
386
437
  * // target is 2024-06-15T14:00:00.000-06:00 (2PM MDT)
387
438
  * ```
439
+ *
440
+ * @param date - the BaseDateAsUTC to convert
441
+ * @param timezone - the target IANA timezone string
442
+ * @returns a real instant in the specified timezone
388
443
  */
389
444
  export declare function baseDateToTargetDate(date: Date, timezone: Maybe<TimezoneString>): Date;
390
445
  /**
@@ -400,32 +455,51 @@ export declare function baseDateToTargetDate(date: Date, timezone: Maybe<Timezon
400
455
  * const base = targetDateToBaseDate(target, 'America/Denver');
401
456
  * // base is 2024-06-15T14:00:00.000Z — wall-clock 2PM preserved as UTC
402
457
  * ```
458
+ *
459
+ * @param date - the target-timezone date to convert
460
+ * @param timezone - the IANA timezone the date is expressed in
461
+ * @returns a BaseDateAsUTC with wall-clock time preserved as UTC
403
462
  */
404
463
  export declare function targetDateToBaseDate(date: Date, timezone: Maybe<TimezoneString>): Date;
405
464
  /**
406
465
  * Converts a {@link BaseDateAsUTC} to a target date in the system's local timezone
407
466
  * using the shared system-timezone instance.
467
+ *
468
+ * @param date - the BaseDateAsUTC to convert
469
+ * @returns the date converted to the system's local timezone
408
470
  */
409
471
  export declare function systemBaseDateToNormalDate(date: Date): BaseDateAsUTC;
410
472
  /**
411
473
  * Converts a target date in the system's local timezone back to a {@link BaseDateAsUTC}
412
474
  * using the shared system-timezone instance.
475
+ *
476
+ * @param date - the system-timezone target date to convert back to base
477
+ * @returns the corresponding BaseDateAsUTC
413
478
  */
414
479
  export declare function systemNormalDateToBaseDate(date: BaseDateAsUTC): Date;
415
480
  /**
416
481
  * Returns the millisecond offset needed to convert a {@link BaseDateAsUTC} to a target date
417
482
  * in the system's local timezone.
483
+ *
484
+ * @param date - the date to compute the offset for
485
+ * @returns the offset in milliseconds
418
486
  */
419
487
  export declare function systemBaseDateToNormalDateOffset(date: Date): Milliseconds;
420
488
  /**
421
489
  * Returns the millisecond offset needed to convert a target date in the system's
422
490
  * local timezone back to a {@link BaseDateAsUTC}.
491
+ *
492
+ * @param date - the date to compute the offset for
493
+ * @returns the offset in milliseconds
423
494
  */
424
495
  export declare function systemNormalDateToBaseDateOffset(date: Date): Milliseconds;
425
496
  /**
426
497
  * Returns whether the system's local timezone observes daylight saving time in the given year.
427
498
  *
428
499
  * Compares the offset on January 1 and July 1; if they differ, DST is in effect for part of the year.
500
+ *
501
+ * @param year - the year to check, as a Date
502
+ * @returns true if the system timezone observes DST in the given year
429
503
  */
430
504
  export declare function systemExperiencesDaylightSavings(year: Date): boolean;
431
505
  /**
@@ -450,7 +524,9 @@ export type TransformDateInTimezoneNormalFunction = ((date: Date, transform: Map
450
524
  * const result = fn(someDate, (d) => startOfDay(d));
451
525
  * ```
452
526
  *
527
+ * @param timezoneInput - timezone configuration for the conversion
453
528
  * @param transformType - defaults to `'systemDateToTargetDate'`
529
+ * @returns a function that transforms dates within the specified timezone normalization
454
530
  */
455
531
  export declare function transformDateInTimezoneNormalFunction(timezoneInput: DateTimezoneUtcNormalFunctionInput, transformType?: DateTimezoneUtcNormalInstanceTransformType): TransformDateInTimezoneNormalFunction;
456
532
  /**
@@ -465,7 +541,9 @@ export type TransformDateRangeToTimezoneFunction = TransformDateRangeDatesFuncti
465
541
  * Creates a {@link TransformDateRangeToTimezoneFunction} that converts both dates in
466
542
  * a {@link DateRange} using the specified transform type.
467
543
  *
544
+ * @param timezoneInput - timezone configuration for the conversion
468
545
  * @param transformType - defaults to `'systemDateToTargetDate'`
546
+ * @returns a function that converts DateRange dates using the specified transform
469
547
  */
470
548
  export declare function transformDateRangeToTimezoneFunction(timezoneInput: DateTimezoneUtcNormalFunctionInput, transformType?: DateTimezoneUtcNormalInstanceTransformType): TransformDateRangeToTimezoneFunction;
471
549
  /**
@@ -481,7 +559,9 @@ export type TransformDateRangeInTimezoneNormalFunction = ((dateRange: DateRange,
481
559
  * Creates a {@link TransformDateRangeInTimezoneNormalFunction} that converts a date range
482
560
  * into the specified date space, applies a user-provided range transformation, then converts back.
483
561
  *
562
+ * @param timezoneInput - timezone configuration for the conversion
484
563
  * @param transformType - defaults to `'systemDateToTargetDate'`
564
+ * @returns a function that transforms date ranges within the specified timezone normalization
485
565
  */
486
566
  export declare function transformDateRangeInTimezoneNormalFunction(timezoneInput: DateTimezoneUtcNormalFunctionInput, transformType?: DateTimezoneUtcNormalInstanceTransformType): TransformDateRangeInTimezoneNormalFunction;
487
567
  /**
@@ -498,6 +578,9 @@ export type StartOfDayInTimezoneDayStringFactory = (day: ISO8601DayString) => Da
498
578
  * const midnight = startOfDayInDenver('2024-06-15');
499
579
  * // midnight is 2024-06-15T06:00:00.000Z (midnight MDT = 6AM UTC)
500
580
  * ```
581
+ *
582
+ * @param timezone - timezone configuration to bind the factory to
583
+ * @returns a factory that converts ISO8601 day strings to start-of-day dates
501
584
  */
502
585
  export declare function startOfDayInTimezoneDayStringFactory(timezone?: DateTimezoneUtcNormalFunctionInput): StartOfDayInTimezoneDayStringFactory;
503
586
  /**
@@ -509,6 +592,10 @@ export declare function startOfDayInTimezoneDayStringFactory(timezone?: DateTime
509
592
  * ```ts
510
593
  * const midnight = startOfDayInTimezoneFromISO8601DayString('2024-06-15', 'America/Denver');
511
594
  * ```
595
+ *
596
+ * @param day - the ISO8601 day string to parse
597
+ * @param timezone - timezone configuration for the start-of-day calculation
598
+ * @returns the start-of-day instant in the given timezone
512
599
  */
513
600
  export declare function startOfDayInTimezoneFromISO8601DayString(day: ISO8601DayString, timezone?: DateTimezoneUtcNormalFunctionInput): Date;
514
601
  export interface SetOnDateWithTimezoneNormalFunctionInput {
@@ -582,6 +669,9 @@ export type SetOnDateWithTimezoneNormalFunction = ((input: SetOnDateWithTimezone
582
669
  * const result = setOnDate({ date: someDate, hours: 14, minutes: 30, inputType: 'target' });
583
670
  * // result is someDate with hours set to 14:30 in Denver time
584
671
  * ```
672
+ *
673
+ * @param timezone - the timezone configuration to bind to
674
+ * @returns a function that sets hours/minutes on dates in the given timezone
585
675
  */
586
676
  export declare function setOnDateWithTimezoneNormalFunction(timezone: DateTimezoneUtcNormalFunctionInput): SetOnDateWithTimezoneNormalFunction;
587
677
  /**
@@ -591,6 +681,7 @@ export declare function setOnDateWithTimezoneNormalFunction(timezone: DateTimezo
591
681
  *
592
682
  * @param input - the date whose day is preserved
593
683
  * @param timezone - the timezone context for the hour/minute interpretation
684
+ * @returns the input date with hours and minutes set to the current time in the given timezone
594
685
  */
595
686
  export declare function copyHoursAndMinutesFromNowWithTimezoneNormal(input: Date, timezone: DateTimezoneUtcNormalFunctionInput): Date;
596
687
  /**
@@ -610,5 +701,6 @@ export declare function copyHoursAndMinutesFromNowWithTimezoneNormal(input: Date
610
701
  * @param input - the date whose day is preserved
611
702
  * @param copyFrom - the date (or `'now'`) whose hours/minutes are copied
612
703
  * @param timezone - the timezone context for interpreting both dates
704
+ * @returns the input date with hours and minutes copied from the source
613
705
  */
614
706
  export declare function copyHoursAndMinutesFromDateWithTimezoneNormal(input: Date, copyFrom: LogicalDate, timezone: DateTimezoneUtcNormalFunctionInput): Date;
@@ -104,7 +104,7 @@ export interface YearWeekCodeConfig {
104
104
  *
105
105
  * Configured to use the system timezone by default.
106
106
  */
107
- timezone?: YearWeekCodeDateTimezoneInput;
107
+ readonly timezone?: YearWeekCodeDateTimezoneInput;
108
108
  }
109
109
  /**
110
110
  * Resolves a timezone input into a {@link DateTimezoneUtcNormalInstance} for use with YearWeekCode calculations.
@@ -118,6 +118,9 @@ export declare function yearWeekCodeDateTimezoneInstance(input: YearWeekCodeDate
118
118
  /**
119
119
  * Computes the {@link YearWeekCode} from a Date (using system timezone) or from explicit year and week values.
120
120
  *
121
+ * @param date - the date to compute the week code for
122
+ * @returns the encoded year+week code
123
+ *
121
124
  * @example
122
125
  * ```ts
123
126
  * yearWeekCode(new Date('2024-04-15')); // 202416
@@ -158,6 +161,7 @@ export declare function yearWeekCodeForDateRange(dateRange: DateRange): YearWeek
158
161
  *
159
162
  * @param dateRange - the range to compute week codes for
160
163
  * @param dateRangeTimezone - the timezone context for accurate week boundary calculation
164
+ * @returns an array of YearWeekCode values covering the range
161
165
  */
162
166
  export declare function yearWeekCodeForDateRangeInTimezone(dateRange: DateRange, dateRangeTimezone: YearWeekCodeDateTimezoneInput): YearWeekCode[];
163
167
  /**
@@ -175,6 +179,7 @@ export type YearWeekCodeForCalendarMonthFactory = (date: Date) => YearWeekCode[]
175
179
  * Returns all {@link YearWeekCode} values for the calendar month containing the given date, using the system timezone.
176
180
  *
177
181
  * @param date - a date within the target month
182
+ * @returns an array of YearWeekCode values for the month
178
183
  */
179
184
  export declare function yearWeekCodeForCalendarMonth(date: Date): YearWeekCode[];
180
185
  /**
@@ -232,9 +237,9 @@ export type YearWeekCodeGroupFactory<B> = (items: B[]) => YearWeekCodeGroup<B>[]
232
237
  export type YearWeekCodeDateReader<B> = MapFunction<B, Maybe<Date | YearWeekCode | YearWeekCodeString>>;
233
238
  export type YearWeekCodeReader = MapFunction<YearWeekCode | YearWeekCodeString, YearWeekCode>;
234
239
  export interface YearWeekCodeGroupFactoryConfig<B> {
235
- yearWeekCodeFactory?: YearWeekCodeFactory | YearWeekCodeConfig;
236
- yearWeekCodeReader?: YearWeekCodeReader;
237
- dateReader: YearWeekCodeDateReader<B>;
240
+ readonly yearWeekCodeFactory?: YearWeekCodeFactory | YearWeekCodeConfig;
241
+ readonly yearWeekCodeReader?: YearWeekCodeReader;
242
+ readonly dateReader: YearWeekCodeDateReader<B>;
238
243
  }
239
244
  /**
240
245
  * Creates a {@link YearWeekCodeGroupFactory} that groups items by their {@link YearWeekCode}.
@@ -4,7 +4,6 @@ export * from './date.cell.index';
4
4
  export * from './date.cell.schedule';
5
5
  export * from './date.cell.schedule.day';
6
6
  export * from './date.cell';
7
- export * from './date.cell.validator';
8
7
  export * from './date.cell.week';
9
8
  export * from './date.calendar';
10
9
  export * from './date.duration';
@@ -5,11 +5,17 @@ import { type DateQueryBuilder } from './query.builder';
5
5
  * used by {@link makeMongoDBLikeDateQueryBuilder} to produce query filters.
6
6
  */
7
7
  export interface TimeFieldsNameSet {
8
- /** Field name storing the start (or combined start+end) timestamp. */
8
+ /**
9
+ * Field name storing the start (or combined start+end) timestamp.
10
+ */
9
11
  start: string;
10
- /** Field name storing the end timestamp. Ignored when `singleFieldForStartAndEnd` is true. */
12
+ /**
13
+ * Field name storing the end timestamp. Ignored when `singleFieldForStartAndEnd` is true.
14
+ */
11
15
  end?: string;
12
- /** When true, a single field represents both start and end so range bounds are merged. */
16
+ /**
17
+ * When true, a single field represents both start and end so range bounds are merged.
18
+ */
13
19
  singleFieldForStartAndEnd?: boolean;
14
20
  }
15
21
  /**
@@ -7,9 +7,13 @@ import { type TimezoneString } from '@dereekb/util';
7
7
  * {@link ModelRecurrenceInfo} and a convenience boolean flag.
8
8
  */
9
9
  export interface RecurrenceModel {
10
- /** Detailed recurrence metadata; undefined when the model does not recur. */
10
+ /**
11
+ * Detailed recurrence metadata; undefined when the model does not recur.
12
+ */
11
13
  recur?: ModelRecurrenceInfo;
12
- /** Quick check for whether this model has active recurrence rules. */
14
+ /**
15
+ * Quick check for whether this model has active recurrence rules.
16
+ */
13
17
  recurs: boolean;
14
18
  }
15
19
  /**
@@ -19,15 +23,25 @@ export interface RecurrenceModel {
19
23
  * date-range utilities.
20
24
  */
21
25
  export interface ModelRecurrenceInfo extends DateRange {
22
- /** Timezone the rule is a part of. Required for RRules that have timezone-sensitive implementations. */
26
+ /**
27
+ * Timezone the rule is a part of. Required for RRules that have timezone-sensitive implementations.
28
+ */
23
29
  timezone?: TimezoneString;
24
- /** RRules for this recurrence. */
30
+ /**
31
+ * RRules for this recurrence.
32
+ */
25
33
  rrule: RRuleLines;
26
- /** First instance of the recurrence. */
34
+ /**
35
+ * First instance of the recurrence.
36
+ */
27
37
  start: Date;
28
- /** Final instance of the recurrence. */
38
+ /**
39
+ * Final instance of the recurrence.
40
+ */
29
41
  end: Date;
30
- /** True if the recurrence has no end. */
42
+ /**
43
+ * True if the recurrence has no end.
44
+ */
31
45
  forever?: boolean;
32
46
  }
33
47
  /**
@@ -191,6 +191,8 @@ export declare class DateRRuleInstance {
191
191
  /**
192
192
  * Returns `true` when the underlying RRule has neither a `count` nor an
193
193
  * `until` constraint, meaning it recurs indefinitely.
194
+ *
195
+ * @returns `true` if the rule recurs indefinitely.
194
196
  */
195
197
  hasForeverRange(): boolean;
196
198
  }
@@ -39,6 +39,8 @@ export declare class DateRRule extends RRule {
39
39
  * const rule = new DateRRule({ freq: RRule.DAILY, count: 5, dtstart: startDate });
40
40
  * const lastDate = rule.last(); // fifth occurrence
41
41
  * ```
42
+ *
43
+ * @returns The last occurrence date, or `undefined` if there are none.
42
44
  */
43
45
  last(): Maybe<Date>;
44
46
  /**
@@ -49,6 +51,9 @@ export declare class DateRRule extends RRule {
49
51
  * const rule = new DateRRule({ freq: RRule.WEEKLY, dtstart: startDate });
50
52
  * const nextDate = rule.next(new Date());
51
53
  * ```
54
+ *
55
+ * @param minDate - The earliest date to consider.
56
+ * @returns The first occurrence on or after `minDate`, or `undefined` if none.
52
57
  */
53
58
  next(minDate: Date): Maybe<Date>;
54
59
  /**
@@ -59,6 +64,11 @@ export declare class DateRRule extends RRule {
59
64
  * const rule = new DateRRule({ freq: RRule.DAILY, dtstart: startDate });
60
65
  * const exists = rule.any({ minDate: rangeStart, maxDate: rangeEnd });
61
66
  * ```
67
+ *
68
+ * @param filter - Optional date bounds with `minDate` and `maxDate`.
69
+ * @param filter.minDate - Optional minimum date bound.
70
+ * @param filter.maxDate - Optional maximum date bound.
71
+ * @returns `true` if at least one recurrence falls within the bounds.
62
72
  */
63
73
  any(filter?: {
64
74
  minDate?: Maybe<Date>;
@@ -102,6 +102,10 @@ export interface RRuleExdateAttribute {
102
102
  /**
103
103
  * Delimiter separating the property name/params from values in an RRule line.
104
104
  */
105
+ export declare const RRULE_STRING_SPLITTER = ":";
106
+ /**
107
+ * @deprecated use RRULE_STRING_SPLITTER instead.
108
+ */
105
109
  export declare const RRuleStringSplitter = ":";
106
110
  /**
107
111
  * Utility class for parsing and manipulating RFC 5545 RRule strings.
@@ -128,21 +132,32 @@ export declare class DateRRuleParseUtility {
128
132
  * // result.basic = ['RRULE:FREQ=DAILY']
129
133
  * // result.exdates contains the parsed exclusion dates
130
134
  * ```
135
+ *
136
+ * @param input - The RRule string line set to separate.
137
+ * @returns The separated basic rules and parsed EXDATE exclusion dates.
131
138
  */
132
139
  static separateRRuleStringSetValues(input: RRuleStringLineSet): RRuleStringSetSeparation;
133
140
  /**
134
141
  * Parses an EXDATE line into its timezone and date components.
135
142
  *
143
+ * @param line - The raw EXDATE line string to parse.
144
+ * @returns The parsed EXDATE attribute with timezone and dates.
136
145
  * @throws Error if the line is not an EXDATE property.
137
146
  */
138
147
  static parseExdateAttributeFromLine(line: RRuleLineString): RRuleExdateAttribute;
139
148
  /**
140
149
  * Extracts timezone and UTC-normalized dates from an already-parsed EXDATE property.
150
+ *
151
+ * @param property - The parsed EXDATE property to extract from.
152
+ * @returns The EXDATE attribute containing timezone and UTC-normalized dates.
141
153
  */
142
154
  static parseExdateAttributeFromProperty(property: RRuleProperty): RRuleExdateAttribute;
143
155
  /**
144
156
  * Convenience wrapper that creates a timezone converter and delegates to {@link parseDateTimeString}.
145
157
  *
158
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
159
+ * @param timezone - Optional timezone for non-UTC date strings.
160
+ * @returns The parsed JavaScript Date.
146
161
  * @throws Error if the date string is not UTC and no timezone is provided.
147
162
  */
148
163
  static parseDateTimeStringWithTimezone(rfcDateString: RFC5545DateString | RFC5545DateTimeString, timezone: Maybe<string>): Date;
@@ -152,6 +167,9 @@ export declare class DateRRuleParseUtility {
152
167
  * If the string does not end in `Z` (indicating UTC), the converter is used to normalize
153
168
  * the local date representation to its true UTC equivalent.
154
169
  *
170
+ * @param rfcDateString - The RFC 5545 date or date-time string to parse.
171
+ * @param converter - Optional timezone converter for non-UTC date strings.
172
+ * @returns The parsed JavaScript Date.
155
173
  * @throws Error if the string cannot be parsed or a non-UTC string lacks a converter.
156
174
  */
157
175
  static parseDateTimeString(rfcDateString: RFC5545DateString | RFC5545DateTimeString, converter: Maybe<DateTimezoneBaseDateConverter>): Date;
@@ -163,36 +181,59 @@ export declare class DateRRuleParseUtility {
163
181
  * DateRRuleParseUtility.formatDateTimeString(new Date('2021-06-11T11:00:00Z'));
164
182
  * // => '20210611T110000Z'
165
183
  * ```
184
+ *
185
+ * @param date - The date to format.
186
+ * @returns The RFC 5545 UTC date-time string representation.
166
187
  */
167
188
  static formatDateTimeString(date: Date): RFC5545DateTimeString;
168
189
  /**
169
190
  * Parses a full RRule line string into a structured {@link RRuleProperty}.
191
+ *
192
+ * @param line - The raw RRule line string to parse.
193
+ * @returns The structured property with type, params, and values.
170
194
  */
171
195
  static parseProperty(line: RRuleLineString): RRuleProperty;
172
196
  /**
173
197
  * Converts an {@link RRuleRawLine} into a structured {@link RRuleProperty} by splitting the type and params.
198
+ *
199
+ * @param rawLine - The raw line to convert.
200
+ * @returns The structured property with separated type, params, and values.
174
201
  */
175
202
  static propertyFromRawLine(rawLine: RRuleRawLine): RRuleProperty;
176
203
  /**
177
204
  * Splits a raw param string (e.g., `"TZID=America/New_York"`) into key-value form.
205
+ *
206
+ * @param param - The raw param string to split.
207
+ * @returns The parsed key-value param.
178
208
  */
179
209
  static parseRawParam(param: RRuleRawParamString): RRuleParam;
180
210
  /**
181
211
  * Splits a raw line at the colon delimiter into params and values portions.
182
212
  * Falls back to treating a single-segment line as an RRULE value.
213
+ *
214
+ * @param line - The raw RRule line string to split.
215
+ * @returns The raw line with separated params and values.
183
216
  */
184
217
  static parseRawLine(line: RRuleLineString): RRuleRawLine;
185
218
  /**
186
219
  * Splits a newline-delimited RRule string into individual line strings.
220
+ *
221
+ * @param lines - The newline-delimited RRule string to split.
222
+ * @returns An array of individual RRule line strings.
187
223
  */
188
224
  static toRRuleStringSet(lines: RRuleLines): RRuleStringLineSet;
189
225
  /**
190
226
  * Joins an array of RRule line strings into a single newline-delimited string.
227
+ *
228
+ * @param rruleStringSet - The array of RRule line strings to join.
229
+ * @returns A single newline-delimited RRule string.
191
230
  */
192
231
  static toRRuleLines(rruleStringSet: RRuleStringLineSet): RRuleLines;
193
232
  /**
194
233
  * Asserts that the property has the expected type, throwing if it does not match.
195
234
  *
235
+ * @param type - The expected property type.
236
+ * @param property - The property to check.
196
237
  * @throws Error if the property type does not match the expected type.
197
238
  */
198
239
  static assertPropertyType(type: RRulePropertyType, property: RRuleProperty): void;
@@ -1,2 +1 @@
1
1
  export * from './timezone';
2
- export * from './timezone.validator';