@dereekb/date 10.0.5 → 10.0.7

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 (134) hide show
  1. package/index.cjs.d.ts +1 -0
  2. package/index.cjs.js +9264 -0
  3. package/index.esm.js +9957 -0
  4. package/package.json +17 -3
  5. package/src/lib/date/date.calendar.d.ts +1 -1
  6. package/src/lib/date/date.cell.d.ts +3 -3
  7. package/src/lib/date/date.cell.factory.d.ts +5 -5
  8. package/src/lib/date/date.cell.filter.d.ts +3 -3
  9. package/src/lib/date/date.cell.index.d.ts +4 -3
  10. package/src/lib/date/date.cell.schedule.d.ts +7 -7
  11. package/src/lib/date/date.cell.schedule.day.d.ts +2 -2
  12. package/src/lib/date/date.cell.validator.d.ts +2 -2
  13. package/src/lib/date/date.cell.week.d.ts +3 -3
  14. package/src/lib/date/date.d.ts +1 -1
  15. package/src/lib/date/date.day.d.ts +3 -3
  16. package/src/lib/date/date.duration.d.ts +2 -2
  17. package/src/lib/date/date.format.d.ts +3 -4
  18. package/src/lib/date/date.logical.d.ts +1 -1
  19. package/src/lib/date/date.range.d.ts +1 -1
  20. package/src/lib/date/date.range.string.d.ts +2 -2
  21. package/src/lib/date/date.range.timezone.d.ts +2 -2
  22. package/src/lib/date/date.rxjs.d.ts +3 -3
  23. package/src/lib/date/date.sort.d.ts +2 -2
  24. package/src/lib/date/date.time.d.ts +3 -3
  25. package/src/lib/date/date.time.limit.d.ts +3 -3
  26. package/src/lib/date/date.time.minute.d.ts +4 -4
  27. package/src/lib/date/date.timezone.d.ts +2 -2
  28. package/src/lib/date/date.unix.d.ts +1 -1
  29. package/src/lib/date/date.week.d.ts +3 -3
  30. package/src/lib/expires/expires.d.ts +1 -1
  31. package/src/lib/expires/expires.rxjs.d.ts +3 -3
  32. package/src/lib/query/query.builder.d.ts +2 -2
  33. package/src/lib/query/query.builder.mongo.d.ts +2 -2
  34. package/src/lib/query/query.filter.d.ts +2 -2
  35. package/src/lib/query/query.request.d.ts +2 -2
  36. package/src/lib/rrule/date.recurrence.d.ts +4 -4
  37. package/src/lib/rrule/date.rrule.d.ts +5 -5
  38. package/src/lib/rrule/date.rrule.extension.d.ts +1 -1
  39. package/src/lib/rrule/date.rrule.parse.d.ts +2 -2
  40. package/src/lib/timezone/timezone.d.ts +1 -1
  41. package/src/lib/timezone/timezone.validator.d.ts +2 -2
  42. package/CHANGELOG.md +0 -1488
  43. package/src/index.js +0 -5
  44. package/src/index.js.map +0 -1
  45. package/src/lib/date/date.calendar.js +0 -65
  46. package/src/lib/date/date.calendar.js.map +0 -1
  47. package/src/lib/date/date.cell.factory.js +0 -493
  48. package/src/lib/date/date.cell.factory.js.map +0 -1
  49. package/src/lib/date/date.cell.filter.js +0 -65
  50. package/src/lib/date/date.cell.filter.js.map +0 -1
  51. package/src/lib/date/date.cell.index.js +0 -731
  52. package/src/lib/date/date.cell.index.js.map +0 -1
  53. package/src/lib/date/date.cell.js +0 -574
  54. package/src/lib/date/date.cell.js.map +0 -1
  55. package/src/lib/date/date.cell.schedule.day.js +0 -15
  56. package/src/lib/date/date.cell.schedule.day.js.map +0 -1
  57. package/src/lib/date/date.cell.schedule.js +0 -711
  58. package/src/lib/date/date.cell.schedule.js.map +0 -1
  59. package/src/lib/date/date.cell.validator.js +0 -67
  60. package/src/lib/date/date.cell.validator.js.map +0 -1
  61. package/src/lib/date/date.cell.week.js +0 -40
  62. package/src/lib/date/date.cell.week.js.map +0 -1
  63. package/src/lib/date/date.day.js +0 -207
  64. package/src/lib/date/date.day.js.map +0 -1
  65. package/src/lib/date/date.duration.js +0 -56
  66. package/src/lib/date/date.duration.js.map +0 -1
  67. package/src/lib/date/date.format.js +0 -231
  68. package/src/lib/date/date.format.js.map +0 -1
  69. package/src/lib/date/date.hashset.js +0 -11
  70. package/src/lib/date/date.hashset.js.map +0 -1
  71. package/src/lib/date/date.js +0 -267
  72. package/src/lib/date/date.js.map +0 -1
  73. package/src/lib/date/date.logical.js +0 -61
  74. package/src/lib/date/date.logical.js.map +0 -1
  75. package/src/lib/date/date.range.js +0 -643
  76. package/src/lib/date/date.range.js.map +0 -1
  77. package/src/lib/date/date.range.string.js +0 -19
  78. package/src/lib/date/date.range.string.js.map +0 -1
  79. package/src/lib/date/date.range.timezone.js +0 -29
  80. package/src/lib/date/date.range.timezone.js.map +0 -1
  81. package/src/lib/date/date.round.js +0 -49
  82. package/src/lib/date/date.round.js.map +0 -1
  83. package/src/lib/date/date.rxjs.js +0 -40
  84. package/src/lib/date/date.rxjs.js.map +0 -1
  85. package/src/lib/date/date.sort.js +0 -43
  86. package/src/lib/date/date.sort.js.map +0 -1
  87. package/src/lib/date/date.time.js +0 -240
  88. package/src/lib/date/date.time.js.map +0 -1
  89. package/src/lib/date/date.time.limit.js +0 -99
  90. package/src/lib/date/date.time.limit.js.map +0 -1
  91. package/src/lib/date/date.time.minute.js +0 -144
  92. package/src/lib/date/date.time.minute.js.map +0 -1
  93. package/src/lib/date/date.timezone.js +0 -494
  94. package/src/lib/date/date.timezone.js.map +0 -1
  95. package/src/lib/date/date.unix.js +0 -41
  96. package/src/lib/date/date.unix.js.map +0 -1
  97. package/src/lib/date/date.week.js +0 -263
  98. package/src/lib/date/date.week.js.map +0 -1
  99. package/src/lib/date/index.js +0 -30
  100. package/src/lib/date/index.js.map +0 -1
  101. package/src/lib/expires/expires.js +0 -81
  102. package/src/lib/expires/expires.js.map +0 -1
  103. package/src/lib/expires/expires.rxjs.js +0 -61
  104. package/src/lib/expires/expires.rxjs.js.map +0 -1
  105. package/src/lib/expires/index.js +0 -6
  106. package/src/lib/expires/index.js.map +0 -1
  107. package/src/lib/index.js +0 -9
  108. package/src/lib/index.js.map +0 -1
  109. package/src/lib/query/index.js +0 -8
  110. package/src/lib/query/index.js.map +0 -1
  111. package/src/lib/query/query.builder.js +0 -85
  112. package/src/lib/query/query.builder.js.map +0 -1
  113. package/src/lib/query/query.builder.mongo.js +0 -41
  114. package/src/lib/query/query.builder.mongo.js.map +0 -1
  115. package/src/lib/query/query.filter.js +0 -3
  116. package/src/lib/query/query.filter.js.map +0 -1
  117. package/src/lib/query/query.request.js +0 -3
  118. package/src/lib/query/query.request.js.map +0 -1
  119. package/src/lib/rrule/date.recurrence.js +0 -93
  120. package/src/lib/rrule/date.recurrence.js.map +0 -1
  121. package/src/lib/rrule/date.rrule.extension.js +0 -151
  122. package/src/lib/rrule/date.rrule.extension.js.map +0 -1
  123. package/src/lib/rrule/date.rrule.js +0 -187
  124. package/src/lib/rrule/date.rrule.js.map +0 -1
  125. package/src/lib/rrule/date.rrule.parse.js +0 -135
  126. package/src/lib/rrule/date.rrule.parse.js.map +0 -1
  127. package/src/lib/rrule/index.js +0 -8
  128. package/src/lib/rrule/index.js.map +0 -1
  129. package/src/lib/timezone/index.js +0 -6
  130. package/src/lib/timezone/index.js.map +0 -1
  131. package/src/lib/timezone/timezone.js +0 -66
  132. package/src/lib/timezone/timezone.js.map +0 -1
  133. package/src/lib/timezone/timezone.validator.js +0 -26
  134. package/src/lib/timezone/timezone.validator.js.map +0 -1
