@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,431 +0,0 @@
1
- import { StringOrder, Maybe, DayOfWeek, DecisionFunction, FilterFunction, IndexRange, EnabledDays, ArrayOrValue, TimezoneString } from '@dereekb/util';
2
- import { DateBlock, DateBlockDurationSpan, DateBlockIndex, DateBlockRangeOrDateRange, DateBlockRangeWithRange, DateBlocksExpansionFactory, DateBlockTiming, DateBlockTimingStartEndRange, DateBlockTimingRelativeIndexFactoryInput } from './date.block';
3
- import { DateTimezoneUtcNormalInstance } from './date.timezone';
4
- import { YearWeekCodeConfig } from './date.week';
5
- /**
6
- * @deprecated use DateCellScheduleDayCode instead
7
- */
8
- export declare enum DateScheduleDayCode {
9
- /**
10
- * Special no-op/unused code
11
- */
12
- NONE = 0,
13
- SUNDAY = 1,
14
- MONDAY = 2,
15
- TUESDAY = 3,
16
- WEDNESDAY = 4,
17
- THURSDAY = 5,
18
- FRIDAY = 6,
19
- SATURDAY = 7,
20
- /**
21
- * All weekdays (Mon-Fri)
22
- */
23
- WEEKDAY = 8,
24
- /**
25
- * All weekend days (Sat/Sun)
26
- */
27
- WEEKEND = 9
28
- }
29
- /**
30
- * @deprecated use DateCell implementation instead.
31
- */
32
- export declare function fullWeekDayScheduleDayCodes(): DateScheduleDayCode[];
33
- /**
34
- * @deprecated use DateCell implementation instead.
35
- */
36
- export declare function weekdayDateScheduleDayCodes(): DateScheduleDayCode[];
37
- /**
38
- * @deprecated use DateCell implementation instead.
39
- */
40
- export declare function weekendDateScheduleDayCodes(): DateScheduleDayCode[];
41
- /**
42
- * Creates an EnabledDays from the input.
43
- *
44
- * @deprecated use DateCell implementation instead.
45
- * @param input
46
- * @returns
47
- */
48
- export declare function enabledDaysFromDateScheduleDayCodes(input: Maybe<Iterable<DateScheduleDayCode>>): EnabledDays;
49
- /**
50
- * Creates an array of simplified DateScheduleDayCode[] values from the input.
51
- *
52
- * @deprecated use DateCell implementation instead.
53
- * @param input
54
- * @returns
55
- */
56
- export declare function dateScheduleDayCodesFromEnabledDays(input: Maybe<EnabledDays>): DateScheduleDayCode[];
57
- /**
58
- * Encoded days of the week that the job block schedule should contain.
59
- *
60
- * @deprecated use DateCell implementation instead.
61
- */
62
- export declare type DateScheduleEncodedWeek = '' | StringOrder<`${DateScheduleDayCode}`, ''>;
63
- /**
64
- * @deprecated use DateCell implementation instead.
65
- */
66
- export declare const DATE_SCHEDULE_ENCODED_WEEK_REGEX: RegExp;
67
- /**
68
- * Returns true if the input is a DateScheduleEncodedWeek.
69
- *
70
- * @deprecated use DateCell implementation instead.
71
- * @param input
72
- * @returns
73
- */
74
- export declare function isDateScheduleEncodedWeek(input: string): input is DateScheduleEncodedWeek;
75
- /**
76
- * Returns true if the input string represents an empty DateScheduleEncodedWeek.
77
- *
78
- * @deprecated use DateCell implementation instead.
79
- * @param input
80
- * @returns
81
- */
82
- export declare function isEmptyDateScheduleEncodedWeek(input: string): input is DateScheduleEncodedWeek;
83
- /**
84
- * Creates a DateScheduleEncodedWeek from an array of DateScheduleDayCode values.
85
- *
86
- * The returned encoded week is simplified.
87
- *
88
- * @deprecated use DateCell implementation instead.
89
- * @param codes
90
- */
91
- export declare function dateScheduleEncodedWeek(codes: Iterable<DateScheduleDayCode>): DateScheduleEncodedWeek;
92
- /**
93
- * Reduces/merges any day codes into more simplified day codes.
94
- *
95
- * For instance, if all days of the week are selected, they will be reduced to "8".
96
- *
97
- * @deprecated use DateCell implementation instead.
98
- * @param codes
99
- * @returns
100
- */
101
- export declare function simplifyDateScheduleDayCodes(codes: Iterable<DateScheduleDayCode>): DateScheduleDayCode[];
102
- /**
103
- * @deprecated use DateCell implementation instead.
104
- */
105
- export declare type DateScheduleDayCodesInput = DateScheduleEncodedWeek | ArrayOrValue<DateScheduleDayCode> | Set<DateScheduleDayCode>;
106
- /**
107
- * Expands the input DateScheduleDayCodesInput to a Set of DayOfWeek values.
108
- *
109
- * @deprecated use DateCell implementation instead.
110
- * @param input
111
- * @returns
112
- */
113
- export declare function expandDateScheduleDayCodesToDayOfWeekSet(input: DateScheduleDayCodesInput): Set<DayOfWeek>;
114
- /**
115
- *
116
- * @deprecated use DateCell implementation instead.
117
- * @param input
118
- * @returns
119
- */
120
- export declare function dateScheduleDayCodesSetFromDaysOfWeek(input: Iterable<DayOfWeek>): Set<DateScheduleDayCode>;
121
- /**
122
- * Expands the input into an array of DateScheduleDayCode values.
123
- *
124
- * @deprecated use DateCell implementation instead.
125
- * @param input
126
- * @returns
127
- */
128
- export declare function expandDateScheduleDayCodes(input: DateScheduleDayCodesInput): DateScheduleDayCode[];
129
- /**
130
- * Expands the input DateScheduleDayCodesInput to a Set of DayOfWeek values.
131
- *
132
- * @deprecated use DateCell implementation instead.
133
- * @param input
134
- * @returns
135
- */
136
- export declare function expandDateScheduleDayCodesToDayCodesSet(input: DateScheduleDayCodesInput): Set<DateScheduleDayCode>;
137
- /**
138
- * Converts the input DateScheduleDayCodesInput to an array of DateScheduleDayCode values, but does not expand
139
- *
140
- * @deprecated use DateCell implementation instead.
141
- * @param input
142
- * @returns
143
- */
144
- export declare function rawDateScheduleDayCodes(input: DateScheduleDayCodesInput): DateScheduleDayCode[];
145
- /**
146
- * Used to convert the input dates into a DateScheduleDayCode.
147
- *
148
- * @deprecated use DateCell implementation instead.
149
- */
150
- export declare type DateScheduleDayCodeFactory = (date: Date) => DateScheduleDayCode;
151
- /**
152
- * @deprecated use DateCell implementation instead.
153
- */
154
- export declare type DateScheduleDayCodeConfig = Pick<YearWeekCodeConfig, 'timezone'>;
155
- /**
156
- * Creates a DateScheduleDayCodeFactory using the optional input config.
157
- *
158
- * @deprecated use DateCell implementation instead.
159
- * @param config
160
- * @returns
161
- */
162
- export declare function dateScheduleDayCodeFactory(config?: DateScheduleDayCodeConfig): DateScheduleDayCodeFactory;
163
- /**
164
- * Returns true if the input codes, when expanded, are equivalent.
165
- *
166
- * @deprecated use DateCell implementation instead.
167
- * @param a
168
- * @param b
169
- * @returns
170
- */
171
- export declare function dateScheduleDayCodesAreSetsEquivalent(a: DateScheduleDayCodesInput, b: DateScheduleDayCodesInput): boolean;
172
- /**
173
- * Scheduled used to filter to disable DateBlock values for a job.
174
- *
175
- * @deprecated use DateCell implementation instead.
176
- */
177
- export interface DateSchedule {
178
- /**
179
- * Days of the week to include.
180
- */
181
- w: DateScheduleEncodedWeek;
182
- /**
183
- * Specific DateBlockIndex values to include.
184
- */
185
- d?: DateBlockIndex[];
186
- /**
187
- * Specific DateBlockIndex values to exclude.
188
- */
189
- ex?: DateBlockIndex[];
190
- }
191
- /**
192
- *
193
- * @deprecated use DateCell implementation instead.
194
- * @param a
195
- * @param b
196
- * @returns
197
- */
198
- export declare function isSameDateSchedule(a: Maybe<DateSchedule>, b: Maybe<DateSchedule>): boolean;
199
- /**
200
- *
201
- * @deprecated use DateCell implementation instead.
202
- */
203
- export declare class DateSchedule implements DateSchedule {
204
- w: DateScheduleEncodedWeek;
205
- d?: DateBlockIndex[];
206
- ex?: DateBlockIndex[];
207
- constructor(template?: DateSchedule);
208
- }
209
- /**
210
- * A schedule that occurs during a specific range.
211
- *
212
- * @deprecated use DateCell implementation instead.
213
- */
214
- export interface DateScheduleRange extends DateSchedule, DateBlockTimingStartEndRange {
215
- }
216
- /**
217
- * Returns true if both inputs have the same schedule and date range.
218
- *
219
- * @deprecated use DateCell implementation instead.
220
- * @param a
221
- * @param b
222
- * @returns
223
- */
224
- export declare function isSameDateScheduleRange(a: Maybe<DateScheduleRange>, b: Maybe<DateScheduleRange>): boolean;
225
- /**
226
- * Creates a DateBlockTiming for the input DateScheduleRange.
227
- *
228
- * The Timezone the timing is in is recommended. If not provided, may produce incorrect results when dealing with daylight savings time changes.
229
- *
230
- * @deprecated use DateCell implementation instead.
231
- * @param dateScheduleRange
232
- * @param duration
233
- * @param startsAtTime
234
- * @param timezone
235
- * @returns
236
- */
237
- export declare function dateBlockTimingForDateScheduleRange(dateScheduleRange: DateScheduleRange, duration: number, startsAtTime?: Date, timezone?: DateTimezoneUtcNormalInstance | TimezoneString): DateBlockTiming;
238
- /**
239
- * DateScheduleDateFilter input.
240
- *
241
- * @deprecated use DateCell implementation instead.
242
- */
243
- export declare type DateScheduleDateFilterInput = DateBlockTimingRelativeIndexFactoryInput;
244
- /**
245
- * Returns true if the date falls within the schedule.
246
- *
247
- * @deprecated use DateCell implementation instead.
248
- */
249
- export declare type DateScheduleDateFilter = DecisionFunction<DateScheduleDateFilterInput>;
250
- /**
251
- * dateScheduleDateFilter() configuration.
252
- *
253
- * The input date range is a DateBlockTimingStartEndRange, where the start date is expected to be a DateBlockTimingStart.
254
- *
255
- * @deprecated use DateCell implementation instead.
256
- */
257
- export interface DateScheduleDateFilterConfig extends DateSchedule, Partial<DateBlockTimingStartEndRange> {
258
- minMaxDateRange?: Maybe<Partial<DateBlockRangeOrDateRange>>;
259
- /**
260
- * Whether or not to restrict the start as the min date if a min date is not set in minMaxDateRange. True by default.
261
- */
262
- setStartAsMinDate?: boolean;
263
- }
264
- /**
265
- *
266
- * @deprecated use DateCell implementation instead.
267
- * @param inputFilter
268
- * @returns
269
- */
270
- export declare function copyDateScheduleDateFilterConfig(inputFilter: DateScheduleDateFilterConfig): DateScheduleDateFilterConfig;
271
- /**
272
- * Creates a DateScheduleDateFilter.
273
- *
274
- * @deprecated use DateCell implementation instead.
275
- * @param config
276
- * @returns
277
- */
278
- export declare function dateScheduleDateFilter(config: DateScheduleDateFilterConfig): DateScheduleDateFilter;
279
- /**
280
- *
281
- * @deprecated use DateCell implementation instead.
282
- */
283
- export declare type DateScheduleDateBlockTimingFilter<B extends DateBlock = DateBlock> = DecisionFunction<B>;
284
- /**
285
- * Configuration for dateScheduleDateBlockTimingFilter()
286
- *
287
- * @deprecated use DateCell implementation instead.
288
- */
289
- export interface DateScheduleDateBlockTimingFilterConfig {
290
- /**
291
- * Timing to filter with.
292
- */
293
- timing: DateBlockTiming;
294
- /**
295
- * Schedule to filter with.
296
- */
297
- schedule: DateSchedule;
298
- /**
299
- * Wether or not to expand on the inverse of the schedule, returning blocks that are not in the schedule.
300
- *
301
- * Other date filtering behaves the same (I.E. onlyBlocksNotYetStarted, etc.)
302
- */
303
- invertSchedule?: boolean;
304
- /**
305
- * (Optional) date to use when filtering from now.
306
- */
307
- now?: Date;
308
- /**
309
- * (Optional) filters in blocks that have not yet started. Can be combined with the other filters.
310
- */
311
- onlyBlocksThatHaveStarted?: boolean;
312
- /**
313
- * (Optional) filters in blocks that have not yet ended. Can be combined with the other filters.
314
- */
315
- onlyBlocksThatHaveEnded?: boolean;
316
- /**
317
- * (Optional) filters in blocks that have not yet started. Can be combined with the other filters.
318
- */
319
- onlyBlocksNotYetStarted?: boolean;
320
- /**
321
- * (Optional) filters in blocks that have not yet ended. Can be combined with the other filters.
322
- */
323
- onlyBlocksNotYetEnded?: boolean;
324
- /**
325
- * (Optional) custom filter function. Can be combined with the other filters.
326
- */
327
- durationSpanFilter?: FilterFunction<DateBlockDurationSpan<DateBlock>>;
328
- /**
329
- * (Optional) Maximum number of blocks to return.
330
- */
331
- maxDateBlocksToReturn?: number;
332
- }
333
- /**
334
- * Creates a DateScheduleDateBlockTimingFilter.
335
- *
336
- * @deprecated use DateCell implementation instead.
337
- * @param param0
338
- * @returns
339
- */
340
- export declare function dateScheduleDateBlockTimingFilter<B extends DateBlock = DateBlock>({ timing, schedule }: DateScheduleDateBlockTimingFilterConfig): DateScheduleDateBlockTimingFilter<B>;
341
- /**
342
- * Creates a DateBlocksExpansionFactory using the input DateScheduleDateBlockTimingFilterConfig.
343
- *
344
- * @deprecated use DateCell implementation instead.
345
- * @param config
346
- * @returns
347
- */
348
- export declare function expandDateScheduleFactory<B extends DateBlock = DateBlock>(config: DateScheduleDateBlockTimingFilterConfig): DateBlocksExpansionFactory<B>;
349
- /**
350
- * @deprecated use DateCell implementation instead.
351
- */
352
- export interface ExpandDateScheduleInput extends DateScheduleDateBlockTimingFilterConfig {
353
- inputRange?: IndexRange;
354
- }
355
- /**
356
- * Expands the input DateBlockTiming and DateSchedule into an array of DateBlockDurationSpan value that correspond with blocks in the event.
357
- *
358
- * Can optionally provide an IndexRange to specify a specific range to filter on. The range will be capped to the range of the timing.
359
- *
360
- * @deprecated use DateCell implementation instead.
361
- * @param timing
362
- * @param schedule
363
- * @param inputRange
364
- * @returns
365
- */
366
- export declare function expandDateSchedule(input: ExpandDateScheduleInput): DateBlockDurationSpan<DateBlock>[];
367
- /**
368
- * Input for ExpandDateScheduleRangeInput
369
- *
370
- * @deprecated use DateCell implementation instead.
371
- */
372
- export interface ExpandDateScheduleRangeInput extends Omit<DateScheduleDateBlockTimingFilterConfig, 'schedule' | 'timing'> {
373
- readonly dateScheduleRange: DateScheduleRange;
374
- /**
375
- * Duration of the timing.
376
- */
377
- readonly duration: number;
378
- /**
379
- * (Optional) Hours/Minutes to copy from. Note, this will modify the timing's end date to be a valid time.
380
- */
381
- readonly startsAtTime?: Date;
382
- /**
383
- * (Recommended) Timezone the timing is in. If not provided, may produce incorrect results when dealing with daylight savings time changes.
384
- */
385
- readonly timezone?: DateTimezoneUtcNormalInstance | TimezoneString;
386
- }
387
- /**
388
- * Creates a DateBlockTiming for the input ExpandDateScheduleRangeInput.
389
- *
390
- * @deprecated use DateCell implementation instead.
391
- * @param input
392
- * @returns
393
- */
394
- export declare function dateBlockTimingForExpandDateScheduleRangeInput(input: ExpandDateScheduleRangeInput): DateBlockTiming;
395
- /**
396
- *
397
- * @deprecated use DateCell implementation instead.
398
- * @param input
399
- * @returns
400
- */
401
- export declare function expandDateScheduleRange(input: ExpandDateScheduleRangeInput): DateBlockDurationSpan<DateBlock>[];
402
- /**
403
- *
404
- * @deprecated use DateCell implementation instead.
405
- */
406
- export declare type ExpandDateScheduleRangeToDateBlockRangeInput = ExpandDateScheduleRangeInput;
407
- /**
408
- *
409
- * @deprecated use DateCell implementation instead.
410
- * @param input
411
- * @returns
412
- */
413
- export declare function expandDateScheduleRangeToDateBlockRanges(input: ExpandDateScheduleRangeToDateBlockRangeInput): DateBlockRangeWithRange[];
414
- /**
415
- * Converts the input DateScheduleDayCodesInput to an array of DateScheduleDayCode values.
416
- *
417
- * @param input
418
- * @returns
419
- *
420
- * @deprecated Use expandDateScheduleDayCodes or rawDateScheduleDayCodes depending on the need case.
421
- */
422
- export declare const dateScheduleDayCodes: typeof expandDateScheduleDayCodes;
423
- /**
424
- * Expands a DateScheduleEncodedWeek to an array of DateScheduleDayCode valeus.
425
- *
426
- * @param week
427
- * @returns
428
- *
429
- * @deprecated Use expandDateScheduleDayCodes instead.
430
- */
431
- export declare const expandDateScheduleEncodedWeek: typeof expandDateScheduleDayCodes;