@dereekb/date 9.25.16 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +9 -17
  3. package/src/lib/date/date.calendar.d.ts +1 -1
  4. package/src/lib/date/date.calendar.js +2 -2
  5. package/src/lib/date/date.calendar.js.map +1 -1
  6. package/src/lib/date/date.cell.d.ts +16 -32
  7. package/src/lib/date/date.cell.factory.d.ts +15 -15
  8. package/src/lib/date/date.cell.factory.js +1 -1
  9. package/src/lib/date/date.cell.factory.js.map +1 -1
  10. package/src/lib/date/date.cell.filter.d.ts +2 -2
  11. package/src/lib/date/date.cell.filter.js.map +1 -1
  12. package/src/lib/date/date.cell.index.d.ts +12 -12
  13. package/src/lib/date/date.cell.index.js +2 -2
  14. package/src/lib/date/date.cell.index.js.map +1 -1
  15. package/src/lib/date/date.cell.js +4 -21
  16. package/src/lib/date/date.cell.js.map +1 -1
  17. package/src/lib/date/date.cell.schedule.d.ts +12 -12
  18. package/src/lib/date/date.cell.schedule.js +4 -4
  19. package/src/lib/date/date.cell.schedule.js.map +1 -1
  20. package/src/lib/date/date.cell.week.d.ts +3 -3
  21. package/src/lib/date/date.d.ts +3 -15
  22. package/src/lib/date/date.day.d.ts +9 -9
  23. package/src/lib/date/date.duration.d.ts +1 -5
  24. package/src/lib/date/date.duration.js +2 -7
  25. package/src/lib/date/date.duration.js.map +1 -1
  26. package/src/lib/date/date.format.d.ts +10 -13
  27. package/src/lib/date/date.format.js +3 -12
  28. package/src/lib/date/date.format.js.map +1 -1
  29. package/src/lib/date/date.js +1 -17
  30. package/src/lib/date/date.js.map +1 -1
  31. package/src/lib/date/date.logical.d.ts +6 -6
  32. package/src/lib/date/date.range.d.ts +14 -35
  33. package/src/lib/date/date.range.js +4 -27
  34. package/src/lib/date/date.range.js.map +1 -1
  35. package/src/lib/date/date.range.timezone.d.ts +1 -8
  36. package/src/lib/date/date.range.timezone.js +7 -6
  37. package/src/lib/date/date.range.timezone.js.map +1 -1
  38. package/src/lib/date/date.sort.d.ts +2 -2
  39. package/src/lib/date/date.time.js.map +1 -1
  40. package/src/lib/date/date.time.limit.d.ts +0 -8
  41. package/src/lib/date/date.time.limit.js +0 -10
  42. package/src/lib/date/date.time.limit.js.map +1 -1
  43. package/src/lib/date/date.time.minute.d.ts +2 -9
  44. package/src/lib/date/date.time.minute.js +2 -11
  45. package/src/lib/date/date.time.minute.js.map +1 -1
  46. package/src/lib/date/date.timezone.d.ts +13 -17
  47. package/src/lib/date/date.timezone.js +13 -18
  48. package/src/lib/date/date.timezone.js.map +1 -1
  49. package/src/lib/date/date.week.d.ts +13 -17
  50. package/src/lib/date/date.week.js +1 -6
  51. package/src/lib/date/date.week.js.map +1 -1
  52. package/src/lib/date/index.d.ts +0 -5
  53. package/src/lib/date/index.js +0 -5
  54. package/src/lib/date/index.js.map +1 -1
  55. package/src/lib/query/query.builder.d.ts +4 -4
  56. package/src/lib/query/query.builder.mongo.d.ts +1 -1
  57. package/src/lib/rrule/date.recurrence.d.ts +1 -1
  58. package/src/lib/rrule/date.recurrence.js +2 -3
  59. package/src/lib/rrule/date.recurrence.js.map +1 -1
  60. package/src/lib/rrule/date.rrule.d.ts +1 -1
  61. package/src/lib/rrule/date.rrule.js +14 -14
  62. package/src/lib/rrule/date.rrule.js.map +1 -1
  63. package/src/lib/rrule/date.rrule.parse.d.ts +10 -10
  64. package/src/lib/date/date.block.d.ts +0 -1388
  65. package/src/lib/date/date.block.day.d.ts +0 -10
  66. package/src/lib/date/date.block.day.js +0 -16
  67. package/src/lib/date/date.block.day.js.map +0 -1
  68. package/src/lib/date/date.block.js +0 -1849
  69. package/src/lib/date/date.block.js.map +0 -1
  70. package/src/lib/date/date.block.validator.d.ts +0 -20
  71. package/src/lib/date/date.block.validator.js +0 -72
  72. package/src/lib/date/date.block.validator.js.map +0 -1
  73. package/src/lib/date/date.block.week.d.ts +0 -44
  74. package/src/lib/date/date.block.week.js +0 -46
  75. package/src/lib/date/date.block.week.js.map +0 -1
  76. package/src/lib/date/date.filter.d.ts +0 -7
  77. package/src/lib/date/date.filter.js +0 -28
  78. package/src/lib/date/date.filter.js.map +0 -1
  79. package/src/lib/date/date.schedule.d.ts +0 -431
  80. package/src/lib/date/date.schedule.js +0 -553
  81. package/src/lib/date/date.schedule.js.map +0 -1