package/src/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib"), exports);
5
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/date/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calendarDateForDateDurationSpan = exports.calendarDate = exports.calendarDateFactory = exports.CalendarDate = exports.CalendarDateType = void 0;
4
- const tslib_1 = require("tslib");
5
- const class_transformer_1 = require("class-transformer");
6
- const class_validator_1 = require("class-validator");
7
- const date_1 = require("./date");
8
- const date_duration_1 = require("./date.duration");
9
- const date_format_1 = require("./date.format");
10
- const date_timezone_1 = require("./date.timezone");
11
- /**
12
- * CalendarDateType
13
- */
14
- var CalendarDateType;
15
- (function (CalendarDateType) {
16
- /**
17
- * Event starts at a specific time and lasts for a certain duration.
18
- */
19
- CalendarDateType["TIME"] = "time";
20
- /**
21
- * Event is specifically for a number of days. Duration is still tracked in minutes.
22
- */
23
- CalendarDateType["DAYS"] = "days";
24
- })(CalendarDateType || (exports.CalendarDateType = CalendarDateType = {}));
25
- class CalendarDate extends date_duration_1.DateDurationSpan {
26
- constructor(template) {
27
- super(template);
28
- /**
29
- * The type of event date.
30
- */
31
- this.type = CalendarDateType.TIME;
32
- if (template != null) {
33
- this.type = template.type;
34
- }
35
- }
36
- }
37
- exports.CalendarDate = CalendarDate;
38
- tslib_1.__decorate([
39
- (0, class_transformer_1.Expose)(),
40
- (0, class_validator_1.IsEnum)(CalendarDateType),
41
- tslib_1.__metadata("design:type", String)
42
- ], CalendarDate.prototype, "type", void 0);
43
- function calendarDateFactory(config) {
44
- const normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? { useSystemTimezone: true } : { timezone: config.timezone ? config.timezone : undefined };
45
- const normal = (0, date_timezone_1.dateTimezoneUtcNormal)(normalConfig);
46
- return (day, days) => {
47
- const date = (0, date_format_1.parseISO8601DayStringToUTCDate)(day);
48
- const startsAt = normal.targetDateToBaseDate(date);
49
- return {
50
- type: CalendarDateType.DAYS,
51
- startsAt,
52
- duration: (0, date_1.daysToMinutes)(days)
53
- };
54
- };
55
- }
56
- exports.calendarDateFactory = calendarDateFactory;
57
- function calendarDate(day, days, timezone) {
58
- return calendarDateFactory({ timezone })(day, days);
59
- }
60
- exports.calendarDate = calendarDate;
61
- function calendarDateForDateDurationSpan(dateDurationSpan) {
62
- return Object.assign({ type: CalendarDateType.TIME }, dateDurationSpan);
63
- }
64
- exports.calendarDateForDateDurationSpan = calendarDateForDateDurationSpan;
65
- //# sourceMappingURL=date.calendar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.calendar.js","sourceR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YACL,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,QAAQ;YACR,QAAQ,EAAE,IAAA,oBAAa,EAAC,IAAI,CAAC;SAC9B,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAdD,kDAcC;AAED,SAAgB,YAAY,CAAC,GAAqB,EAAE,IAAa,EAAE,QAAyB;IAC1F,OAAO,mBAAmB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAFD,oCAEC;AAED,SAAgB,+BAA+B,CAAC,gBAAkC;IAChF,uBACE,IAAI,EAAE,gBAAgB,CAAC,IAAI,IACxB,gBAAgB,EACnB;AACJ,CAAC;AALD,0EAKC"}
@@ -1,493 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDateWithinDateCellRangeFunction = exports.updateDateCellTimingWithDateCellTimingEvent = exports.dateCellTimingFromDateCellTimingStartsAtEndRange = exports.getRelativeDateForDateCellTiming = exports.dateCellTimingEndDateFactory = exports.dateCellTimingStartsAtDateFactory = exports.dateCellTimingStartDateFactory = exports.dateCellTimingEndIndex = exports.dateCellTimingDateFactory = exports.getRelativeIndexForDateCellTiming = exports.dateCellTimingRelativeIndexArrayFactory = exports.dateCellTimingRelativeIndexFactory = exports.isDateCellTimingRelativeIndexFactory = exports.dateCellDayTimingInfoFactory = exports.dateCellTimingExpansionFactory = exports.expandDateCellTiming = exports.expandDateCellCollection = exports.dateCellIndexRange = exports.dateCellIndexRangeToDateCellRange = exports.dateCellRangeToDateCellIndexRange = void 0;
4
- const util_1 = require("@dereekb/util");
5
- const date_fns_1 = require("date-fns");
6
- const date_1 = require("./date");
7
- const date_cell_1 = require("./date.cell");
8
- const date_cell_index_1 = require("./date.cell.index");
9
- const date_format_1 = require("./date.format");
10
- const date_range_1 = require("./date.range");
11
- const date_timezone_1 = require("./date.timezone");
12
- function dateCellRangeToDateCellIndexRange(range) {
13
- var _a;
14
- return { minIndex: range.i, maxIndex: ((_a = range.to) !== null && _a !== void 0 ? _a : range.i) + 1 };
15
- }
16
- exports.dateCellRangeToDateCellIndexRange = dateCellRangeToDateCellIndexRange;
17
- function dateCellIndexRangeToDateCellRange(range) {
18
- return { i: range.minIndex, to: range.maxIndex - 1 };
19
- }
20
- exports.dateCellIndexRangeToDateCellRange = dateCellIndexRangeToDateCellRange;
21
- /**
22
- * Generates a DateCellIndexRange based on the input timing.
23
- *
24
- * An arbitrary limit can also be applied.
25
- *
26
- * @param timing
27
- * @param limit
28
- * @param fitToTimingRange
29
- */
30
- function dateCellIndexRange(timing, limit, fitToTimingRange = true) {
31
- const indexFactory = dateCellTimingRelativeIndexFactory(timing);
32
- const { startsAt: lastStartsAt } = (0, date_cell_1.dateCellTimingFinalStartsAtEvent)(timing); // use last startsAt date for the proper date
33
- let minIndex = 0;
34
- let maxIndex = indexFactory(lastStartsAt) + 1; // add one since this is a DateCellIndexRange, and not a DateCellRange.
35
- if (limit) {
36
- const { start, end } = (0, date_cell_1.dateCellTiming)(timing, limit);
37
- const limitMin = indexFactory(start);
38
- const limitMax = indexFactory(end) + 1;
39
- if (fitToTimingRange) {
40
- minIndex = Math.min(limitMin, maxIndex);
41
- maxIndex = Math.min(limitMax, maxIndex);
42
- }
43
- else {
44
- minIndex = limitMin;
45
- maxIndex = limitMax;
46
- }
47
- }
48
- return { minIndex, maxIndex };
49
- }
50
- exports.dateCellIndexRange = dateCellIndexRange;
51
- /**
52
- * Convenience function for calling expandDateCells() with the input DateCellCollection.
53
- *
54
- * @param collection
55
- * @returns
56
- */
57
- function expandDateCellCollection(collection) {
58
- return expandDateCellTiming(collection.timing, collection.blocks);
59
- }
60
- exports.expandDateCellCollection = expandDateCellCollection;
61
- /**
62
- * Convenience function for calling dateCellTimingExpansionFactory() then passing the blocks.
63
- *
64
- * @param blocks
65
- * @param timing
66
- * @returns
67
- */
68
- function expandDateCellTiming(timing, blocks) {
69
- return dateCellTimingExpansionFactory({ timing })(blocks);
70
- }
71
- exports.expandDateCellTiming = expandDateCellTiming;
72
- /**
73
- * Creates a DateCellTimingExpansionFactory
74
- *
75
- * @param config
76
- * @returns
77
- */
78
- function dateCellTimingExpansionFactory(config) {
79
- const { timing, rangeLimit, filter: inputFilter, durationSpanFilter: inputDurationSpanFilter, maxDateCellsToReturn = Number.MAX_SAFE_INTEGER, blocksEvaluationLimit = Number.MAX_SAFE_INTEGER } = config;
80
- const { duration } = timing;
81
- const indexRange = rangeLimit !== false ? dateCellIndexRange(timing, rangeLimit) : { minIndex: Number.MIN_SAFE_INTEGER, maxIndex: Number.MAX_SAFE_INTEGER };
82
- const isInRange = (0, util_1.indexRangeCheckFunction)({ indexRange, inclusiveMaxIndex: false });
83
- const filter = (0, util_1.mergeFilterFunctions)((x) => isInRange(x.i), inputFilter);
84
- const startsAtFactory = dateCellTimingStartsAtDateFactory(timing);
85
- const durationSpanFilter = inputDurationSpanFilter !== null && inputDurationSpanFilter !== void 0 ? inputDurationSpanFilter : (() => true);
86
- return (input) => {
87
- const blocks = Array.isArray(input) ? input : input.blocks;
88
- const spans = [];
89
- let blocksEvaluated = 0;
90
- function filterAndPush(block, blockIndex) {
91
- // increase the evaluation count early in-case we set the blocksEvaluationLimit below.
92
- blocksEvaluated += 1;
93
- if (filter(block, blockIndex)) {
94
- const startsAt = startsAtFactory(block.i);
95
- const durationSpan = Object.assign(Object.assign({}, block), { startsAt,
96
- duration });
97
- // try the duration span filter
98
- if (durationSpanFilter(durationSpan, blockIndex)) {
99
- if (spans.length >= maxDateCellsToReturn) {
100
- blocksEvaluated = blocksEvaluationLimit; // trigger return below
101
- }
102
- else {
103
- spans.push(durationSpan);
104
- }
105
- }
106
- }
107
- }
108
- blocks.findIndex((block) => {
109
- if ((0, date_cell_index_1.dateCellRangeHasRange)(block)) {
110
- // Expands the block's range as if it is at a single index
111
- (0, util_1.range)(block.i, block.to + 1).findIndex((i) => {
112
- const blockAtIndex = Object.assign(Object.assign({}, block), { i, to: i }); // copy block, set to as i
113
- filterAndPush(blockAtIndex, blocksEvaluated);
114
- // continue iterating until we hit the evaluation limit.
115
- return blocksEvaluated >= blocksEvaluationLimit;
116
- });
117
- }
118
- else {
119
- filterAndPush(block, blocksEvaluated);
120
- }
121
- return blocksEvaluated >= blocksEvaluationLimit; // continue iterating until we hit the evaluation limit or run out of items.
122
- });
123
- return spans;
124
- };
125
- }
126
- exports.dateCellTimingExpansionFactory = dateCellTimingExpansionFactory;
127
- function dateCellDayTimingInfoFactory(config) {
128
- const { timing, rangeLimit } = config;
129
- const { duration } = timing;
130
- const indexRange = rangeLimit !== false ? dateCellIndexRange(timing, rangeLimit) : { minIndex: Number.MIN_SAFE_INTEGER, maxIndex: Number.MAX_SAFE_INTEGER };
131
- const checkIsInRange = (0, util_1.indexRangeCheckFunction)({ indexRange, inclusiveMaxIndex: false });
132
- const dayIndexFactory = dateCellTimingRelativeIndexFactory(timing);
133
- const dayFactory = dateCellTimingDateFactory(timing);
134
- const startsAtFactory = dateCellTimingStartsAtDateFactory(dayIndexFactory);
135
- return (input, inputNow) => {
136
- const date = typeof input === 'number' ? dayFactory(input) : input;
137
- const dayIndex = dayIndexFactory(input);
138
- const isInRange = checkIsInRange(dayIndex);
139
- const now = inputNow !== null && inputNow !== void 0 ? inputNow : date;
140
- const startsAtOnDay = startsAtFactory(dayIndex); // convert back to the proper date
141
- const endsAtOnDay = (0, date_fns_1.addMinutes)(startsAtOnDay, duration);
142
- const potentiallyInProgress = !(0, date_fns_1.isAfter)(startsAtOnDay, now); // is potentially in progress if the now is equal-to or after the start time.
143
- const isInProgress = potentiallyInProgress && !(0, date_fns_1.isAfter)(now, endsAtOnDay);
144
- const hasOccuredToday = potentiallyInProgress && !isInProgress;
145
- const currentIndex = isInProgress || hasOccuredToday ? dayIndex : dayIndex - 1; // If not in progress and hasn't occured today, current index is the previous index.
146
- const nextIndex = currentIndex + 1;
147
- const nextIndexInRange = checkIsInRange(nextIndex) ? nextIndex : undefined;
148
- const isComplete = currentIndex >= 0 && !nextIndexInRange && (!isInRange || hasOccuredToday);
149
- return {
150
- now,
151
- date,
152
- dayIndex,
153
- currentIndex,
154
- nextIndex,
155
- hasOccuredToday,
156
- isInProgress,
157
- isInRange,
158
- startsAtOnDay,
159
- endsAtOnDay,
160
- nextIndexInRange,
161
- isComplete
162
- };
163
- };
164
- }
165
- exports.dateCellDayTimingInfoFactory = dateCellDayTimingInfoFactory;
166
- /**
167
- * Returns true if the input is a DateCellTimingRelativeIndexFactory.
168
- *
169
- * @param input
170
- * @returns
171
- */
172
- function isDateCellTimingRelativeIndexFactory(input) {
173
- return typeof input === 'function' && input._timing != null && input._normalInstance != null;
174
- }
175
- exports.isDateCellTimingRelativeIndexFactory = isDateCellTimingRelativeIndexFactory;
176
- /**
177
- * Creates a DateCellTimingRelativeIndexFactory from the input.
178
- *
179
- * @param input
180
- * @returns
181
- */
182
- function dateCellTimingRelativeIndexFactory(input) {
183
- if (isDateCellTimingRelativeIndexFactory(input)) {
184
- return input;
185
- }
186
- else {
187
- const timing = input;
188
- const { start, normalInstance } = (0, date_cell_1.dateCellTimingStartPair)(input);
189
- const startInUtc = normalInstance.baseDateToTargetDate(start); // takes the target date and puts in into UTC normal
190
- const factory = ((input) => {
191
- const inputType = typeof input;
192
- let diff;
193
- if (inputType === 'number') {
194
- return input;
195
- }
196
- else if (inputType === 'string') {
197
- const startOfDayInUtc = (0, date_format_1.parseISO8601DayStringToUTCDate)(input); // parse as UTC
198
- diff = (0, date_fns_1.differenceInHours)(startOfDayInUtc, startInUtc, { roundingMethod: 'floor' }); // compare the UTC times. Round down.
199
- // console.log({ startOfDayInUtc, diff, startInUtc });
200
- }
201
- else {
202
- const dateInUtc = normalInstance.baseDateToTargetDate(input); // convert to UTC normal
203
- diff = (0, date_fns_1.differenceInHours)(dateInUtc, startInUtc, { roundingMethod: 'floor' }); // compare the difference in UTC times. Round down.
204
- // console.log({ input, dateInUtc, diff, startInUtc, tz: normalInstance.configuredTimezoneString, systemTargetOffset: normalInstance.targetDateToSystemDateOffset(input as Date) / MS_IN_HOUR, targetBaseOffset: normalInstance.targetDateToBaseDateOffset(input as Date) / MS_IN_HOUR });
205
- }
206
- const daysOffset = Math.floor(diff / util_1.HOURS_IN_DAY); // total number of hours difference from the original UTC date
207
- return daysOffset ? daysOffset : 0; // do not return -0
208
- });
209
- factory._timing = timing;
210
- factory._normalInstance = normalInstance;
211
- return factory;
212
- }
213
- }
214
- exports.dateCellTimingRelativeIndexFactory = dateCellTimingRelativeIndexFactory;
215
- /**
216
- * Creates a DateCellTimingRelativeIndexArrayFactory from the input DateCellTimingRelativeIndexFactory.
217
- *
218
- * @param indexFactory
219
- */
220
- function dateCellTimingRelativeIndexArrayFactory(indexFactory) {
221
- const factory = ((input) => {
222
- const inputAsArray = (0, util_1.asArray)(input);
223
- const result = [];
224
- inputAsArray.forEach((value) => {
225
- var _a;
226
- let resultIndexes;
227
- if (typeof value === 'object' && !(0, util_1.isDate)(value)) {
228
- if ((0, date_range_1.isDateRange)(value)) {
229
- resultIndexes = (0, util_1.range)(indexFactory(value.start), indexFactory(value.end) + 1);
230
- }
231
- else {
232
- resultIndexes = (0, util_1.range)(value.i, ((_a = value.to) !== null && _a !== void 0 ? _a : value.i) + 1);
233
- }
234
- }
235
- else {
236
- resultIndexes = [indexFactory(value)];
237
- }
238
- (0, util_1.pushArrayItemsIntoArray)(result, resultIndexes);
239
- });
240
- return result;
241
- });
242
- factory._indexFactory = indexFactory;
243
- return factory;
244
- }
245
- exports.dateCellTimingRelativeIndexArrayFactory = dateCellTimingRelativeIndexArrayFactory;
246
- /**
247
- * Gets the relative index of the input date compared to the input timing.
248
- *
249
- * @param timing
250
- * @param date
251
- */
252
- function getRelativeIndexForDateCellTiming(timing, date = new Date()) {
253
- return dateCellTimingRelativeIndexFactory(timing)(date);
254
- }
255
- exports.getRelativeIndexForDateCellTiming = getRelativeIndexForDateCellTiming;
256
- /**
257
- * Creates a DateCellTimingDateFactory.
258
- *
259
- * @param timing
260
- * @returns
261
- */
262
- function dateCellTimingDateFactory(timing) {
263
- const { start, normalInstance } = (0, date_cell_1.dateCellTimingStartPair)(timing);
264
- const utcStartDate = normalInstance.baseDateToTargetDate(start);
265
- const startUtcHours = start.getUTCHours();
266
- const factory = ((input) => {
267
- if ((0, util_1.isDate)(input)) {
268
- return input;
269
- }
270
- else {
271
- const now = new Date();
272
- const nowHours = now.getUTCHours();
273
- const utcStartDateWithNowTime = new Date(Date.UTC(utcStartDate.getUTCFullYear(), utcStartDate.getUTCMonth(), utcStartDate.getUTCDate(), nowHours, now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()));
274
- // if the current hours are less than the UTC offset hours, then bump one extra day forward to be sure we're in the correct day.
275
- if (startUtcHours > nowHours) {
276
- input += 1;
277
- }
278
- const nowWithDateForIndex = (0, date_fns_1.addHours)(utcStartDateWithNowTime, input * util_1.HOURS_IN_DAY); // add days to apply the correct offset to the target index
279
- return nowWithDateForIndex;
280
- }
281
- });
282
- factory._timing = timing;
283
- return factory;
284
- }
285
- exports.dateCellTimingDateFactory = dateCellTimingDateFactory;
286
- /**
287
- * Returns the last index of a DateCellTiming.
288
- *
289
- * @param timing
290
- * @returns
291
- */
292
- function dateCellTimingEndIndex(input) {
293
- const factory = dateCellTimingRelativeIndexFactory(input);
294
- return factory(factory._timing.end);
295
- }
296
- exports.dateCellTimingEndIndex = dateCellTimingEndIndex;
297
- /**
298
- * Creates a DateCellTimingDateFactory.
299
- *
300
- * @param timing
301
- * @returns
302
- */
303
- function dateCellTimingStartDateFactory(input) {
304
- const indexFactory = dateCellTimingRelativeIndexFactory(input);
305
- const { start, normalInstance } = (0, date_cell_1.dateCellTimingStartPair)(indexFactory._timing);
306
- const utcStartDate = normalInstance.baseDateToTargetDate(start);
307
- const factory = ((input) => {
308
- const index = indexFactory(input); // get the index
309
- const startInUtc = (0, date_fns_1.addHours)(utcStartDate, index * util_1.HOURS_IN_DAY);
310
- return normalInstance.targetDateToBaseDate(startInUtc);
311
- });
312
- factory._indexFactory = indexFactory;
313
- return factory;
314
- }
315
- exports.dateCellTimingStartDateFactory = dateCellTimingStartDateFactory;
316
- function dateCellTimingStartsAtDateFactory(input) {
317
- const indexFactory = dateCellTimingRelativeIndexFactory(input);
318
- const normalInstance = indexFactory._normalInstance;
319
- const utcStartsAtDate = normalInstance.baseDateToTargetDate(indexFactory._timing.startsAt);
320
- const factory = ((input) => {
321
- const index = indexFactory(input); // get the index
322
- const startAtInUtc = (0, date_fns_1.addHours)(utcStartsAtDate, index * util_1.HOURS_IN_DAY);
323
- return normalInstance.targetDateToBaseDate(startAtInUtc);
324
- });
325
- factory._indexFactory = indexFactory;
326
- return factory;
327
- }
328
- exports.dateCellTimingStartsAtDateFactory = dateCellTimingStartsAtDateFactory;
329
- function dateCellTimingEndDateFactory(input) {
330
- const startsAtDateFactory = dateCellTimingStartsAtDateFactory(input);
331
- const { duration } = startsAtDateFactory._indexFactory._timing;
332
- const factory = ((input) => {
333
- const startsAt = startsAtDateFactory(input); // get the startsAt for that day
334
- return (0, date_fns_1.addMinutes)(startsAt, duration); // add the duration
335
- });
336
- factory._startsAtDateFactory = startsAtDateFactory;
337
- return factory;
338
- }
339
- exports.dateCellTimingEndDateFactory = dateCellTimingEndDateFactory;
340
- /**
341
- * Returns the date of the input index.
342
- *
343
- * @param timing
344
- * @param date
345
- */
346
- function getRelativeDateForDateCellTiming(timing, input) {
347
- return dateCellTimingDateFactory(timing)(input);
348
- }
349
- exports.getRelativeDateForDateCellTiming = getRelativeDateForDateCellTiming;
350
- /**
351
- * Converts a DateCellTimingStartsAtEndRange to a DateCellTiming by calculating the difference in hours from the last startsAt timing and the end.
352
- *
353
- * @param dateCellTimingStartEndRange
354
- * @param event
355
- * @param timezone
356
- * @returns
357
- */
358
- function dateCellTimingFromDateCellTimingStartsAtEndRange(dateCellTimingStartsAtEndRange) {
359
- const { startsAt, timezone, end } = dateCellTimingStartsAtEndRange;
360
- const duration = (0, date_cell_1.calculateExpectedDateCellTimingDuration)(dateCellTimingStartsAtEndRange);
361
- const timing = {
362
- timezone,
363
- end,
364
- startsAt,
365
- duration
366
- };
367
- return timing;
368
- }
369
- exports.dateCellTimingFromDateCellTimingStartsAtEndRange = dateCellTimingFromDateCellTimingStartsAtEndRange;
370
- /**
371
- * Creates a new DateCellTiming from the input configuration.
372
- *
373
- * @param dateCellTimingStartEndRange
374
- * @param event
375
- * @param timezone
376
- * @returns
377
- */
378
- function updateDateCellTimingWithDateCellTimingEvent(input) {
379
- const { timing, event, replaceStartDay, replaceStartsAt, startDayDate: startDateDay, endOnEvent, replaceDuration } = input;
380
- const { timezone } = timing;
381
- const currentDuration = (0, date_cell_1.calculateExpectedDateCellTimingDuration)(timing);
382
- let startsAt = timing.startsAt;
383
- let end = timing.end;
384
- let duration = currentDuration;
385
- if (replaceStartDay || replaceStartsAt) {
386
- // if replacing both startsAt and start day, then just set the new starts at time
387
- if (replaceStartsAt && replaceStartDay) {
388
- startsAt = event.startsAt; // use the new startsAt as-is
389
- }
390
- else if (replaceStartDay) {
391
- // keep the same time, but use the day
392
- let { start: eventStartDate, normalInstance } = (0, date_cell_1.dateCellTimingStartPair)({ startsAt: event.startsAt, timezone });
393
- if (startDateDay != null) {
394
- const startDateFactory = dateCellTimingStartDateFactory(timing);
395
- eventStartDate = startDateFactory(startDateDay);
396
- }
397
- startsAt = (0, date_timezone_1.copyHoursAndMinutesFromDateWithTimezoneNormal)(eventStartDate, timing.startsAt, normalInstance);
398
- }
399
- else {
400
- // if we're only replacing the startsAt, copy the hours/minutes from the target time
401
- const { start: currentStart, normalInstance } = (0, date_cell_1.dateCellTimingStartPair)(timing);
402
- startsAt = (0, date_timezone_1.copyHoursAndMinutesFromDateWithTimezoneNormal)(currentStart, event.startsAt, normalInstance);
403
- }
404
- }
405
- if (endOnEvent != null || replaceDuration != null) {
406
- const startsAtDateFactory = dateCellTimingStartsAtDateFactory({ startsAt, timezone });
407
- let lastStartsAt;
408
- // the end day should be the date provided by the event's startsAt date.
409
- if (endOnEvent) {
410
- lastStartsAt = startsAtDateFactory(event.startsAt);
411
- }
412
- else {
413
- // get the timing's last start date, and use the new startsAt date factory to calculate the new end date
414
- // this lets us get the proper last startsAt date for the previous last startsAt date
415
- const timingLastStartDate = (0, date_fns_1.addMinutes)(end, -currentDuration);
416
- lastStartsAt = startsAtDateFactory(timingLastStartDate); // recalculate the new startsAt time
417
- }
418
- if (replaceDuration) {
419
- duration = event.duration;
420
- }
421
- end = (0, date_fns_1.addMinutes)(lastStartsAt, duration);
422
- }
423
- return {
424
- timezone,
425
- start: (0, date_cell_1.dateCellTimingStart)({ startsAt, timezone }),
426
- startsAt,
427
- end,
428
- duration
429
- };
430
- }
431
- exports.updateDateCellTimingWithDateCellTimingEvent = updateDateCellTimingWithDateCellTimingEvent;
432
- function isDateWithinDateCellRangeFunction(config) {
433
- const { startsAt: inputStartsAt, range: inputRange } = config;
434
- let startsAt = inputStartsAt;
435
- let dateRange;
436
- let rangeInput;
437
- let isDateInput = false;
438
- if (typeof inputRange === 'number') {
439
- rangeInput = { i: inputRange };
440
- }
441
- else if ((0, util_1.isDate)(inputRange)) {
442
- dateRange = { start: inputRange };
443
- isDateInput = true;
444
- }
445
- else if ((0, date_range_1.isDateRangeStart)(inputRange)) {
446
- dateRange = inputRange;
447
- }
448
- else {
449
- rangeInput = inputRange;
450
- }
451
- if (!inputStartsAt) {
452
- if (dateRange && isDateInput) {
453
- startsAt = { startsAt: inputRange, timezone: (0, date_1.guessCurrentTimezone)() };
454
- }
455
- }
456
- if (!startsAt) {
457
- throw new Error('Invalid isDateWithinDateCellRangeFunction() config. StartsAt date info could not be determined from input.');
458
- }
459
- const indexFactory = dateCellTimingRelativeIndexFactory(startsAt);
460
- function convertDateRangeToIndexRange(range) {
461
- const i = indexFactory(range.start);
462
- const end = range.end;
463
- const to = end != null ? indexFactory(end) : undefined;
464
- return { i, to };
465
- }
466
- if (!rangeInput) {
467
- if (dateRange) {
468
- rangeInput = convertDateRangeToIndexRange(dateRange);
469
- }
470
- else {
471
- throw new Error('Invalid isDateWithinDateCellRangeFunction() config. Range determined from input.'); // shouldn't occur
472
- }
473
- }
474
- const isDateCellWithinDateCellRange = (0, date_cell_index_1.isDateCellWithinDateCellRangeFunction)(rangeInput);
475
- return (input) => {
476
- let range;
477
- if ((0, util_1.isDate)(input)) {
478
- range = indexFactory(input);
479
- }
480
- else if ((0, date_range_1.isDateRangeStart)(input)) {
481
- range = convertDateRangeToIndexRange(input);
482
- }
483
- else {
484
- range = input;
485
- }
486
- if (typeof input === 'number') {
487
- range = { i: input };
488
- }
489
- return isDateCellWithinDateCellRange(range);
490
- };
491
- }
492
- exports.isDateWithinDateCellRangeFunction = isDateWithinDateCellRangeFunction;
493
- //# sourceMappingURL=date.cell.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date.cell.factory.js","sourceRoot":"","sources":["../../../../../../packages/date/src/lib/date/date.cell.factory.ts"],"names":[],"mappings":";;;AAAA,wCAAoP;AACpP,uCAA4E;AAC5E,iCAA8C;AAC9C,2CAA0a;AAC1a,uDAA+N;AAC/N,+CAA+D;AAC/D,6CAAwF;AACxF,mDAA8J;AAS9J,SAAgB,iCAAiC,CAAC,KAAoB;;IACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,MAAA,KAAK,CAAC,EAAE,mCAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AACpE,CAAC;AAFD,8EAEC;AAED,SAAgB,iCAAiC,CAAC,KAAyB;IACzE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;AACvD,CAAC;AAFD,8EAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,MAAsB,EAAE,KAAgC,EAAE,gBAAgB,GAAG,IAAI;IAClH,MAAM,YAAY,GAAG,kCAAkC,CAAC,MAAM,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
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modifyDateCellToFitRange = exports.modifyDateCellsToFitRange = exports.modifyDateCellsToFitRangeFunction = exports.dateCellDurationSpanHasNotEndedFilterFunction = exports.dateCellDurationSpanHasEndedFilterFunction = exports.dateCellDurationSpanHasNotStartedFilterFunction = exports.dateCellDurationSpanHasStartedFilterFunction = void 0;
4
- const util_1 = require("@dereekb/util");
5
- const date_fns_1 = require("date-fns");
6
- const date_cell_index_1 = require("./date.cell.index");
7
- const date_duration_1 = require("./date.duration");
8
- function dateCellDurationSpanHasStartedFilterFunction(now = new Date()) {
9
- return (x) => !(0, date_fns_1.isAfter)(x.startsAt, now); // startsAt <= now
10
- }
11
- exports.dateCellDurationSpanHasStartedFilterFunction = dateCellDurationSpanHasStartedFilterFunction;
12
- function dateCellDurationSpanHasNotStartedFilterFunction(now = new Date()) {
13
- return (x) => (0, date_fns_1.isAfter)(x.startsAt, now); // startsAt > now
14
- }
15
- exports.dateCellDurationSpanHasNotStartedFilterFunction = dateCellDurationSpanHasNotStartedFilterFunction;
16
- function dateCellDurationSpanHasEndedFilterFunction(now = new Date()) {
17
- return (x) => {
18
- const endsAt = (0, date_duration_1.dateDurationSpanEndDate)(x);
19
- return !(0, date_fns_1.isAfter)(endsAt, now); // endsAt <= now
20
- };
21
- }
22
- exports.dateCellDurationSpanHasEndedFilterFunction = dateCellDurationSpanHasEndedFilterFunction;
23
- function dateCellDurationSpanHasNotEndedFilterFunction(now = new Date()) {
24
- return (x) => {
25
- const endsAt = (0, date_duration_1.dateDurationSpanEndDate)(x);
26
- return (0, date_fns_1.isAfter)(endsAt, now); // endsAt > now
27
- };
28
- }
29
- exports.dateCellDurationSpanHasNotEndedFilterFunction = dateCellDurationSpanHasNotEndedFilterFunction;
30
- /**
31
- * Creatse a ModifyDateCellsToFitRangeFunction
32
- */
33
- function modifyDateCellsToFitRangeFunction(range) {
34
- const { i, to } = (0, date_cell_index_1.dateCellRangeWithRange)(range);
35
- const dateCellIsWithinDateCellRange = (0, date_cell_index_1.isDateCellWithinDateCellRangeFunction)(range);
36
- const overlapsRange = (0, date_cell_index_1.dateCellRangeOverlapsRangeFunction)(range);
37
- return (input) => (0, util_1.filterMaybeValues)(input.map((x) => {
38
- let result;
39
- const inRange = dateCellIsWithinDateCellRange(x);
40
- if (inRange) {
41
- // if contained within the range then return as-is
42
- result = x;
43
- }
44
- else {
45
- // fit to the range otherwise
46
- const asRange = (0, date_cell_index_1.dateCellRangeWithRange)(x);
47
- const rangesOverlap = overlapsRange(asRange);
48
- if (rangesOverlap) {
49
- result = Object.assign(Object.assign({}, x), { i: Math.max(i, asRange.i), to: Math.min(to, asRange.to) // should be no larger than to
50
- });
51
- }
52
- }
53
- return result;
54
- }));
55
- }
56
- exports.modifyDateCellsToFitRangeFunction = modifyDateCellsToFitRangeFunction;
57
- function modifyDateCellsToFitRange(range, input) {
58
- return modifyDateCellsToFitRangeFunction(range)(input);
59
- }
60
- exports.modifyDateCellsToFitRange = modifyDateCellsToFitRange;
61
- function modifyDateCellToFitRange(range, input) {
62
- return modifyDateCellsToFitRange(range, [input])[0];
63
- }
64
- exports.modifyDateCellToFitRange = modifyDateCellToFitRange;
65
- //# sourceMappingURL=date.cell.filter.js.map