@@ -1,1388 +0,0 @@
1
- import { DayOfWeek, RequiredOnKeys, IndexNumber, IndexRange, IndexRef, UniqueModel, FactoryWithRequiredInput, FilterFunction, Milliseconds, Hours, MapFunction, SortCompareFunction, ArrayOrValue, Maybe, TimezoneString, ISO8601DayString, FractionalHour, DateRelativeState, TimezoneStringRef } from '@dereekb/util';
2
- import { DateRange, DateRangeDayDistanceInput, DateRangeStart } from './date.range';
3
- import { DateDurationSpan } from './date.duration';
4
- import { DateTimezoneUtcNormalFunctionInput, DateTimezoneUtcNormalInstance, DateTimezoneConversionConfigUseSystemTimezone } from './date.timezone';
5
- /**
6
- * Index from 0 of which day this block represents.
7
- *
8
- * @deprecated use DateCell implementation instead.
9
- */
10
- export declare type DateBlockIndex = number;
11
- /**
12
- * Returns true if the index is a non-negative integer.
13
- *
14
- * @deprecated use DateCell implementation instead.
15
- * @param input
16
- */
17
- export declare function isValidDateBlockIndex(input: DateBlockIndex): boolean;
18
- /**
19
- * Input type that is either a Date or a DateBlockIndex.
20
- *
21
- * @deprecated use DateCell implementation instead.
22
- */
23
- export declare type DateOrDateBlockIndex = Date | DateBlockIndex;
24
- /**
25
- * A duration-span block.
26
- *
27
- * @deprecated use DateCell implementation instead.
28
- */
29
- export interface DateBlock extends IndexRef {
30
- i: DateBlockIndex;
31
- }
32
- export declare class DateBlock {
33
- i: DateBlockIndex;
34
- constructor(template?: DateBlock);
35
- }
36
- /**
37
- * Converts the input number or DateBlock to a DateBlock.
38
- *
39
- * @deprecated use DateCell implementation instead.
40
- * @param dateBlockOrIndex
41
- * @returns
42
- */
43
- export declare function dateBlock(dateBlockOrIndex: DateBlockIndex | DateBlock): DateBlock;
44
- /**
45
- * An array of DateBlock-like values.
46
- *
47
- * @deprecated use DateCell implementation instead.
48
- */
49
- export declare type DateBlockArray<B extends DateBlock = DateBlock> = B[];
50
- /**
51
- * Reference to a DateBlockArray
52
- *
53
- * @deprecated use DateCell implementation instead.
54
- */
55
- export declare type DateBlockArrayRef<B extends DateBlock = DateBlock> = {
56
- blocks: DateBlockArray<B>;
57
- };
58
- /**
59
- * DateBlockTiming with only the start time.
60
- *
61
- * The start time is midnight of what timezone it is in, and can be used to infer the target timezone offset for that date.
62
- *
63
- * @deprecated use DateCell implementation instead.
64
- */
65
- export declare type DateBlockTimingStart = DateRangeStart;
66
- /**
67
- * The maximum number of hours that a DateBlockTiming's start can be offset. This means a max timezone of UTC+12.
68
- *
69
- * The timezones UTC+13 and UTC+14 are not supported, and will experience undetermined behavior.
70
- *
71
- * @deprecated use DateCell implementation instead.
72
- */
73
- export declare const MAX_DATE_BLOCK_TIMING_OFFSET_HOURS = 12;
74
- /**
75
- * The minimum number of hours that a DateBlockTiming's start can be offset. This means a min timezone of UTC-12.
76
- *
77
- * @deprecated use DateCell implementation instead.
78
- */
79
- export declare const MIN_DATE_BLOCK_TIMING_OFFSET_HOURS = -12;
80
- /**
81
- * The DateBlockTimingStart and startsAt times
82
- *
83
- * @deprecated use DateCell implementation instead.
84
- */
85
- export declare type DateBlockTimingStartAndStartsAt = DateBlockTimingStart & Pick<DateBlockTiming, 'startsAt'>;
86
- /**
87
- * Is combination of DateRange and DateDurationSpan. The DateRange captures a range of days that a DateBlock takes up, and the DateDurationSpan
88
- * captures the Dates at which the Job occurs at.
89
- *
90
- * NOTES:
91
- * - start time should be the first second of the day (0 seconds and 0 minutes) for its given timezone. This lets us derive the proper offset.
92
- * This means that for GMT+1 the starting date would be 01:00, which can then be normalized to the system timezone to normalize the correct current date. This also means we can safely create a new DateBlockTiming using startOfDay(new Date()) and it will be the correct time.
93
- * - The start date should always be normalized before being used.
94
- * - The startsAt time should be greater than or equal to the normalized start
95
- * - The startsAt time should be on the same date as normalized start
96
- * - The end time should equal the ending date/time of the final end duration.
97
- * - (Recommended, Optional) The timezone the date block timing is for. This timezone is required for areas that experience daylight savings in order to properly handle the offsets.
98
- *
99
- * @deprecated use DateCell implementation instead.
100
- */
101
- export interface DateBlockTiming extends DateBlockTimingStart, DateRange, DateDurationSpan, Partial<TimezoneStringRef> {
102
- }
103
- /**
104
- * The DateRange component for a DateBlockTiming. The start date is a DateBlockTimingStart.
105
- *
106
- * @deprecated use DateCell implementation instead.
107
- */
108
- export declare type DateBlockTimingStartEndRange = DateBlockTimingStart & Pick<DateBlockTiming, 'end' | 'timezone'>;
109
- /**
110
- * The start date of a DateBlockTimingStart, along with the endDay which is a normalized day that is at midnight of the last day in the timezone.
111
- *
112
- * They are expected to both be in the same timezone.
113
- *
114
- * @deprecated use DateCell implementation instead.
115
- */
116
- export declare type DateBlockTimingStartEndDayDateRange = DateBlockTimingStart & {
117
- endDay: Date;
118
- };
119
- /**
120
- * The startsAt time of the event.
121
- *
122
- * @deprecated use DateCell implementation instead.
123
- */
124
- export declare type DateBlockTimingEventStartsAt = Pick<DateBlockTiming, 'startsAt'>;
125
- /**
126
- * A startsAt time and duration.
127
- *
128
- * @deprecated use DateCell implementation instead.
129
- */
130
- export declare type DateBlockTimingEvent = Pick<DateBlockTiming, 'startsAt' | 'duration'>;
131
- export declare class DateBlockTiming extends DateDurationSpan {
132
- start: Date;
133
- end: Date;
134
- timezone?: TimezoneString;
135
- constructor(template?: DateBlockTiming);
136
- }
137
- /**
138
- *
139
- * @deprecated use DateCell implementation instead.
140
- */
141
- export interface CurrentDateBlockTimingUtcData {
142
- /**
143
- * Non-normalized start date in the system time.
144
- */
145
- originalUtcDate: Date;
146
- /**
147
- * Offset of the input timing to UTC.
148
- */
149
- originalUtcOffsetInHours: Hours;
150
- }
151
- /**
152
- *
153
- * @deprecated use DateCell implementation instead.
154
- */
155
- export interface CurrentDateBlockTimingOffsetData extends CurrentDateBlockTimingUtcData {
156
- offset: Milliseconds;
157
- currentTimezoneOffsetInHours: Hours;
158
- }
159
- /**
160
- * Returns true if the two timings are equivalent.
161
- *
162
- * @deprecated use DateCell implementation instead.
163
- * @param a
164
- * @param b
165
- */
166
- export declare function isSameDateBlockTiming(a: Maybe<DateBlockTiming>, b: Maybe<DateBlockTiming>): boolean;
167
- /**
168
- * Returns the date range from the start of the first event to the end time of the last event.
169
- *
170
- * @deprecated use DateCell implementation instead.
171
- * @param timing
172
- * @returns
173
- */
174
- export declare function dateBlockTimingFullRange(timing: Pick<DateBlockTiming, 'start' | 'end'>): DateRange;
175
- /**
176
- * Returns the date range from the start of the first event to the end time of the last event.
177
- *
178
- * @deprecated use DateCell implementation instead.
179
- * @param timing
180
- * @returns
181
- */
182
- export declare function dateBlockTimingEventRange(timing: Pick<DateBlockTiming, 'startsAt' | 'end'>): DateRange;
183
- /**
184
- *
185
- * @deprecated use DateCell implementation instead.
186
- * @param timing
187
- * @returns
188
- */
189
- export declare function getCurrentDateBlockTimingUtcData(timing: DateRangeStart): CurrentDateBlockTimingUtcData;
190
- /**
191
- * The offset in milliseconds to the "real start date", the first second in the target day on in the system timezone.
192
- *
193
- * @deprecated use DateCell implementation instead.
194
- * @param timing
195
- */
196
- export declare function getCurrentDateBlockTimingOffsetData(timing: DateRangeStart): CurrentDateBlockTimingOffsetData;
197
- /**
198
- *
199
- * @deprecated use DateCell implementation instead.
200
- * @param timing
201
- * @returns
202
- */
203
- export declare function getCurrentDateBlockTimingOffset(timing: DateRangeStart): Milliseconds;
204
- /**
205
- * @deprecated use DateCell implementation instead.
206
- */
207
- export declare type TimingIsExpectedTimezoneFunction = (timing: DateRangeStart) => boolean;
208
- /**
209
- *
210
- * @deprecated use DateCell implementation instead.
211
- * @param timezone
212
- * @returns
213
- */
214
- export declare function timingIsInExpectedTimezoneFunction(timezone: DateTimezoneUtcNormalFunctionInput): (timing: DateRangeStart) => boolean;
215
- /**
216
- *
217
- * @deprecated use DateCell implementation instead.
218
- * @param timing
219
- * @param timezone
220
- * @returns
221
- */
222
- export declare function timingIsInExpectedTimezone(timing: DateRangeStart, timezone: DateTimezoneUtcNormalFunctionInput): boolean;
223
- /**
224
- * Returns the total minutes between the start of the first event and the end of the last event.
225
- *
226
- * @param timing
227
- * @returns
228
- */
229
- export declare function getDateBlockTimingFirstEventDateRange(timing: Pick<DateBlockTiming, 'startsAt' | 'end'>): DateRange;
230
- /**
231
- * Returns the fractional hours in the event.
232
- *
233
- * @deprecated use DateCell implementation instead.
234
- * @param timing
235
- * @returns
236
- */
237
- export declare function getDateBlockTimingHoursInEvent(timing: Pick<DateBlockTiming, 'startsAt' | 'end'>): FractionalHour;
238
- export declare type TimingDateTimezoneUtcNormalInput = DateRangeStart | DateTimezoneUtcNormalFunctionInput;
239
- /**
240
- * Creates a DateTimezoneUtcNormalInstance from the input.
241
- *
242
- * @deprecated use DateCell implementation instead.
243
- * @param input
244
- * @returns
245
- */
246
- export declare function timingDateTimezoneUtcNormal(input: TimingDateTimezoneUtcNormalInput): DateTimezoneUtcNormalInstance;
247
- /**
248
- * Convenience function that extends timingDateTimezoneUtcNormal() but also asserts the that the timing matches it.
249
- *
250
- * @deprecated use DateCell implementation instead.
251
- * @param input
252
- * @param timing
253
- * @returns
254
- */
255
- export declare function assertedTimingDateTimezoneUtcNormal(input: TimingDateTimezoneUtcNormalInput, timing: DateBlockTimingStart): DateTimezoneUtcNormalInstance;
256
- /**
257
- * Converts a DateBlockTimingStartEndRange and DateBlockTimingEvent that originated from the same DateBlockTiming back to the original DateBlockTiming.
258
- *
259
- * This does not check for validity of the input event, and as such can return an invalid timing. Instead, use safeDateBlockTimingFromDateRangeAndEvent() for enforced validity and return of a valid timing.
260
- *
261
- * The timezone is recommended to be provided if available, otherwise daylight savings might be impacted.
262
- *
263
- * @deprecated use DateCell implementation instead.
264
- * @param dateBlockTimingStartEndRange
265
- * @param event
266
- * @param timezone
267
- * @returns
268
- */
269
- export declare function dateBlockTimingFromDateRangeAndEvent(dateBlockTimingStartEndRange: DateBlockTimingStartEndRange, event: DateBlockTimingEvent): DateBlockTiming;
270
- /**
271
- * Converts a DateBlockTimingStartEndRange and a DateBlockTimingEvent to a DateBlockTiming.
272
- *
273
- * The input event does not have to be from the original DateBlockTimingStartEndRange, but the start date is always retained, and the same end day is retained, but may be updated to reflect a new end date/time.
274
- *
275
- * @deprecated use DateCell implementation instead.
276
- * @param dateBlockTimingStartEndRange
277
- * @param event
278
- * @param timezone
279
- * @returns
280
- */
281
- export declare function safeDateBlockTimingFromDateRangeAndEvent(dateBlockTimingStartEndRange: DateBlockTimingStartEndRange, event: DateBlockTimingEvent, timezone: DateTimezoneUtcNormalInstance | TimezoneString): DateBlockTiming;
282
- /**
283
- * @deprecated timezone should be provided, as it will behave properly for daylight savings changes.
284
- */
285
- export declare function safeDateBlockTimingFromDateRangeAndEvent(dateBlockTimingStartEndRange: DateBlockTimingStartEndRange, event: DateBlockTimingEvent, timezone?: DateTimezoneUtcNormalInstance | TimezoneString): DateBlockTiming;
286
- /**
287
- * Converts a DateBlockTimingStartEndDayDateRange and DateBlockTimingEvent to a DateBlockTiming. The event is used to derive the startsAt, duration and end time. The timezone offset is retained.
288
- *
289
- * @deprecated use DateCell implementation instead.
290
- * @param dateBlockTimingStartEndDayDateRange
291
- * @param event
292
- * @returns
293
- */
294
- export declare function dateBlockTimingFromDateBlockTimingStartEndDayDateRange(dateBlockTimingStartEndDayDateRange: DateBlockTimingStartEndDayDateRange, event: DateBlockTimingEvent, timezone: DateTimezoneUtcNormalInstance | TimezoneString): DateBlockTiming;
295
- /**
296
- * Returns a copy of the input timing with the start time timezone in the given timezone.
297
- *
298
- * The start time is a normal, and should still refer to the same UTC date, but with the given timing's offset.
299
- *
300
- * @deprecated use DateCell implementation instead.
301
- * @param timing
302
- */
303
- export declare type ChangeTimingToTimezoneFunction = (<T extends DateRangeStart>(timing: T) => T) & {
304
- readonly _timezoneInstance: DateTimezoneUtcNormalInstance;
305
- };
306
- /**
307
- * Creates a ChangeTimingToTimezoneFunction from the input.
308
- *
309
- * @deprecated use DateCell implementation instead.
310
- * @param input
311
- * @returns
312
- */
313
- export declare function changeTimingToTimezoneFunction(input: TimingDateTimezoneUtcNormalInput): ChangeTimingToTimezoneFunction;
314
- /**
315
- *
316
- * @deprecated use DateCell implementation instead.
317
- * @param timing
318
- * @param timezone
319
- * @returns
320
- */
321
- export declare function changeTimingToTimezone<T extends DateRangeStart>(timing: T, timezone: TimingDateTimezoneUtcNormalInput): T;
322
- /**
323
- *
324
- * @deprecated use DateCell implementation instead.
325
- * @param timing
326
- * @returns
327
- */
328
- export declare function changeTimingToSystemTimezone<T extends DateRangeStart>(timing: T): T;
329
- /**
330
- *
331
- * @deprecated use DateCell implementation instead.
332
- * @returns
333
- */
334
- export declare function dateBlockTimingStartForNowInSystemTimezone(): DateBlockTimingStart;
335
- /**
336
- * Creates a DateBlockTimingStart for now in the given timezone.
337
- *
338
- * @param timezoneInput
339
- * @returns
340
- */
341
- export declare function dateBlockTimingStartForNowInTimezone(timezoneInput: TimingDateTimezoneUtcNormalInput): DateBlockTimingStart;
342
- /**
343
- * Returns the start date in the current/system timezone for the given date.
344
- *
345
- * @deprecated use DateCell implementation instead.
346
- * @param timing
347
- */
348
- export declare function getCurrentDateBlockTimingStartDate(timing: DateBlockTimingStart): Date;
349
- /**
350
- *
351
- * @deprecated use DateCell implementation instead.
352
- * @param date
353
- * @returns
354
- */
355
- export declare function isValidDateBlockTimingStartDate(date: Date): boolean;
356
- /**
357
- * DateBlockTimingRelativeIndexFactory input. Can be a Date, DateBlockIndex, or ISO8601DayString
358
- *
359
- * @deprecated use DateCell implementation instead.
360
- */
361
- export declare type DateBlockTimingRelativeIndexFactoryInput = DateOrDateBlockIndex | ISO8601DayString;
362
- /**
363
- * Returns the DateBlockIndex of the input date relative to the configured Date.
364
- *
365
- * Input dates should be in system time zone and not normalized to a different timezone.
366
- *
367
- * @deprecated use DateCell implementation instead.
368
- */
369
- export declare type DateBlockTimingRelativeIndexFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = ((input: DateBlockTimingRelativeIndexFactoryInput) => DateBlockIndex) & {
370
- readonly _timing: T;
371
- readonly _timingOffsetData: CurrentDateBlockTimingOffsetData;
372
- };
373
- /**
374
- * Returns true if the input is a DateBlockTimingRelativeIndexFactory.
375
- *
376
- * @deprecated use DateCell implementation instead.
377
- * @param input
378
- * @returns
379
- */
380
- export declare function isDateBlockTimingRelativeIndexFactory<T extends DateBlockTimingStart = DateBlockTimingStart>(input: unknown): input is DateBlockTimingRelativeIndexFactory<T>;
381
- /**
382
- * Creates a DateBlockTimingRelativeIndexFactory from the input.
383
- *
384
- * @deprecated use DateCell implementation instead.
385
- * @param input
386
- * @returns
387
- */
388
- export declare function dateBlockTimingRelativeIndexFactory<T extends DateBlockTimingStart = DateBlockTimingStart>(input: T | DateBlockTimingRelativeIndexFactory<T>): DateBlockTimingRelativeIndexFactory<T>;
389
- /**
390
- * Function that wraps a DateBlockTimingRelativeIndexFactory and converts multuple Date/DateBlockIndex/DateBlockRange values into an array of DateBlockIndex values.
391
- *
392
- * @deprecated use DateCell implementation instead.
393
- */
394
- export declare type DateBlockTimingRelativeIndexArrayFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = ((input: ArrayOrValue<DateOrDateRangeOrDateBlockIndexOrDateBlockRange>) => DateBlockIndex[]) & {
395
- readonly _indexFactory: DateBlockTimingRelativeIndexFactory<T>;
396
- };
397
- /**
398
- * Creates a DateBlockTimingRelativeIndexArrayFactory from the input DateBlockTimingRelativeIndexFactory.
399
- *
400
- * @deprecated use DateCell implementation instead.
401
- * @param indexFactory
402
- */
403
- export declare function dateBlockTimingRelativeIndexArrayFactory<T extends DateBlockTimingStart = DateBlockTimingStart>(indexFactory: DateBlockTimingRelativeIndexFactory<T>): DateBlockTimingRelativeIndexArrayFactory<T>;
404
- /**
405
- * Gets the relative index of the input date compared to the input timing.
406
- *
407
- * @deprecated use DateCell implementation instead.
408
- * @param timing
409
- * @param date
410
- */
411
- export declare function getRelativeIndexForDateBlockTiming(timing: DateBlockTimingStart, date?: DateOrDateBlockIndex): DateBlockIndex;
412
- /**
413
- *
414
- * @deprecated use DateCell implementation instead.
415
- */
416
- export interface GetNextDateBlockTimingIndexInput<T extends DateBlockRange> {
417
- /**
418
- * Relevant index for now.
419
- */
420
- readonly currentIndex: DateBlockIndex;
421
- /**
422
- * All possible ranges to pick from.
423
- */
424
- readonly ranges: ArrayOrValue<T>;
425
- }
426
- /**
427
- *
428
- * @deprecated use DateCell implementation instead.
429
- */
430
- export interface GetNextDateBlockTimingIndexResult<T extends DateBlockRange> {
431
- /**
432
- * The item that matches the current index first out of the options.
433
- */
434
- readonly currentResult: Maybe<T>;
435
- /**
436
- * The next picked index, if available.
437
- */
438
- readonly nextIndex: Maybe<DateBlockIndex>;
439
- /**
440
- * The item that matches the next index first out of the options.
441
- */
442
- readonly nextResult: Maybe<T>;
443
- /**
444
- * All ranges that match/contain the current index.
445
- */
446
- readonly presentResults: T[];
447
- /**
448
- * All ranges that come before the current index.
449
- */
450
- readonly pastResults: T[];
451
- /**
452
- * All ranges that come after the current index.
453
- */
454
- readonly futureResults: T[];
455
- }
456
- /**
457
- * Computes a GetNextDateBlockTimingIndexResult from the input.
458
- *
459
- * @deprecated use DateCell implementation instead.
460
- * @param input
461
- */
462
- export declare function getNextDateBlockTimingIndex<T extends DateBlockRange>(input: GetNextDateBlockTimingIndexInput<T>): GetNextDateBlockTimingIndexResult<T>;
463
- /**
464
- * Returns the DateRelativeState for the given index and range.
465
- *
466
- * @deprecated use DateCell implementation instead.
467
- * @param nowIndex
468
- * @param range
469
- */
470
- export declare function dateRelativeStateForDateBlockRangeComparedToIndex(range: DateBlockRange, nowIndex: DateBlockIndex): DateRelativeState;
471
- /**
472
- * Similar to the DateBlockTimingRelativeIndexFactory, but returns a date instead of an index for the input.
473
- *
474
- * If an index is input, returns a date with the hours and minutes for now for the given date returned.
475
- *
476
- * @deprecated use DateCell implementation instead.
477
- */
478
- export declare type DateBlockTimingDateFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = ((input: DateOrDateBlockIndex) => Date) & {
479
- readonly _timing: T;
480
- };
481
- /**
482
- * Creates a DateBlockTimingDateFactory.
483
- *
484
- * @deprecated use DateCell implementation instead.
485
- * @param timing
486
- * @returns
487
- */
488
- export declare function dateBlockTimingDateFactory<T extends DateBlockTimingStart = DateBlockTimingStart>(timing: T): DateBlockTimingDateFactory<T>;
489
- /**
490
- * Returns the start time of the input date or index.
491
- *
492
- * @deprecated use DateCell implementation instead.
493
- */
494
- export declare type DateBlockTimingStartDateFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = ((input: DateOrDateBlockIndex) => Date) & {
495
- readonly _indexFactory: DateBlockTimingRelativeIndexFactory<T>;
496
- };
497
- /**
498
- *
499
- * @deprecated use DateCell implementation instead.
500
- */
501
- export declare type DateBlockTimingUseSystemAndIgnoreEnforcement = DateTimezoneConversionConfigUseSystemTimezone & {
502
- /**
503
- * Skips the assertion that the timezone matches. This defaults to true if not provided.
504
- */
505
- assertTimingMatchesTimezone: false;
506
- };
507
- /**
508
- * Creates a DateBlockTimingDateFactory. The timezone is required to properly compute the accurate startsAt date for locations that experience daylight savings.
509
- *
510
- * @deprecated use DateCell implementation instead.
511
- * @param timing
512
- * @returns
513
- */
514
- export declare function dateBlockTimingStartDateFactory<T extends DateBlockTimingStart = DateBlockTimingStart>(input: T | DateBlockTimingRelativeIndexFactory<T>, timezone: TimezoneString | DateTimezoneConversionConfigUseSystemTimezone | DateBlockTimingUseSystemAndIgnoreEnforcement | DateTimezoneUtcNormalInstance): DateBlockTimingStartDateFactory<T>;
515
- /**
516
- * Returns the startsAt time of the input date or index.
517
- *
518
- * @deprecated use DateCell implementation instead.
519
- */
520
- export declare type DateBlockTimingStartsAtDateFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = ((input: DateOrDateBlockIndex) => Date) & {
521
- readonly _indexFactory: DateBlockTimingRelativeIndexFactory<T>;
522
- };
523
- /**
524
- * Creates a DateBlockTimingStartsAtDateFactory.
525
- *
526
- * @deprecated use DateCell implementation instead.
527
- * @param timing
528
- * @returns
529
- */
530
- export declare function dateBlockTimingStartsAtDateFactory<T extends DateBlockTimingStartAndStartsAt = DateBlockTimingStartAndStartsAt>(input: T | DateBlockTimingRelativeIndexFactory<T>, timezone: TimezoneString | DateTimezoneConversionConfigUseSystemTimezone | DateBlockTimingUseSystemAndIgnoreEnforcement | DateTimezoneUtcNormalInstance): DateBlockTimingStartsAtDateFactory<T>;
531
- /**
532
- * @deprecated use DateCell implementation instead.
533
- * @param input
534
- * @param timezone
535
- */
536
- export declare function dateBlockTimingStartsAtDateFactory<T extends DateBlockTimingStartAndStartsAt = DateBlockTimingStartAndStartsAt>(input: T | DateBlockTimingRelativeIndexFactory<T>, timezone?: TimezoneString | DateTimezoneConversionConfigUseSystemTimezone | DateBlockTimingUseSystemAndIgnoreEnforcement | DateTimezoneUtcNormalInstance): DateBlockTimingStartsAtDateFactory<T>;
537
- /**
538
- * Returns the date of the input index.
539
- *
540
- * @deprecated use DateCell implementation instead.
541
- * @param timing
542
- * @param date
543
- */
544
- export declare function getRelativeDateForDateBlockTiming(timing: DateBlockTimingStart, input: DateOrDateBlockIndex): Date;
545
- /**
546
- * The DateRange input for dateBlockTiming()
547
- *
548
- * @deprecated use DateCell implementation instead.
549
- */
550
- export declare type DateBlockTimingRangeInput = Pick<DateRangeDayDistanceInput, 'distance'> | DateRange | number;
551
- /**
552
- *
553
- * @deprecated use DateCell implementation instead.
554
- */
555
- export interface DateBlockTimingOptions {
556
- /**
557
- * Timezone to evaluate the startsAt time in.
558
- *
559
- * Will convert the input startsAt time to a normal in the given timezone, then converts it back to the system timezone.
560
- */
561
- timezone?: DateTimezoneUtcNormalFunctionInput;
562
- }
563
- /**
564
- * Creates a valid DateBlock timing from the DateDurationSpan and range input.
565
- *
566
- * The duration is first considered, then the date range is applied to it.
567
- *
568
- * If a number is passed as the input range, then the duration's startsAt date will be used and the input number used as the distance.
569
- * The input range's date takes priority over the duration's startsAt start date, meaning the input date range will be adapted
570
- * to fit the startsAt time.
571
- *
572
- * The input range date is used as the start and end date ranges, meaning they will be used as the expected date offset (have only hours, no minutes/seconds/milliseconds) and be validated as such.
573
- * The end date is used just to determine the number of days, but a minimum of 1 day is always enforced as a DateBlockTiming must contain atleast 1 day.
574
- *
575
- * The start date from the inputDate is considered to to have the offset noted in DateBlock, and will be retained.
576
- *
577
- * @deprecated use DateCell implementation instead.
578
- */
579
- export declare function dateBlockTiming(durationInput: DateDurationSpan, inputRange: DateBlockTimingRangeInput, options?: DateBlockTimingOptions): DateBlockTiming;
580
- /**
581
- * Creates a DateBlockTiming from the DateDurationSpan and range input with the start offset set in the pre-configured timezone.
582
- *
583
- * @deprecated use DateCell implementation instead.
584
- */
585
- export declare type DateBlockTimingInTimezoneFunction = ((durationInput: DateDurationSpan, inputRange: DateBlockTimingRangeInput) => DateBlockTiming) & {
586
- readonly _timezoneInstance: DateTimezoneUtcNormalInstance;
587
- };
588
- /**
589
- *
590
- * @deprecated use DateCell implementation instead.
591
- * @param input
592
- * @returns
593
- */
594
- export declare function dateBlockTimingInTimezoneFunction(input: TimingDateTimezoneUtcNormalInput): DateBlockTimingInTimezoneFunction;
595
- /**
596
- *
597
- * @deprecated use DateCell implementation instead.
598
- * @param durationInput
599
- * @param inputRange
600
- * @param timezone
601
- * @returns
602
- */
603
- export declare function dateBlockTimingInTimezone(durationInput: DateDurationSpan, inputRange: DateBlockTimingRangeInput, timezone: TimingDateTimezoneUtcNormalInput): DateBlockTiming;
604
- /**
605
- * @deprecated use DateCell implementation instead.
606
- */
607
- export interface IsValidDateBlockTimingInfo {
608
- readonly isValid: boolean;
609
- readonly isStartRoundedToSeconds: boolean;
610
- readonly msDifference: boolean;
611
- readonly endIsAfterTheStartsAtTime: boolean;
612
- readonly durationLessThan24Hours: boolean;
613
- readonly startHasZeroSeconds: boolean;
614
- readonly startsAtIsAfterStart: boolean;
615
- readonly startsAtIsLessThan24HoursAfterStart: boolean;
616
- readonly isExpectedValidEnd: boolean;
617
- readonly isPlausiblyValidEnd: boolean;
618
- }
619
- /**
620
- *
621
- * @deprecated use DateCell implementation instead.
622
- * @param timing
623
- * @returns
624
- */
625
- export declare function isValidDateBlockTimingInfo(timing: DateBlockTiming): {
626
- isValid: boolean;
627
- isStartRoundedToSeconds: boolean;
628
- msDifference: number;
629
- endIsAfterTheStartsAtTime: boolean;
630
- durationLessThan24Hours: boolean;
631
- startHasZeroSeconds: boolean;
632
- startsAtIsAfterStart: boolean;
633
- startsAtIsLessThan24HoursAfterStart: boolean;
634
- isExpectedValidEnd: boolean;
635
- isPlausiblyValidEnd: boolean;
636
- };
637
- /**
638
- *
639
- * @deprecated use DateCell implementation instead.
640
- * @param timing
641
- * @returns
642
- */
643
- export declare function isValidDateBlockTiming(timing: DateBlockTiming): boolean;
644
- /**
645
- * Converts the input index into the DayOfWeek that it represents.
646
- *
647
- * @deprecated use DateCell implementation instead.
648
- */
649
- export declare type DateBlockDayOfWeekFactory = MapFunction<DateBlockIndex, DayOfWeek>;
650
- /**
651
- * Creates a DateBlockDayOfWeekFactory
652
- *
653
- * @deprecated use DateCell implementation instead.
654
- * @param dayForIndexZero
655
- * @returns
656
- */
657
- export declare function dateBlockDayOfWeekFactory(inputDayForIndexZero: DayOfWeek | Date): DateBlockDayOfWeekFactory;
658
- /**
659
- * Reference to a DateBlockTiming
660
- *
661
- * @deprecated use DateCell implementation instead.
662
- */
663
- export interface DateBlockTimingRef {
664
- timing: DateBlockTiming;
665
- }
666
- /**
667
- * An object that implements DateBlockTimingRef and DateBlockArrayRef
668
- *
669
- * @deprecated use DateCell implementation instead.
670
- */
671
- export interface DateBlockCollection<B extends DateBlock = DateBlock> extends DateBlockTimingRef, DateBlockArrayRef<B> {
672
- }
673
- /**
674
- * An expanded DateBlock that implements DateDurationSpan and contains the DateBlock values.
675
- *
676
- * @deprecated use DateCell implementation instead.
677
- */
678
- export declare type DateBlockDurationSpan<B extends DateBlock = DateBlock> = DateDurationSpan & B;
679
- /**
680
- * Convenience function for calling expandDateBlocks() with the input DateBlockCollection.
681
- *
682
- * @deprecated use DateCell implementation instead.
683
- * @param collection
684
- * @returns
685
- */
686
- export declare function expandDateBlockCollection<B extends DateBlock = DateBlock>(collection: DateBlockCollection<B>): DateBlockDurationSpan<B>[];
687
- /**
688
- * Convenience function for calling dateBlocksExpansionFactory() then passing the blocks.
689
- *
690
- * @deprecated use DateCell implementation instead.
691
- * @param blocks
692
- * @param timing
693
- * @returns
694
- */
695
- export declare function expandDateBlocks<B extends DateBlock = DateBlock>(timing: DateBlockTiming, blocks: B[]): DateBlockDurationSpan<B>[];
696
- /**
697
- *
698
- * @deprecated use DateCell implementation instead.
699
- */
700
- export declare type DateBlocksExpansionFactoryInput<B extends DateBlock | DateBlockRange = DateBlock> = DateBlockArrayRef<B> | DateBlockArray<B>;
701
- /**
702
- * Used to convert the input DateBlocksExpansionFactoryInput into an array of DateBlockDurationSpan values
703
- *
704
- * @deprecated use DateCell implementation instead.
705
- */
706
- export declare type DateBlocksExpansionFactory<B extends DateBlock | DateBlockRange = DateBlock> = (input: DateBlocksExpansionFactoryInput<B>) => DateBlockDurationSpan<B>[];
707
- /**
708
- *
709
- * @deprecated use DateCell implementation instead.
710
- */
711
- export interface DateBlocksExpansionFactoryConfig<B extends DateBlock | DateBlockRange = DateBlock> {
712
- /**
713
- * Timing to use in the configuration.
714
- */
715
- timing: DateBlockTiming;
716
- /**
717
- * Range to limit duration span output to.
718
- *
719
- * If not provided, uses the input timing's range.
720
- * If false, the timing's range is ignored too, and only the DateBlockIndex values are considered.
721
- */
722
- rangeLimit?: DateBlockTimingRangeInput | false;
723
- /**
724
- * Additional filter function to filter potential blocks in/out.
725
- */
726
- filter?: FilterFunction<B>;
727
- /**
728
- * (Optional) Additional filter function based on the calcualted DateBlockDurationSpan.
729
- */
730
- durationSpanFilter?: FilterFunction<DateBlockDurationSpan<B>>;
731
- /**
732
- * (Optional) Max number of blocks to evaluate.
733
- */
734
- blocksEvaluationLimit?: number;
735
- /**
736
- * (Optional) Max number of DateBlockDurationSpan values to return.
737
- */
738
- maxDateBlocksToReturn?: number;
739
- }
740
- /**
741
- * Creates a DateBlocksExpansionFactory
742
- *
743
- * @deprecated use DateCell implementation instead.
744
- * @param config
745
- * @returns
746
- */
747
- export declare function dateBlocksExpansionFactory<B extends DateBlock | DateBlockRange = DateBlock>(config: DateBlocksExpansionFactoryConfig): DateBlocksExpansionFactory<B>;
748
- /**
749
- *
750
- * @deprecated use DateCell implementation instead.
751
- */
752
- export declare type DateBlockDayTimingInfoFactoryConfig = Pick<DateBlocksExpansionFactoryConfig, 'timing' | 'rangeLimit'>;
753
- /**
754
- *
755
- * @deprecated use DateCell implementation instead.
756
- */
757
- export interface DateBlockDayTimingInfo {
758
- /**
759
- * Input date or calculated date if provided a dayIndex.
760
- */
761
- date: Date;
762
- /**
763
- * Index for the day for the input date.
764
- */
765
- dayIndex: DateBlockIndex;
766
- /**
767
- * Index for the previous index/current index depending on the TimingInfo's daily execution.
768
- *
769
- * If the index is currently in progress given the timing, this will return the dayIndex.
770
- */
771
- currentIndex: DateBlockIndex;
772
- /**
773
- * Index for the next execution. Does not check if it is in range.
774
- *
775
- * If the index is currently in progress given the timing, this will return the dayIndex + 1.
776
- */
777
- nextIndex: DateBlockIndex;
778
- /**
779
- * Index for the next execution, if in the range, otherwise undefined.
780
- *
781
- * If the index is currently in progress given the timing, this will return the dayIndex + 1.
782
- */
783
- nextIndexInRange: Maybe<DateBlockIndex>;
784
- /**
785
- * Whether or not there are any inProgress or upcoming executions.
786
- *
787
- * True if nextIndexInRange is undefined and isInProgress is false.
788
- */
789
- isComplete: boolean;
790
- /**
791
- * Whether or not today's timing has already occured in it's entirety.
792
- */
793
- hasOccuredToday: boolean;
794
- /**
795
- * Whether or not today's timing is currently in progress.
796
- */
797
- isInProgress: boolean;
798
- /**
799
- * Whether or not the block is within the configured range.
800
- */
801
- isInRange: boolean;
802
- /**
803
- * Time the timing starts on the input day.
804
- */
805
- startsAtOnDay: Date;
806
- /**
807
- * Time the timing ends on the input day.
808
- */
809
- endsAtOnDay: Date;
810
- /**
811
- * "now" value used for considering current progress.
812
- */
813
- now: Date;
814
- }
815
- /**
816
- * Generates DateBlockDayTimingInfo about the input date relative to the input timing and range limit.
817
- *
818
- * The date may not exist within the range, but will still compute values using the input date and timing configuration.
819
- *
820
- * Can optionally specify a now that is used for checking the inProgress functionality.
821
- *
822
- * @deprecated use DateCell implementation instead.
823
- */
824
- export declare type DateBlockDayTimingInfoFactory = (date: DateOrDateBlockIndex, now?: Date) => DateBlockDayTimingInfo;
825
- /**
826
- *
827
- * @deprecated use DateCell implementation instead.
828
- * @param config
829
- * @returns
830
- */
831
- export declare function dateBlockDayTimingInfoFactory(config: DateBlockDayTimingInfoFactoryConfig): DateBlockDayTimingInfoFactory;
832
- /**
833
- * IndexRange used with DateBlocks.
834
- *
835
- * It has an exclusive max range. It is similar to a DateBlockRange.
836
- *
837
- * @deprecated use DateCell implementation instead.
838
- */
839
- export declare type DateBlockIndexRange = IndexRange;
840
- /**
841
- *
842
- * @deprecated use DateCell implementation instead.
843
- * @param range
844
- * @returns
845
- */
846
- export declare function dateBlockRangeToDateBlockIndexRange(range: DateBlockRange): DateBlockIndexRange;
847
- /**
848
- *
849
- * @deprecated use DateCell implementation instead.
850
- * @param range
851
- * @returns
852
- */
853
- export declare function dateBlockIndexRangeToDateBlockRange(range: DateBlockIndexRange): DateBlockRangeWithRange;
854
- /**
855
- * Generates a DateBlockIndexRange based on the input timing.
856
- *
857
- * An arbitrary limit can also be applied.
858
- *
859
- * @deprecated use DateCell implementation instead.
860
- * @param timing
861
- * @param limit
862
- * @param fitToTimingRange
863
- */
864
- export declare function dateBlockIndexRange(timing: DateBlockTiming, limit?: DateBlockTimingRangeInput, fitToTimingRange?: boolean): DateBlockIndexRange;
865
- /**
866
- * Returns blocks that are only in the given DateBlockRange.
867
- *
868
- * @deprecated use DateCell implementation instead.
869
- * @param blocks
870
- * @param range
871
- * @returns
872
- */
873
- export declare function filterDateBlocksInDateBlockRange<T extends DateBlock | DateBlockRange>(blocks: T[], range: DateBlockRangeWithRange): T[];
874
- /**
875
- * @deprecated use DateCell implementation instead.
876
- */
877
- export declare type IsDateBlockWithinDateBlockRangeInput = DateBlockOrDateBlockIndexOrDateBlockRange;
878
- /**
879
- * Function that returns true if the input range is equal or falls within the configured DateBlockRange.
880
- *
881
- * @deprecated use DateCell implementation instead.
882
- */
883
- export declare type IsDateBlockWithinDateBlockRangeFunction = (input: IsDateBlockWithinDateBlockRangeInput) => boolean;
884
- /**
885
- *
886
- * @deprecated use DateCell implementation instead.
887
- * @param inputRange
888
- * @returns
889
- */
890
- export declare function isDateBlockWithinDateBlockRangeFunction(inputRange: IsDateBlockWithinDateBlockRangeInput): IsDateBlockWithinDateBlockRangeFunction;
891
- /**
892
- * Returns true if the first DateBlock or DateBlockRange contains the second input.
893
- *
894
- * @deprecated use DateCell implementation instead.
895
- * @param range
896
- * @param isContainedWithin
897
- * @returns
898
- */
899
- export declare function isDateBlockWithinDateBlockRange(range: IsDateBlockWithinDateBlockRangeInput, contains: IsDateBlockWithinDateBlockRangeInput): boolean;
900
- /**
901
- * Input for a IsDateWithinDateBlockRangeFunction
902
- *
903
- * @deprecated use DateCell implementation instead.
904
- */
905
- export declare type IsDateWithinDateBlockRangeInput = DateOrDateBlockIndex | DateRangeStart | DateRange | DateBlock | DateBlockRange;
906
- /**
907
- * Function that returns true if the input range is equal or falls within the configured DateBlockRange.
908
- *
909
- * @deprecated use DateCell implementation instead.
910
- */
911
- export declare type IsDateWithinDateBlockRangeFunction = (input: IsDateWithinDateBlockRangeInput) => boolean;
912
- /**
913
- *
914
- * @deprecated use DateCell implementation instead.
915
- */
916
- export interface IsDateWithinDateBlockRangeConfig {
917
- /**
918
- * Optional date to make the indexes relative to when converting date values.
919
- *
920
- * If not provided, defaults to the index in the range if a date is provided, or throws an exception if a date range is input.
921
- */
922
- start?: Date;
923
- /**
924
- * Range to compare the input to.
925
- */
926
- range: IsDateWithinDateBlockRangeInput;
927
- }
928
- /**
929
- *
930
- * @deprecated use DateCell implementation instead.
931
- * @param config
932
- * @returns
933
- */
934
- export declare function isDateWithinDateBlockRangeFunction(config: IsDateWithinDateBlockRangeConfig): IsDateWithinDateBlockRangeFunction;
935
- /**
936
- * Represents a range of DateBlock values.
937
- *
938
- * @deprecated use DateCell implementation instead.
939
- */
940
- export interface DateBlockRange extends DateBlock {
941
- /**
942
- * Index this block ends at, inclusive. A block with i=0 and to=0 encompases only the block 0.
943
- *
944
- * If not provided, assumes this has no range and starts/ends at the same index, i.
945
- */
946
- to?: DateBlockIndex;
947
- }
948
- /**
949
- *
950
- * @deprecated use DateCell implementation instead.
951
- */
952
- export declare class DateBlockRange extends DateBlock {
953
- to?: DateBlockIndex;
954
- constructor(template?: DateBlockRange);
955
- }
956
- /**
957
- * A DateBlockIndex, DateBlock, or DateBlockRange
958
- *
959
- * @deprecated use DateCell implementation instead.
960
- */
961
- export declare type DateBlockOrDateBlockIndexOrDateBlockRange = DateBlockIndex | DateBlock | DateBlockRange;
962
- /**
963
- * Returns true if the input is a valid DateBlockRange.
964
- *
965
- * @deprecated use DateCell implementation instead.
966
- * @param input
967
- * @returns
968
- */
969
- export declare function isValidDateBlockRange(input: DateBlockRange): boolean;
970
- /**
971
- * Returns true if the input is a sorted DateBlockRange array and there are no repeat indexes.
972
- *
973
- * @deprecated use DateCell implementation instead.
974
- * @param input
975
- * @returns
976
- */
977
- export declare function isValidDateBlockRangeSeries(input: DateBlockRange[]): boolean;
978
- /**
979
- * Returns the lowest index between all the input date block ranges. Returns 0 by default if there is no minimum or input blocks.
980
- *
981
- * The input range is not expected to be sorted.
982
- *
983
- * @deprecated use DateCell implementation instead.
984
- */
985
- export declare function getLeastDateBlockIndexInDateBlockRanges(input: (DateBlock | DateBlockRange)[]): DateBlockIndex;
986
- /**
987
- * Returns the largest index between all the input date block ranges. Returns 0 by default.
988
- *
989
- * The input range is not expected to be sorted.
990
- *
991
- * @deprecated use DateCell implementation instead.
992
- */
993
- export declare function getGreatestDateBlockIndexInDateBlockRanges(input: (DateBlock | DateBlockRange)[]): DateBlockIndex;
994
- export interface LeastAndGreatestDateBlockIndexResult<T> {
995
- leastIndex: number;
996
- leastIndexItem: T;
997
- greatestIndex: number;
998
- greatestIndexItem: T;
999
- }
1000
- /**
1001
- * Returns the largest index between all the input date block ranges. Returns null if the input is empty.
1002
- *
1003
- * The input range is not expected to be sorted.
1004
- *
1005
- * @deprecated use DateCell implementation instead.
1006
- */
1007
- export declare function getLeastAndGreatestDateBlockIndexInDateBlockRanges<T extends DateBlockRange>(input: T[]): Maybe<LeastAndGreatestDateBlockIndexResult<T>>;
1008
- /**
1009
- * Input type used for cases where a DateRange or a DateBlockRange are allowed as input but used the start/end parameters in DateRange.
1010
- *
1011
- * @deprecated use DateCell implementation instead.
1012
- */
1013
- export interface DateBlockRangeOrDateRange {
1014
- start?: Maybe<DateOrDateBlockIndex>;
1015
- end?: Maybe<DateOrDateBlockIndex>;
1016
- }
1017
- /**
1018
- *
1019
- * @deprecated use DateCell implementation instead.
1020
- */
1021
- export declare type DateOrDateBlockIndexOrDateBlockRange = DateOrDateBlockIndex | DateBlockRange;
1022
- /**
1023
- *
1024
- * @deprecated use DateCell implementation instead.
1025
- */
1026
- export declare type DateOrDateRangeOrDateBlockIndexOrDateBlockRange = DateRange | DateOrDateBlockIndexOrDateBlockRange;
1027
- /**
1028
- * Creates a DateBlockRange
1029
- *
1030
- * @deprecated use DateCell implementation instead.
1031
- * @param i
1032
- * @param to
1033
- * @returns
1034
- */
1035
- export declare function dateBlockRange(i: number, to?: number): DateBlockRangeWithRange;
1036
- /**
1037
- * Creates a DateBlockRangeWithRange from the input DateBlockIndex.
1038
- *
1039
- * @deprecated use DateCell implementation instead.
1040
- * @param dateBlockIndex
1041
- * @returns
1042
- */
1043
- export declare function dateBlockRangeWithRangeFromIndex(dateBlockIndex: DateBlockIndex): DateBlockRangeWithRange;
1044
- /**
1045
- * Creates a DateBlockRangeWithRange from the input DateBlockIndex, DateBlock, or DateBlockRange.
1046
- *
1047
- * @deprecated use DateCell implementation instead.
1048
- * @param input
1049
- * @returns
1050
- */
1051
- export declare function dateBlockRangeWithRange(input: DateBlockOrDateBlockIndexOrDateBlockRange): DateBlockRangeWithRange;
1052
- /**
1053
- * Function that returns true if the input range covers the full range of the configured DateBlockRange.
1054
- */
1055
- export declare type DateBlockRangeIncludedByRangeFunction = (range: DateBlockOrDateBlockIndexOrDateBlockRange) => boolean;
1056
- /**
1057
- * Creates a DateBlockRangeIncludedByRangeFunction
1058
- *
1059
- * @deprecated use DateCell implementation instead.
1060
- * @param inputRange
1061
- * @returns
1062
- */
1063
- export declare function dateBlockRangeIncludedByRangeFunction(inputRange: DateBlockOrDateBlockIndexOrDateBlockRange): DateBlockRangeIncludedByRangeFunction;
1064
- /**
1065
- * Function that returns true if the input range overlaps the range of the configured DateBlockRange.
1066
- *
1067
- * @deprecated use DateCell implementation instead.
1068
- */
1069
- export declare type DateBlockRangeOverlapsRangeFunction = (range: DateBlockOrDateBlockIndexOrDateBlockRange) => boolean;
1070
- /**
1071
- * Creates a DateBlockRangeOverlapsRangeFunction
1072
- *
1073
- * @deprecated use DateCell implementation instead.
1074
- * @param inputRange
1075
- * @returns
1076
- */
1077
- export declare function dateBlockRangeOverlapsRangeFunction(inputRange: DateBlockOrDateBlockIndexOrDateBlockRange): DateBlockRangeOverlapsRangeFunction;
1078
- /**
1079
- * Returns true if either of the ranges overlap eachother.
1080
- *
1081
- * @deprecated use DateCell implementation instead.
1082
- * @param rangeA
1083
- * @param rangeB
1084
- * @returns
1085
- */
1086
- export declare function dateBlockRangeOverlapsRange(rangeA: DateBlockOrDateBlockIndexOrDateBlockRange, rangeB: DateBlockOrDateBlockIndexOrDateBlockRange): boolean;
1087
- /**
1088
- * Sorts the input ranges by index and distance (to values).
1089
- *
1090
- * In many cases sortAscendingIndexNumberRefFunction may be preferential since
1091
- *
1092
- * @deprecated use DateCell implementation instead.
1093
- * @returns
1094
- */
1095
- export declare function sortDateBlockRangeAndSizeFunction<T extends DateBlockRange>(): SortCompareFunction<T>;
1096
- /**
1097
- * Sorts the input date ranges. This will retain the before/after order while also sorting items by index.
1098
- *
1099
- * @deprecated use DateCell implementation instead.
1100
- * @param input
1101
- * @returns
1102
- */
1103
- export declare function sortDateBlockRanges<T extends DateBlockRange>(input: T[]): T[];
1104
- /**
1105
- * DateBlockRange that is known to have a to value.
1106
- *
1107
- * @deprecated use DateCell implementation instead.
1108
- */
1109
- export declare type DateBlockRangeWithRange = RequiredOnKeys<DateBlockRange, 'to'>;
1110
- /**
1111
- * Groups the input values into DateBlockRange values.
1112
- *
1113
- * @deprecated use DateCell implementation instead.
1114
- * @param input
1115
- */
1116
- export declare function groupToDateBlockRanges(input: (DateBlock | DateBlockRange)[]): DateBlockRangeWithRange[];
1117
- /**
1118
- * Returns an array containing all indexes in the date block range.
1119
- *
1120
- * @deprecated use DateCell implementation instead.
1121
- */
1122
- export declare function allIndexesInDateBlockRange(input: DateBlockRange): DateBlockIndex[];
1123
- /**
1124
- * Returns the set of all indexes within the input.
1125
- *
1126
- * @deprecated use DateCell implementation instead.
1127
- * @param input
1128
- * @returns
1129
- */
1130
- export declare function allIndexesInDateBlockRanges(input: (DateBlockIndex | DateBlockRange)[]): Set<DateBlockIndex>;
1131
- /**
1132
- *
1133
- * @deprecated use DateCell implementation instead.
1134
- */
1135
- export interface DateBlockRangeBlockCountInfo {
1136
- /**
1137
- * Total number of blocks.
1138
- */
1139
- readonly count: number;
1140
- /**
1141
- * The "total" if all indexes were added together. Used for calculating the average.
1142
- */
1143
- readonly total: number;
1144
- /**
1145
- * The average block index
1146
- */
1147
- readonly average: number;
1148
- }
1149
- /**
1150
- * Counts the number of blocks in the input range.
1151
- *
1152
- * @deprecated use DateCell implementation instead.
1153
- * @param inputDateBlockRange
1154
- * @returns
1155
- */
1156
- export declare function dateBlockRangeBlocksCountInfo(inputDateBlockRange: ArrayOrValue<DateBlock | DateBlockRange>): DateBlockRangeBlockCountInfo;
1157
- /**
1158
- * Counts the number of blocks in the input range.
1159
- *
1160
- * @deprecated use DateCell implementation instead.
1161
- * @param inputDateBlockRange
1162
- * @returns
1163
- */
1164
- export declare function dateBlockRangeBlocksCount(inputDateBlockRange: ArrayOrValue<DateBlock | DateBlockRange>): number;
1165
- /**
1166
- * Checks whether or not the input range is fully included by the configured ranges.
1167
- *
1168
- * @deprecated use DateCell implementation instead.
1169
- */
1170
- export declare type DateBlockRangesFullyCoverDateBlockRangeFunction = (range: DateBlockRange) => boolean;
1171
- /**
1172
- * Creates a dateBlockRangesFullyCoverDateBlockRangeFunction
1173
- *
1174
- * @deprecated use DateCell implementation instead.
1175
- * @param ranges
1176
- * @returns
1177
- */
1178
- export declare function dateBlockRangesFullyCoverDateBlockRangeFunction(ranges: ArrayOrValue<DateBlockRange>): DateBlockRangesFullyCoverDateBlockRangeFunction;
1179
- /**
1180
- * Expands a DateBlockRange into an array of DateBlock values.
1181
- *
1182
- * @deprecated use DateCell implementation instead.
1183
- * @param block
1184
- * @returns
1185
- */
1186
- export declare function expandDateBlockRange<B extends DateBlockRange | DateBlockRangeWithRange>(block: B): B[];
1187
- /**
1188
- * A DateBlock that also has the potential for a unique identifier.
1189
- *
1190
- * @deprecated use DateCell implementation instead.
1191
- */
1192
- export interface UniqueDateBlock extends DateBlock, UniqueModel {
1193
- }
1194
- /**
1195
- * Represents a range of UniqueDateBlock values keyed by a similar identifier (or lack of identifier).
1196
- *
1197
- * @deprecated use DateCell implementation instead.
1198
- */
1199
- export interface UniqueDateBlockRange extends UniqueDateBlock, DateBlockRange {
1200
- }
1201
- /**
1202
- * Returns true if the input DateBlockRange is longer than 1 block (I.E. has a "to" value greater than it's "i" value).
1203
- *
1204
- * @deprecated use DateCell implementation instead.
1205
- * @param input
1206
- */
1207
- export declare function dateBlockRangeHasRange(input: DateBlockRange | UniqueDateBlock): input is DateBlockRangeWithRange;
1208
- /**
1209
- * Reads the to index if it exists, or returns the block's index itself.
1210
- *
1211
- * @deprecated use DateCell implementation instead.
1212
- * @param input
1213
- * @returns
1214
- */
1215
- export declare function dateBlockEndIndex(input: DateBlockRange | UniqueDateBlock): IndexNumber;
1216
- /**
1217
- * A grouping of UniqueDateBlock values, sorted by date range.
1218
- *
1219
- * @deprecated use DateCell implementation instead.
1220
- */
1221
- export interface UniqueDateBlockRangeGroup<B extends DateBlockRange | UniqueDateBlock> extends DateBlockRange {
1222
- /**
1223
- * Blocks are sorted by index.
1224
- */
1225
- blocks: B[];
1226
- }
1227
- /**
1228
- * Groups all input DateBlockRange or UniqueDateBlock values into a UniqueDateBlockRangeGroup value amd sorts the input.
1229
- *
1230
- * @deprecated use DateCell implementation instead.
1231
- */
1232
- export declare function groupUniqueDateBlocks<B extends DateBlockRange | UniqueDateBlock>(input: B[]): UniqueDateBlockRangeGroup<B>;
1233
- /**
1234
- * Determines how to "fill" a DateRange when an empty range is detected.
1235
- * - extend: extends the previous block to fill the range.
1236
- * - fill: creates a new value using a factory.
1237
- *
1238
- * @deprecated use DateCell implementation instead.
1239
- */
1240
- export declare type ExpandUniqueDateBlocksFillOption = 'extend' | 'fill';
1241
- /**
1242
- * Determines how overwrite block values that are completely overlapping eachother.
1243
- * - current: keeps the "current" value
1244
- * - next: the next/new value overwrites the previous one
1245
- *
1246
- * @deprecated use DateCell implementation instead.
1247
- */
1248
- export declare type ExpandUniqueDateBlocksRetainOverlapOption = 'current' | 'next';
1249
- /**
1250
- *
1251
- * @deprecated use DateCell implementation instead.
1252
- */
1253
- export interface ExpandUniqueDateBlocksConfig<B extends DateBlockRange | UniqueDateBlock> {
1254
- /**
1255
- * The expected start index.
1256
- *
1257
- * If provided, will expand the first block to start at this index, and filter out any blocks that end before this index.
1258
- */
1259
- startAtIndex?: number;
1260
- /**
1261
- * The expected end index, inclusive.
1262
- *
1263
- * If provided, will expand the final block to end at this index, and filter out any blocks that start past this index.
1264
- */
1265
- endAtIndex?: number;
1266
- /**
1267
- * Determines how to fill empty ranges.
1268
- */
1269
- fillOption: ExpandUniqueDateBlocksFillOption;
1270
- /**
1271
- * (Optional) Determines how to handle overwrites.
1272
- *
1273
- * - next: will retain the latest value (next) and overwrite the current value.
1274
- * - current: will retain the current value and ignore any future values at that index.
1275
- *
1276
- * Defaults to next
1277
- */
1278
- retainOnOverlap?: ExpandUniqueDateBlocksRetainOverlapOption;
1279
- /**
1280
- * Used to create new items to fill empty block sets. Required when mode is set to "fill".
1281
- */
1282
- fillFactory?: FactoryWithRequiredInput<B, DateBlockRangeWithRange>;
1283
- }
1284
- /**
1285
- *
1286
- * @deprecated use DateCell implementation instead.
1287
- */
1288
- export interface ExpandUniqueDateBlocksResult<B extends DateBlockRange | UniqueDateBlock> extends UniqueDateBlockRangeGroup<B> {
1289
- /**
1290
- * Blocks that were competely removed. Some blocks stay partially retained.
1291
- */
1292
- discarded: B[];
1293
- }
1294
- /**
1295
- * Expansion function used to sort/merge/replace DateBlockRange values by block.
1296
- *
1297
- * Can optionally specify a second array/group of blocks that are treated as "next" blocks which can take priority or not depending on the retain options.
1298
- *
1299
- * @deprecated use DateCell implementation instead.
1300
- */
1301
- export declare type ExpandUniqueDateBlocksFunction<B extends DateBlockRange | UniqueDateBlock> = (input: B[] | UniqueDateBlockRangeGroup<B>, newBlocks?: B[] | UniqueDateBlockRangeGroup<B>) => ExpandUniqueDateBlocksResult<B>;
1302
- /**
1303
- *
1304
- * @deprecated use DateCell implementation instead.
1305
- * @param config
1306
- * @returns
1307
- */
1308
- export declare function expandUniqueDateBlocksFunction<B extends DateBlockRange | UniqueDateBlock>(config: ExpandUniqueDateBlocksConfig<B>): ExpandUniqueDateBlocksFunction<B>;
1309
- /**
1310
- * Modifies or filter out any blocks that are outside the range to fit within the configured range.
1311
- *
1312
- * @deprecated use DateCell implementation instead.
1313
- */
1314
- export declare type ModifyDateBlocksToFitRangeFunction = <B extends DateBlock | DateBlockRange | UniqueDateBlock>(input: B[]) => B[];
1315
- /**
1316
- * Creatse a ModifyDateBlocksToFitRangeFunction
1317
- *
1318
- * @deprecated use DateCell implementation instead.
1319
- */
1320
- export declare function modifyDateBlocksToFitRangeFunction(range: DateBlockRange): ModifyDateBlocksToFitRangeFunction;
1321
- /**
1322
- *
1323
- * @deprecated use DateCell implementation instead.
1324
- * @param range
1325
- * @param input
1326
- * @returns
1327
- */
1328
- export declare function modifyDateBlocksToFitRange<B extends DateBlock | DateBlockRange | UniqueDateBlock>(range: DateBlockRange, input: B[]): B[];
1329
- /**
1330
- *
1331
- * @deprecated use DateCell implementation instead.
1332
- * @param range
1333
- * @param input
1334
- * @returns
1335
- */
1336
- export declare function modifyDateBlockToFitRange<B extends DateBlock | DateBlockRange | UniqueDateBlock>(range: DateBlockRange, input: B): Maybe<B>;
1337
- /**
1338
- * @deprecated use dateBlocksInDateBlockRange instead.
1339
- */
1340
- export declare const dateBlocksInDateBlockRange: typeof filterDateBlocksInDateBlockRange;
1341
- /**
1342
- * @deprecated use IsDateBlockWithinDateBlockRangeFunction instead.
1343
- */
1344
- export declare type DateBlockIsWithinDateBlockRangeFunction = IsDateBlockWithinDateBlockRangeFunction;
1345
- /**
1346
- * @deprecated use isDateBlockWithinDateBlockRangeFunction() instead.
1347
- */
1348
- export declare const dateBlockIsWithinDateBlockRangeFunction: typeof isDateBlockWithinDateBlockRangeFunction;
1349
- /**
1350
- * @deprecated use isDateBlockWithinDateBlockRange() instead.
1351
- */
1352
- export declare const dateBlockRangeContainsDateBlock: typeof isDateBlockWithinDateBlockRange;
1353
- /**
1354
- * @deprecated use DateBlockDayTimingInfoFactory instead.
1355
- */
1356
- export declare type DateBlockDayInfoFactory = DateBlockDayTimingInfoFactory;
1357
- /**
1358
- * @deprecated use dateBlocksDayTimingInfoFactory instead.
1359
- */
1360
- export declare const dateBlocksDayInfoFactory: typeof dateBlockDayTimingInfoFactory;
1361
- /**
1362
- * @deprecated use DateBlockTimingRelativeIndexFactoryInput instead.
1363
- */
1364
- export declare type DateTimingRelativeIndexFactoryInput = DateBlockTimingRelativeIndexFactoryInput;
1365
- /**
1366
- * @deprecated use DateBlockTimingRelativeIndexFactoryInput instead.
1367
- */
1368
- export declare type DateTimingRelativeIndexFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = DateBlockTimingRelativeIndexFactory<T>;
1369
- /**
1370
- * @deprecated use isDateBlockTimingRelativeIndexFactory instead.
1371
- */
1372
- export declare const isDateTimingRelativeIndexFactory: typeof isDateBlockTimingRelativeIndexFactory;
1373
- /**
1374
- * @deprecated use dateBlockTimingRelativeIndexFactory instead.
1375
- */
1376
- export declare const dateTimingRelativeIndexFactory: typeof dateBlockTimingRelativeIndexFactory;
1377
- /**
1378
- * @deprecated use DateBlockTimingRelativeIndexArrayFactory instead.
1379
- */
1380
- export declare type DateTimingRelativeIndexArrayFactory<T extends DateBlockTimingStart = DateBlockTimingStart> = DateBlockTimingRelativeIndexArrayFactory<T>;
1381
- /**
1382
- * @deprecated use dateBlockTimingRelativeIndexArrayFactory instead.
1383
- */
1384
- export declare const dateTimingRelativeIndexArrayFactory: typeof dateBlockTimingRelativeIndexArrayFactory;
1385
- /**
1386
- * @deprecated use getRelativeIndexForDateBlockTiming instead.
1387
- */
1388
- export declare const getRelativeIndexForDateTiming: typeof getRelativeIndexForDateBlockTiming;