@dereekb/date 10.1.3 → 10.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -5934,11 +5934,11 @@ function dateCellTimingDateFactory(timing) {
5934
5934
  } = dateCellTimingStartPair(timing);
5935
5935
  const utcStartDate = normalInstance.baseDateToTargetDate(start);
5936
5936
  const startUtcHours = start.getUTCHours();
5937
- const factory = input => {
5937
+ const factory = (input, inputNow) => {
5938
5938
  if (util.isDate(input)) {
5939
5939
  return input;
5940
5940
  } else {
5941
- const now = new Date();
5941
+ const now = inputNow !== null && inputNow !== void 0 ? inputNow : new Date();
5942
5942
  const nowHours = now.getUTCHours();
5943
5943
  const utcStartDateWithNowTime = new Date(Date.UTC(utcStartDate.getUTCFullYear(), utcStartDate.getUTCMonth(), utcStartDate.getUTCDate(), nowHours, now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()));
5944
5944
  // 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.
@@ -7089,7 +7089,7 @@ function dateCellScheduleDateFilter(config) {
7089
7089
  const startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
7090
7090
  const firstDateDay = dateFns.getDay(startsAtInSystem);
7091
7091
  const dayForIndex = dateCellDayOfWeekFactory(firstDateDay);
7092
- const dateIndexForDate = dateCellTimingRelativeIndexFactory({
7092
+ const _dateCellTimingRelativeIndexFactory = dateCellTimingRelativeIndexFactory({
7093
7093
  startsAt,
7094
7094
  timezone
7095
7095
  });
@@ -7106,22 +7106,59 @@ function dateCellScheduleDateFilter(config) {
7106
7106
  end = expectedFinalStartsAt;
7107
7107
  }
7108
7108
  const indexFloor = setStartAsMinDate ? 0 : Number.MIN_SAFE_INTEGER;
7109
- const minAllowedIndex = (minMaxDateRange === null || minMaxDateRange === void 0 ? void 0 : minMaxDateRange.start) != null ? Math.max(indexFloor, dateIndexForDate(minMaxDateRange.start)) : indexFloor; // start date should be the min inde
7110
- const maxAllowedIndex = end != null ? dateIndexForDate(end) : (minMaxDateRange === null || minMaxDateRange === void 0 ? void 0 : minMaxDateRange.end) != null ? dateIndexForDate(minMaxDateRange.end) : Number.MAX_SAFE_INTEGER; // max "to" value
7109
+ const minAllowedIndex = (minMaxDateRange === null || minMaxDateRange === void 0 ? void 0 : minMaxDateRange.start) != null ? Math.max(indexFloor, _dateCellTimingRelativeIndexFactory(minMaxDateRange.start)) : indexFloor; // start date should be the min inde
7110
+ const maxAllowedIndex = end != null ? _dateCellTimingRelativeIndexFactory(end) : (minMaxDateRange === null || minMaxDateRange === void 0 ? void 0 : minMaxDateRange.end) != null ? _dateCellTimingRelativeIndexFactory(minMaxDateRange.end) : Number.MAX_SAFE_INTEGER; // max "to" value
7111
7111
  const includedIndexes = new Set(config.d);
7112
7112
  const excludedIndexes = new Set(config.ex);
7113
- return input => {
7113
+ const fn = input => {
7114
7114
  let i;
7115
7115
  let day;
7116
7116
  if (typeof input === 'number') {
7117
7117
  i = input;
7118
7118
  } else {
7119
- i = dateIndexForDate(input);
7119
+ i = _dateCellTimingRelativeIndexFactory(input);
7120
7120
  }
7121
7121
  day = dayForIndex(i);
7122
7122
  const result = i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
7123
7123
  return result;
7124
7124
  };
7125
+ fn._dateCellTimingRelativeIndexFactory = _dateCellTimingRelativeIndexFactory;
7126
+ return fn;
7127
+ }
7128
+ /**
7129
+ * Passes a number of day values until it reaches an open day on a schedule. There's a maximum distance it searches in a direction before returning null.
7130
+ *
7131
+ * @param date
7132
+ * @param filter
7133
+ * @param maxDistance
7134
+ */
7135
+ function findNextDateInDateCellScheduleFilter(config) {
7136
+ const {
7137
+ date,
7138
+ filter,
7139
+ direction,
7140
+ maxDistance,
7141
+ excludeInputDate
7142
+ } = config;
7143
+ const {
7144
+ _dateCellTimingRelativeIndexFactory
7145
+ } = filter;
7146
+ const firstDateIndex = _dateCellTimingRelativeIndexFactory(date);
7147
+ const offsetDelta = direction === 'past' ? -1 : 1;
7148
+ let nextDatePair;
7149
+ for (let offset = excludeInputDate ? 1 : 0; offset < maxDistance; offset += 1) {
7150
+ const i = firstDateIndex + offset * offsetDelta;
7151
+ if (filter(i)) {
7152
+ const dateFactory = dateCellTimingDateFactory(_dateCellTimingRelativeIndexFactory._timing);
7153
+ nextDatePair = {
7154
+ i,
7155
+ date: dateFactory(i, isDate(date) ? date : undefined) // pass back the "now" time
7156
+ };
7157
+
7158
+ break;
7159
+ }
7160
+ }
7161
+ return nextDatePair;
7125
7162
  }
7126
7163
  /**
7127
7164
  * Creates a DateCellScheduleDateCellTimingFilter.
@@ -7653,7 +7690,7 @@ class DateTimeMinuteInstance {
7653
7690
  this._date = (dateOverride == undefined ? config.date : dateOverride) || new Date();
7654
7691
  this._step = (_a = config.step) !== null && _a !== void 0 ? _a : 1;
7655
7692
  this._limit = new LimitDateTimeInstance(config);
7656
- this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : () => true;
7693
+ this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
7657
7694
  }
7658
7695
  get date() {
7659
7696
  return this._date;
@@ -7721,7 +7758,7 @@ class DateTimeMinuteInstance {
7721
7758
  inPast = dateFns.isBefore(date, now);
7722
7759
  }
7723
7760
  // Schedule
7724
- isInSchedule = this._dateFilter(date);
7761
+ isInSchedule = this._dateFilter ? this._dateFilter(date) : true; // default
7725
7762
  return {
7726
7763
  isBeforeMaximum,
7727
7764
  isAfterMinimum,
@@ -7741,9 +7778,70 @@ class DateTimeMinuteInstance {
7741
7778
  }
7742
7779
  return date;
7743
7780
  }
7744
- clamp(date = this.date) {
7781
+ clamp(date = this.date, maxClampDistance) {
7782
+ return this.clampToSchedule(this.clampToLimit(date), maxClampDistance);
7783
+ }
7784
+ clampToLimit(date = this.date) {
7745
7785
  return this._limit.clamp(date);
7746
7786
  }
7787
+ clampToSchedule(date = this.date, maxClampDistance = 370) {
7788
+ let nextAvailableDate;
7789
+ if (this._dateFilter != null) {
7790
+ const maxLimitedDateRange = this._limit.dateRange();
7791
+ if (this._dateFilter(date)) {
7792
+ nextAvailableDate = date;
7793
+ } else {
7794
+ const maxPastDistance = Math.min(maxClampDistance, maxLimitedDateRange.start ? Math.abs(dateFns.differenceInDays(date, maxLimitedDateRange.start)) : maxClampDistance); // max future
7795
+ const maxFutureDistance = Math.min(maxClampDistance, maxLimitedDateRange.end ? Math.abs(dateFns.differenceInDays(date, maxLimitedDateRange.end)) : maxClampDistance); // max future
7796
+ const nextFutureDate = findNextDateInDateCellScheduleFilter({
7797
+ date,
7798
+ filter: this._dateFilter,
7799
+ direction: 'future',
7800
+ maxDistance: maxFutureDistance,
7801
+ excludeInputDate: true
7802
+ });
7803
+ if (nextFutureDate != null) {
7804
+ nextAvailableDate = nextFutureDate.date;
7805
+ } else {
7806
+ // check the past date clamp
7807
+ const previousPastDate = findNextDateInDateCellScheduleFilter({
7808
+ date,
7809
+ filter: this._dateFilter,
7810
+ direction: 'past',
7811
+ maxDistance: maxPastDistance,
7812
+ excludeInputDate: true
7813
+ });
7814
+ if (previousPastDate != null) {
7815
+ nextAvailableDate = previousPastDate.date;
7816
+ }
7817
+ }
7818
+ // set a default from the given input if applicable
7819
+ if (nextAvailableDate == null) {
7820
+ nextAvailableDate = this.clampToLimit(date);
7821
+ }
7822
+ }
7823
+ }
7824
+ return nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : date;
7825
+ }
7826
+ findNextAvailableDayInSchedule(date, direction, maxDistance = 370) {
7827
+ let nextAvailableDate;
7828
+ if (this._dateFilter) {
7829
+ const result = findNextDateInDateCellScheduleFilter({
7830
+ date,
7831
+ filter: this._dateFilter,
7832
+ direction,
7833
+ maxDistance: maxDistance,
7834
+ excludeInputDate: true
7835
+ });
7836
+ if (result != null) {
7837
+ nextAvailableDate = result.date;
7838
+ }
7839
+ }
7840
+ return nextAvailableDate;
7841
+ }
7842
+ isInSchedule(date) {
7843
+ return this._dateFilter ? this._dateFilter(date) : true;
7844
+ }
7747
7845
  _takeBoundedDate(date = this.date) {
7748
7846
  return this._takeMaximumBoundedDate(this._takeMinimumBoundedDate(date));
7749
7847
  }
@@ -9373,6 +9471,7 @@ exports.expandUniqueDateCellsFunction = expandUniqueDateCellsFunction;
9373
9471
  exports.filterDateCellsInDateCellRange = filterDateCellsInDateCellRange;
9374
9472
  exports.findMaxDate = findMaxDate;
9375
9473
  exports.findMinDate = findMinDate;
9474
+ exports.findNextDateInDateCellScheduleFilter = findNextDateInDateCellScheduleFilter;
9376
9475
  exports.fitDateRangeToDayPeriod = fitDateRangeToDayPeriod;
9377
9476
  exports.fitDateRangeToDayPeriodFunction = fitDateRangeToDayPeriodFunction;
9378
9477
  exports.fitUTCDateRangeToDayPeriod = fitUTCDateRangeToDayPeriod;
package/index.esm.js CHANGED
@@ -4533,6 +4533,10 @@ function isValidDateCellIndex(input) {
4533
4533
  * Input type that is either a Date or a DateCellIndex.
4534
4534
  */
4535
4535
 
4536
+ /**
4537
+ * A date and the relative date index.
4538
+ */
4539
+
4536
4540
  /**
4537
4541
  * A duration-span block.
4538
4542
  */
@@ -6561,11 +6565,11 @@ function dateCellTimingDateFactory(timing) {
6561
6565
  } = dateCellTimingStartPair(timing);
6562
6566
  const utcStartDate = normalInstance.baseDateToTargetDate(start);
6563
6567
  const startUtcHours = start.getUTCHours();
6564
- const factory = input => {
6568
+ const factory = (input, inputNow) => {
6565
6569
  if (isDate$2(input)) {
6566
6570
  return input;
6567
6571
  } else {
6568
- const now = new Date();
6572
+ const now = inputNow != null ? inputNow : new Date();
6569
6573
  const nowHours = now.getUTCHours();
6570
6574
  const utcStartDateWithNowTime = new Date(Date.UTC(utcStartDate.getUTCFullYear(), utcStartDate.getUTCMonth(), utcStartDate.getUTCDate(), nowHours, now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()));
6571
6575
 
@@ -7947,7 +7951,7 @@ function dateCellScheduleDateFilter(config) {
7947
7951
  const startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
7948
7952
  const firstDateDay = getDay(startsAtInSystem);
7949
7953
  const dayForIndex = dateCellDayOfWeekFactory(firstDateDay);
7950
- const dateIndexForDate = dateCellTimingRelativeIndexFactory({
7954
+ const _dateCellTimingRelativeIndexFactory = dateCellTimingRelativeIndexFactory({
7951
7955
  startsAt,
7952
7956
  timezone
7953
7957
  });
@@ -7964,23 +7968,60 @@ function dateCellScheduleDateFilter(config) {
7964
7968
  end = expectedFinalStartsAt;
7965
7969
  }
7966
7970
  const indexFloor = setStartAsMinDate ? 0 : Number.MIN_SAFE_INTEGER;
7967
- const minAllowedIndex = (minMaxDateRange == null ? void 0 : minMaxDateRange.start) != null ? Math.max(indexFloor, dateIndexForDate(minMaxDateRange.start)) : indexFloor; // start date should be the min inde
7968
- const maxAllowedIndex = end != null ? dateIndexForDate(end) : (minMaxDateRange == null ? void 0 : minMaxDateRange.end) != null ? dateIndexForDate(minMaxDateRange.end) : Number.MAX_SAFE_INTEGER; // max "to" value
7971
+ const minAllowedIndex = (minMaxDateRange == null ? void 0 : minMaxDateRange.start) != null ? Math.max(indexFloor, _dateCellTimingRelativeIndexFactory(minMaxDateRange.start)) : indexFloor; // start date should be the min inde
7972
+ const maxAllowedIndex = end != null ? _dateCellTimingRelativeIndexFactory(end) : (minMaxDateRange == null ? void 0 : minMaxDateRange.end) != null ? _dateCellTimingRelativeIndexFactory(minMaxDateRange.end) : Number.MAX_SAFE_INTEGER; // max "to" value
7969
7973
 
7970
7974
  const includedIndexes = new Set(config.d);
7971
7975
  const excludedIndexes = new Set(config.ex);
7972
- return input => {
7976
+ const fn = input => {
7973
7977
  let i;
7974
7978
  let day;
7975
7979
  if (typeof input === 'number') {
7976
7980
  i = input;
7977
7981
  } else {
7978
- i = dateIndexForDate(input);
7982
+ i = _dateCellTimingRelativeIndexFactory(input);
7979
7983
  }
7980
7984
  day = dayForIndex(i);
7981
7985
  const result = i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
7982
7986
  return result;
7983
7987
  };
7988
+ fn._dateCellTimingRelativeIndexFactory = _dateCellTimingRelativeIndexFactory;
7989
+ return fn;
7990
+ }
7991
+ /**
7992
+ * Passes a number of day values until it reaches an open day on a schedule. There's a maximum distance it searches in a direction before returning null.
7993
+ *
7994
+ * @param date
7995
+ * @param filter
7996
+ * @param maxDistance
7997
+ */
7998
+ function findNextDateInDateCellScheduleFilter(config) {
7999
+ const {
8000
+ date,
8001
+ filter,
8002
+ direction,
8003
+ maxDistance,
8004
+ excludeInputDate
8005
+ } = config;
8006
+ const {
8007
+ _dateCellTimingRelativeIndexFactory
8008
+ } = filter;
8009
+ const firstDateIndex = _dateCellTimingRelativeIndexFactory(date);
8010
+ const offsetDelta = direction === 'past' ? -1 : 1;
8011
+ let nextDatePair;
8012
+ for (let offset = excludeInputDate ? 1 : 0; offset < maxDistance; offset += 1) {
8013
+ const i = firstDateIndex + offset * offsetDelta;
8014
+ if (filter(i)) {
8015
+ const dateFactory = dateCellTimingDateFactory(_dateCellTimingRelativeIndexFactory._timing);
8016
+ nextDatePair = {
8017
+ i,
8018
+ date: dateFactory(i, isDate(date) ? date : undefined) // pass back the "now" time
8019
+ };
8020
+
8021
+ break;
8022
+ }
8023
+ }
8024
+ return nextDatePair;
7984
8025
  }
7985
8026
 
7986
8027
  // MARK: DateCellScheduleDateCellTimingFilter
@@ -8567,7 +8608,7 @@ class DateTimeMinuteInstance {
8567
8608
  this._date = (dateOverride == undefined ? config.date : dateOverride) || new Date();
8568
8609
  this._step = (_config$step = config.step) != null ? _config$step : 1;
8569
8610
  this._limit = new LimitDateTimeInstance(config);
8570
- this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : () => true;
8611
+ this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
8571
8612
  }
8572
8613
  get date() {
8573
8614
  return this._date;
@@ -8640,7 +8681,8 @@ class DateTimeMinuteInstance {
8640
8681
  }
8641
8682
 
8642
8683
  // Schedule
8643
- isInSchedule = this._dateFilter(date);
8684
+ isInSchedule = this._dateFilter ? this._dateFilter(date) : true; // default
8685
+
8644
8686
  return {
8645
8687
  isBeforeMaximum,
8646
8688
  isAfterMinimum,
@@ -8660,9 +8702,73 @@ class DateTimeMinuteInstance {
8660
8702
  }
8661
8703
  return date;
8662
8704
  }
8663
- clamp(date = this.date) {
8705
+ clamp(date = this.date, maxClampDistance) {
8706
+ return this.clampToSchedule(this.clampToLimit(date), maxClampDistance);
8707
+ }
8708
+ clampToLimit(date = this.date) {
8664
8709
  return this._limit.clamp(date);
8665
8710
  }
8711
+ clampToSchedule(date = this.date, maxClampDistance = 370) {
8712
+ var _nextAvailableDate;
8713
+ let nextAvailableDate;
8714
+ if (this._dateFilter != null) {
8715
+ const maxLimitedDateRange = this._limit.dateRange();
8716
+ if (this._dateFilter(date)) {
8717
+ nextAvailableDate = date;
8718
+ } else {
8719
+ const maxPastDistance = Math.min(maxClampDistance, maxLimitedDateRange.start ? Math.abs(differenceInDays(date, maxLimitedDateRange.start)) : maxClampDistance); // max future
8720
+ const maxFutureDistance = Math.min(maxClampDistance, maxLimitedDateRange.end ? Math.abs(differenceInDays(date, maxLimitedDateRange.end)) : maxClampDistance); // max future
8721
+
8722
+ const nextFutureDate = findNextDateInDateCellScheduleFilter({
8723
+ date,
8724
+ filter: this._dateFilter,
8725
+ direction: 'future',
8726
+ maxDistance: maxFutureDistance,
8727
+ excludeInputDate: true
8728
+ });
8729
+ if (nextFutureDate != null) {
8730
+ nextAvailableDate = nextFutureDate.date;
8731
+ } else {
8732
+ // check the past date clamp
8733
+ const previousPastDate = findNextDateInDateCellScheduleFilter({
8734
+ date,
8735
+ filter: this._dateFilter,
8736
+ direction: 'past',
8737
+ maxDistance: maxPastDistance,
8738
+ excludeInputDate: true
8739
+ });
8740
+ if (previousPastDate != null) {
8741
+ nextAvailableDate = previousPastDate.date;
8742
+ }
8743
+ }
8744
+
8745
+ // set a default from the given input if applicable
8746
+ if (nextAvailableDate == null) {
8747
+ nextAvailableDate = this.clampToLimit(date);
8748
+ }
8749
+ }
8750
+ }
8751
+ return (_nextAvailableDate = nextAvailableDate) != null ? _nextAvailableDate : date;
8752
+ }
8753
+ findNextAvailableDayInSchedule(date, direction, maxDistance = 370) {
8754
+ let nextAvailableDate;
8755
+ if (this._dateFilter) {
8756
+ const result = findNextDateInDateCellScheduleFilter({
8757
+ date,
8758
+ filter: this._dateFilter,
8759
+ direction,
8760
+ maxDistance: maxDistance,
8761
+ excludeInputDate: true
8762
+ });
8763
+ if (result != null) {
8764
+ nextAvailableDate = result.date;
8765
+ }
8766
+ }
8767
+ return nextAvailableDate;
8768
+ }
8769
+ isInSchedule(date) {
8770
+ return this._dateFilter ? this._dateFilter(date) : true;
8771
+ }
8666
8772
  _takeBoundedDate(date = this.date) {
8667
8773
  return this._takeMaximumBoundedDate(this._takeMinimumBoundedDate(date));
8668
8774
  }
@@ -10308,4 +10414,4 @@ class ModelRecurrenceInfoUtility {
10308
10414
  }
10309
10415
  }
10310
10416
 
10311
- export { AnyIterResult, CalendarDate, CalendarDateType, DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX, DATE_TODAY_END_VALUE, DATE_TODAY_START_VALUE, DATE_WEEK_END_VALUE, DATE_WEEK_START_VALUE, DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE, DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION, DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS, DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED, DateCell, DateCellRange, DateCellSchedule, DateCellScheduleDayCode, DateCellTiming, DateDurationSpan, DateRRule, DateRRuleInstance, DateRRuleParseUtility, DateRRuleUtility, DateRange, DateRangeParams, DateRangeType, DateSet, DateTimeMinuteInstance, DateTimeUtilityInstance, DateTimezoneUtcNormalInstance, IsKnownTimezone, IsValidDateCellRange, IsValidDateCellRangeSeries, IsValidDateCellTiming, IterateDaysInDateRangeFunctionBailError, LastIterResult, LimitDateTimeInstance, MAX_FUTURE_DATE, ModelRecurrenceInfo, ModelRecurrenceInfoUtility, NextIterResult, RRuleStringSplitter, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, UNKNOWN_YEAR_WEEK_CODE, UTC_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, allIndexesInDateCellRange, allIndexesInDateCellRanges, allKnownTimezoneStrings, allTimezoneInfos, allTimezoneStrings, anyHaveExpired, atleastOneNotExpired, baseDateToTargetDate, calculateAllConversions, calculateExpectedDateCellTimingDuration, calculateExpectedDateCellTimingDurationPair, calculateTimezoneOffset, calendarDate, calendarDateFactory, calendarDateForDateDurationSpan, changeDateCellScheduleDateRangeToTimezone, changeDateCellScheduleDateRangeToTimezoneFunction, clampDateFunction, clampDateRangeFunction, clampDateRangeToDateRange, clampDateToDateRange, copyDateCellScheduleDateFilterConfig, copyHoursAndMinutesFromDate, copyHoursAndMinutesFromDateToToday, copyHoursAndMinutesFromDateWithTimezoneNormal, copyHoursAndMinutesFromNow, copyHoursAndMinutesFromNowWithTimezoneNormal, copyHoursAndMinutesFromUTCDate, copyHoursAndMinutesToDate, copyHoursAndMinutesToToday, dateCell, dateCellDayOfWeekFactory, dateCellDayTimingInfoFactory, dateCellDurationSpanHasEndedFilterFunction, dateCellDurationSpanHasNotEndedFilterFunction, dateCellDurationSpanHasNotStartedFilterFunction, dateCellDurationSpanHasStartedFilterFunction, dateCellEndIndex, dateCellIndexRange, dateCellIndexRangeToDateCellRange, dateCellIndexYearWeekCodeFactory, dateCellIndexYearWeekCodeGroupFactory, dateCellIndexsForDateCellScheduleDayCodes, dateCellRange, dateCellRangeBlocksCount, dateCellRangeBlocksCountInfo, dateCellRangeHasRange, dateCellRangeIncludedByRangeFunction, dateCellRangeOfTiming, dateCellRangeOfTimingFactory, dateCellRangeOverlapsRange, dateCellRangeOverlapsRangeFunction, dateCellRangeToDateCellIndexRange, dateCellRangeWithRange, dateCellRangeWithRangeFromIndex, dateCellRangesFullyCoverDateCellRangeFunction, dateCellScheduleDateCellTimingFilter, dateCellScheduleDateFilter, dateCellScheduleDateRange, dateCellScheduleDayCodeFactory, dateCellScheduleDayCodesAreSetsEquivalent, dateCellScheduleDayCodesFromEnabledDays, dateCellScheduleDayCodesSetFromDaysOfWeek, dateCellScheduleEncodedWeek, dateCellTiming, dateCellTimingCompletedTimeRange, dateCellTimingDateFactory, dateCellTimingDateRange, dateCellTimingEndDateFactory, dateCellTimingEndIndex, dateCellTimingEventRange, dateCellTimingExpansionFactory, dateCellTimingFinalStartsAtEvent, dateCellTimingFromDateCellTimingStartsAtEndRange, dateCellTimingLatestCompletedIndex, dateCellTimingRelativeIndexArrayFactory, dateCellTimingRelativeIndexFactory, dateCellTimingStart, dateCellTimingStartDateFactory, dateCellTimingStartPair, dateCellTimingStartsAtDateFactory, dateCellTimingStartsAtForStartOfDay, dateCellTimingTimezoneNormalInstance, dateDurationSpanEndDate, dateFromDateOrTimeNumber, dateFromLogicalDate, dateInterval, dateMonthDayStringFormat, dateOrDateRangeToDateRange, dateOrDayStringRangeToDateRange, dateOrDayStringRangeToISO8601DayStringRange, dateRange, dateRangeDaysCount, dateRangeOverlapsDateRange, dateRangeOverlapsDateRangeFunction, dateRangeRelativeState, dateRelativeStateForDateCellRangeComparedToIndex, dateShortDateAndTimeStringFormat, dateShortDateStringFormat, dateTimeInstance, dateTimeInstanceUtc, dateTimeMinuteDecisionFunction, dateTimeMinuteWholeDayDecisionFunction, dateTimeStringFormat, dateTimezoneUtcNormal, daysToMinutes, durationSpanDateRelativeState, durationSpanToDateRange, earliestDate, enabledDaysFromDateCellScheduleDayCodes, endItreateDaysInDateRangeEarly, expandDateCellCollection, expandDateCellRange, expandDateCellSchedule, expandDateCellScheduleDayCodes, expandDateCellScheduleDayCodesToDayCodesSet, expandDateCellScheduleDayCodesToDayOfWeekSet, expandDateCellScheduleFactory, expandDateCellScheduleRange, expandDateCellScheduleRangeToDateCellRanges, expandDateCellTiming, expandDaysForDateRange, expandDaysForDateRangeFunction, expandUniqueDateCellsFunction, filterDateCellsInDateCellRange, findMaxDate, findMinDate, fitDateRangeToDayPeriod, fitDateRangeToDayPeriodFunction, fitUTCDateRangeToDayPeriod, forEachDayInDateRange, formatDateDistance, formatDateRange, formatDateRangeDistance, formatDateRangeDistanceFunction, formatDateRangeFunction, formatStartedEndedDistanceString, formatToDateString, formatToDayRangeString, formatToDayTimeRangeString, formatToISO8601DateString, formatToISO8601DayString, formatToISO8601DayStringForSystem, formatToISO8601DayStringForUTC, formatToMonthDayString, formatToShortDateAndTimeString, formatToShortDateString, formatToTimeAndDurationString, formatToTimeRangeString, formatToTimeString, fractionalHoursInDurationSpan, fullDateCellScheduleRange, fullDateCellTiming, fullDateCellTimingTimezonePair, fullWeekDateCellScheduleDayCodes, getCurrentSystemOffsetInHours, getCurrentSystemOffsetInMinutes, getCurrentSystemOffsetInMs, getDateCellTimingFirstEventDateRange, getDateCellTimingHoursInEvent, getDaysOfWeekInDateRange, getExpiration, getGreatestDateCellIndexInDateCellRanges, getLeastAndGreatestDateCellIndexInDateCellRanges, getLeastDateCellIndexInDateCellRanges, getNextDateCellTimingIndex, getRelativeDateForDateCellTiming, getRelativeIndexForDateCellTiming, getTimeAM, getTimezoneAbbreviation, getTimezoneLongName, groupDateRangesByDateRelativeState, groupToDateCellRanges, groupUniqueDateCells, guessCurrentTimezone, hasExpired, hoursToMs, inverseDateTimezoneUtcNormalInstanceTransformType, isAfter, isDate, isDateCellRange, isDateCellSchedule, isDateCellScheduleDateRange, isDateCellScheduleEncodedWeek, isDateCellScheduleStartOfDayDateRange, isDateCellTiming, isDateCellTimingRelativeIndexFactory, isDateCellWithinDateCellRange, isDateCellWithinDateCellRangeFunction, isDateInDateRange, isDateInDateRangeFunction, isDateRange, isDateRangeInDateRange, isDateRangeInDateRangeFunction, isDateRangeStart, isDateWithinDateCellRangeFunction, isEmptyDateCellScheduleEncodedWeek, isFullDateCellScheduleDateRange, isFullDateCellTiming, isFullDateRange, isInfiniteDateRange, isKnownTimezone, isLogicalDateStringCode, isMaxFutureDate, isPartialDateRange, isSameDate, isSameDateCellSchedule, isSameDateCellScheduleDateRange, isSameDateCellScheduleEventRange, isSameDateCellTiming, isSameDateCellTimingEventStartsAtEndRange, isSameDateDay, isSameDateDayRange, isSameDateHoursAndMinutes, isSameDateRange, isSameDateTimezoneConversionConfig, isSameDurationSpan, isSameFullDateCellScheduleDateRange, isSameFullDateCellTiming, isStartOfDayForSystem, isStartOfDayInUTC, isValidDateCellIndex, isValidDateCellRange, isValidDateCellRangeSeries, isValidDateCellTiming, isValidDateCellTimingInfo, isValidDateCellTimingStartDate, isValidDateFromTimestringResult, isValidDateTimezoneConversionConfig, isValidFullDateCellTiming, isValidFullDateCellTimingInfo, iterateDaysInDateRange, iterateDaysInDateRangeFunction, latestDate, latestMinute, limitDateTime, limitDateTimeInstance, logicalDateStringCodeDateFactory, makeDateQueryForDateItemRangeFilter, makeDateQueryForDateStartsEndsFilter, makeDateQueryForOccuringFilter, makeDaysAndTimeFiltersFunction, makeMongoDBLikeDateQueryBuilder, maxFutureDate, mergeMongoDBLikeRangeFilters, minutesToMs, modifyDateCellToFitRange, modifyDateCellsToFitRange, modifyDateCellsToFitRangeFunction, msToMinutes, msToSeconds, nowInterval, parseISO8601DayStringToDate, parseJsDateString, parseReadableTimeString, rawDateCellScheduleDayCodes, readDaysOfWeek, readDaysOfWeekNames, readableTimeStringToDate, reduceDatesFunction, requireCurrentTimezone, roundDateTimeDown, roundDateTimeDownToSteps, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, shiftDateCellTimingToSystemTimezone, shiftDateCellTimingToTimezone, shiftDateCellTimingToTimezoneFunction, shiftDateCellTimingToUTCTimezone, simplifyDateCellScheduleDayCodes, skipAfterExpiration, skipExpired, skipUntilExpiration, skipUntilTimeElapsedAfterLastEmission, sortByDateFunction, sortByISO8601DateStringFunction, sortByISO8601DateStrings, sortDateCellRangeAndSizeFunction, sortDateCellRanges, sortDateRangeStartAscendingCompareFunction, startOfDayInTimezoneDayStringFactory, startOfDayInTimezoneFromISO8601DayString, startOfWeekForYearWeekCode, systemBaseDateToNormalDate, systemBaseDateToNormalDateOffset, systemDateTimezoneUtcNormal, systemExperiencesDaylightSavings, systemNormalDateToBaseDate, systemNormalDateToBaseDateOffset, takeAfterTimeElapsedSinceLastEmission, takeNextUpcomingTime, targetDateToBaseDate, timeHasExpired, timezoneInfoForSystem, timezoneStringToSearchableString, timezoneStringToTimezoneInfo, toExpiration, toExpires, toISO8601DayString, toISO8601DayStringForSystem, toISO8601DayStringForUTC, toISODateString, toJsDate, toJsDayDate, toLocalReadableTimeString, toReadableTimeString, transformDateInTimezoneNormalFunction, transformDateRangeDatesFunction, transformDateRangeInTimezoneNormalFunction, transformDateRangeToTimezoneFunction, transformDateRangeWithStartOfDay, unixTimeNumberForNow, unixTimeNumberFromDate, unixTimeNumberFromDateOrTimeNumber, unixTimeNumberToDate, updateDateCellTimingToSystemTimezone, updateDateCellTimingToTimezone, updateDateCellTimingToTimezoneFunction, updateDateCellTimingToUTCTimezone, updateDateCellTimingWithDateCellTimingEvent, utcDayForDate, weekdayDateCellScheduleDayCodes, weekendDateCellScheduleDayCodes, yearWeekCode, yearWeekCodeDateFactory, yearWeekCodeDateTimezoneInstance, yearWeekCodeFactory, yearWeekCodeForCalendarMonth, yearWeekCodeForCalendarMonthFactory, yearWeekCodeForDateRange, yearWeekCodeForDateRangeFactory, yearWeekCodeForDateRangeInTimezone, yearWeekCodeFromDate, yearWeekCodeFromPair, yearWeekCodeGroupFactory, yearWeekCodeIndex, yearWeekCodePair, yearWeekCodePairFromDate };
10417
+ export { AnyIterResult, CalendarDate, CalendarDateType, DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX, DATE_TODAY_END_VALUE, DATE_TODAY_START_VALUE, DATE_WEEK_END_VALUE, DATE_WEEK_START_VALUE, DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE, DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION, DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS, DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED, DateCell, DateCellRange, DateCellSchedule, DateCellScheduleDayCode, DateCellTiming, DateDurationSpan, DateRRule, DateRRuleInstance, DateRRuleParseUtility, DateRRuleUtility, DateRange, DateRangeParams, DateRangeType, DateSet, DateTimeMinuteInstance, DateTimeUtilityInstance, DateTimezoneUtcNormalInstance, IsKnownTimezone, IsValidDateCellRange, IsValidDateCellRangeSeries, IsValidDateCellTiming, IterateDaysInDateRangeFunctionBailError, LastIterResult, LimitDateTimeInstance, MAX_FUTURE_DATE, ModelRecurrenceInfo, ModelRecurrenceInfoUtility, NextIterResult, RRuleStringSplitter, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, UNKNOWN_YEAR_WEEK_CODE, UTC_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, allIndexesInDateCellRange, allIndexesInDateCellRanges, allKnownTimezoneStrings, allTimezoneInfos, allTimezoneStrings, anyHaveExpired, atleastOneNotExpired, baseDateToTargetDate, calculateAllConversions, calculateExpectedDateCellTimingDuration, calculateExpectedDateCellTimingDurationPair, calculateTimezoneOffset, calendarDate, calendarDateFactory, calendarDateForDateDurationSpan, changeDateCellScheduleDateRangeToTimezone, changeDateCellScheduleDateRangeToTimezoneFunction, clampDateFunction, clampDateRangeFunction, clampDateRangeToDateRange, clampDateToDateRange, copyDateCellScheduleDateFilterConfig, copyHoursAndMinutesFromDate, copyHoursAndMinutesFromDateToToday, copyHoursAndMinutesFromDateWithTimezoneNormal, copyHoursAndMinutesFromNow, copyHoursAndMinutesFromNowWithTimezoneNormal, copyHoursAndMinutesFromUTCDate, copyHoursAndMinutesToDate, copyHoursAndMinutesToToday, dateCell, dateCellDayOfWeekFactory, dateCellDayTimingInfoFactory, dateCellDurationSpanHasEndedFilterFunction, dateCellDurationSpanHasNotEndedFilterFunction, dateCellDurationSpanHasNotStartedFilterFunction, dateCellDurationSpanHasStartedFilterFunction, dateCellEndIndex, dateCellIndexRange, dateCellIndexRangeToDateCellRange, dateCellIndexYearWeekCodeFactory, dateCellIndexYearWeekCodeGroupFactory, dateCellIndexsForDateCellScheduleDayCodes, dateCellRange, dateCellRangeBlocksCount, dateCellRangeBlocksCountInfo, dateCellRangeHasRange, dateCellRangeIncludedByRangeFunction, dateCellRangeOfTiming, dateCellRangeOfTimingFactory, dateCellRangeOverlapsRange, dateCellRangeOverlapsRangeFunction, dateCellRangeToDateCellIndexRange, dateCellRangeWithRange, dateCellRangeWithRangeFromIndex, dateCellRangesFullyCoverDateCellRangeFunction, dateCellScheduleDateCellTimingFilter, dateCellScheduleDateFilter, dateCellScheduleDateRange, dateCellScheduleDayCodeFactory, dateCellScheduleDayCodesAreSetsEquivalent, dateCellScheduleDayCodesFromEnabledDays, dateCellScheduleDayCodesSetFromDaysOfWeek, dateCellScheduleEncodedWeek, dateCellTiming, dateCellTimingCompletedTimeRange, dateCellTimingDateFactory, dateCellTimingDateRange, dateCellTimingEndDateFactory, dateCellTimingEndIndex, dateCellTimingEventRange, dateCellTimingExpansionFactory, dateCellTimingFinalStartsAtEvent, dateCellTimingFromDateCellTimingStartsAtEndRange, dateCellTimingLatestCompletedIndex, dateCellTimingRelativeIndexArrayFactory, dateCellTimingRelativeIndexFactory, dateCellTimingStart, dateCellTimingStartDateFactory, dateCellTimingStartPair, dateCellTimingStartsAtDateFactory, dateCellTimingStartsAtForStartOfDay, dateCellTimingTimezoneNormalInstance, dateDurationSpanEndDate, dateFromDateOrTimeNumber, dateFromLogicalDate, dateInterval, dateMonthDayStringFormat, dateOrDateRangeToDateRange, dateOrDayStringRangeToDateRange, dateOrDayStringRangeToISO8601DayStringRange, dateRange, dateRangeDaysCount, dateRangeOverlapsDateRange, dateRangeOverlapsDateRangeFunction, dateRangeRelativeState, dateRelativeStateForDateCellRangeComparedToIndex, dateShortDateAndTimeStringFormat, dateShortDateStringFormat, dateTimeInstance, dateTimeInstanceUtc, dateTimeMinuteDecisionFunction, dateTimeMinuteWholeDayDecisionFunction, dateTimeStringFormat, dateTimezoneUtcNormal, daysToMinutes, durationSpanDateRelativeState, durationSpanToDateRange, earliestDate, enabledDaysFromDateCellScheduleDayCodes, endItreateDaysInDateRangeEarly, expandDateCellCollection, expandDateCellRange, expandDateCellSchedule, expandDateCellScheduleDayCodes, expandDateCellScheduleDayCodesToDayCodesSet, expandDateCellScheduleDayCodesToDayOfWeekSet, expandDateCellScheduleFactory, expandDateCellScheduleRange, expandDateCellScheduleRangeToDateCellRanges, expandDateCellTiming, expandDaysForDateRange, expandDaysForDateRangeFunction, expandUniqueDateCellsFunction, filterDateCellsInDateCellRange, findMaxDate, findMinDate, findNextDateInDateCellScheduleFilter, fitDateRangeToDayPeriod, fitDateRangeToDayPeriodFunction, fitUTCDateRangeToDayPeriod, forEachDayInDateRange, formatDateDistance, formatDateRange, formatDateRangeDistance, formatDateRangeDistanceFunction, formatDateRangeFunction, formatStartedEndedDistanceString, formatToDateString, formatToDayRangeString, formatToDayTimeRangeString, formatToISO8601DateString, formatToISO8601DayString, formatToISO8601DayStringForSystem, formatToISO8601DayStringForUTC, formatToMonthDayString, formatToShortDateAndTimeString, formatToShortDateString, formatToTimeAndDurationString, formatToTimeRangeString, formatToTimeString, fractionalHoursInDurationSpan, fullDateCellScheduleRange, fullDateCellTiming, fullDateCellTimingTimezonePair, fullWeekDateCellScheduleDayCodes, getCurrentSystemOffsetInHours, getCurrentSystemOffsetInMinutes, getCurrentSystemOffsetInMs, getDateCellTimingFirstEventDateRange, getDateCellTimingHoursInEvent, getDaysOfWeekInDateRange, getExpiration, getGreatestDateCellIndexInDateCellRanges, getLeastAndGreatestDateCellIndexInDateCellRanges, getLeastDateCellIndexInDateCellRanges, getNextDateCellTimingIndex, getRelativeDateForDateCellTiming, getRelativeIndexForDateCellTiming, getTimeAM, getTimezoneAbbreviation, getTimezoneLongName, groupDateRangesByDateRelativeState, groupToDateCellRanges, groupUniqueDateCells, guessCurrentTimezone, hasExpired, hoursToMs, inverseDateTimezoneUtcNormalInstanceTransformType, isAfter, isDate, isDateCellRange, isDateCellSchedule, isDateCellScheduleDateRange, isDateCellScheduleEncodedWeek, isDateCellScheduleStartOfDayDateRange, isDateCellTiming, isDateCellTimingRelativeIndexFactory, isDateCellWithinDateCellRange, isDateCellWithinDateCellRangeFunction, isDateInDateRange, isDateInDateRangeFunction, isDateRange, isDateRangeInDateRange, isDateRangeInDateRangeFunction, isDateRangeStart, isDateWithinDateCellRangeFunction, isEmptyDateCellScheduleEncodedWeek, isFullDateCellScheduleDateRange, isFullDateCellTiming, isFullDateRange, isInfiniteDateRange, isKnownTimezone, isLogicalDateStringCode, isMaxFutureDate, isPartialDateRange, isSameDate, isSameDateCellSchedule, isSameDateCellScheduleDateRange, isSameDateCellScheduleEventRange, isSameDateCellTiming, isSameDateCellTimingEventStartsAtEndRange, isSameDateDay, isSameDateDayRange, isSameDateHoursAndMinutes, isSameDateRange, isSameDateTimezoneConversionConfig, isSameDurationSpan, isSameFullDateCellScheduleDateRange, isSameFullDateCellTiming, isStartOfDayForSystem, isStartOfDayInUTC, isValidDateCellIndex, isValidDateCellRange, isValidDateCellRangeSeries, isValidDateCellTiming, isValidDateCellTimingInfo, isValidDateCellTimingStartDate, isValidDateFromTimestringResult, isValidDateTimezoneConversionConfig, isValidFullDateCellTiming, isValidFullDateCellTimingInfo, iterateDaysInDateRange, iterateDaysInDateRangeFunction, latestDate, latestMinute, limitDateTime, limitDateTimeInstance, logicalDateStringCodeDateFactory, makeDateQueryForDateItemRangeFilter, makeDateQueryForDateStartsEndsFilter, makeDateQueryForOccuringFilter, makeDaysAndTimeFiltersFunction, makeMongoDBLikeDateQueryBuilder, maxFutureDate, mergeMongoDBLikeRangeFilters, minutesToMs, modifyDateCellToFitRange, modifyDateCellsToFitRange, modifyDateCellsToFitRangeFunction, msToMinutes, msToSeconds, nowInterval, parseISO8601DayStringToDate, parseJsDateString, parseReadableTimeString, rawDateCellScheduleDayCodes, readDaysOfWeek, readDaysOfWeekNames, readableTimeStringToDate, reduceDatesFunction, requireCurrentTimezone, roundDateTimeDown, roundDateTimeDownToSteps, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, shiftDateCellTimingToSystemTimezone, shiftDateCellTimingToTimezone, shiftDateCellTimingToTimezoneFunction, shiftDateCellTimingToUTCTimezone, simplifyDateCellScheduleDayCodes, skipAfterExpiration, skipExpired, skipUntilExpiration, skipUntilTimeElapsedAfterLastEmission, sortByDateFunction, sortByISO8601DateStringFunction, sortByISO8601DateStrings, sortDateCellRangeAndSizeFunction, sortDateCellRanges, sortDateRangeStartAscendingCompareFunction, startOfDayInTimezoneDayStringFactory, startOfDayInTimezoneFromISO8601DayString, startOfWeekForYearWeekCode, systemBaseDateToNormalDate, systemBaseDateToNormalDateOffset, systemDateTimezoneUtcNormal, systemExperiencesDaylightSavings, systemNormalDateToBaseDate, systemNormalDateToBaseDateOffset, takeAfterTimeElapsedSinceLastEmission, takeNextUpcomingTime, targetDateToBaseDate, timeHasExpired, timezoneInfoForSystem, timezoneStringToSearchableString, timezoneStringToTimezoneInfo, toExpiration, toExpires, toISO8601DayString, toISO8601DayStringForSystem, toISO8601DayStringForUTC, toISODateString, toJsDate, toJsDayDate, toLocalReadableTimeString, toReadableTimeString, transformDateInTimezoneNormalFunction, transformDateRangeDatesFunction, transformDateRangeInTimezoneNormalFunction, transformDateRangeToTimezoneFunction, transformDateRangeWithStartOfDay, unixTimeNumberForNow, unixTimeNumberFromDate, unixTimeNumberFromDateOrTimeNumber, unixTimeNumberToDate, updateDateCellTimingToSystemTimezone, updateDateCellTimingToTimezone, updateDateCellTimingToTimezoneFunction, updateDateCellTimingToUTCTimezone, updateDateCellTimingWithDateCellTimingEvent, utcDayForDate, weekdayDateCellScheduleDayCodes, weekendDateCellScheduleDayCodes, yearWeekCode, yearWeekCodeDateFactory, yearWeekCodeDateTimezoneInstance, yearWeekCodeFactory, yearWeekCodeForCalendarMonth, yearWeekCodeForCalendarMonthFactory, yearWeekCodeForDateRange, yearWeekCodeForDateRangeFactory, yearWeekCodeForDateRangeInTimezone, yearWeekCodeFromDate, yearWeekCodeFromPair, yearWeekCodeGroupFactory, yearWeekCodeIndex, yearWeekCodePair, yearWeekCodePairFromDate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "10.1.3",
3
+ "version": "10.1.5",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -20,6 +20,12 @@ export declare function isValidDateCellIndex(input: DateCellIndex): boolean;
20
20
  * Input type that is either a Date or a DateCellIndex.
21
21
  */
22
22
  export type DateOrDateCellIndex = Date | DateCellIndex;
23
+ /**
24
+ * A date and the relative date index.
25
+ */
26
+ export interface DateCellIndexDatePair extends Readonly<IndexRef> {
27
+ readonly date: Date;
28
+ }
23
29
  /**
24
30
  * A duration-span block.
25
31
  */
@@ -276,7 +276,7 @@ export declare function getRelativeIndexForDateCellTiming(timing: DateCellTiming
276
276
  *
277
277
  * Returns a date with the hours and minutes for "now" for the given date returned if an index is input.
278
278
  */
279
- export type DateCellTimingDateFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt> = ((input: DateOrDateCellIndex) => Date) & {
279
+ export type DateCellTimingDateFactory<T extends DateCellTimingStartsAt = DateCellTimingStartsAt> = ((input: DateOrDateCellIndex, now?: Date) => Date) & {
280
280
  readonly _timing: T;
281
281
  };
282
282
  /**
@@ -1,7 +1,7 @@
1
1
  import { type DateRange } from '@dereekb/date';
2
- import { type StringOrder, type Maybe, type DayOfWeek, type DecisionFunction, type FilterFunction, type IndexRange, type EnabledDays, type ArrayOrValue, type TimezoneStringRef } from '@dereekb/util';
3
- import { type DateCell, type DateCellDurationSpan, type DateCellIndex, type DateCellTiming, type DateCellTimingDateRange, type DateCellTimingStartsAtEndRange, type FullDateCellTiming, type DateCellTimingEventStartsAt, type DateCellTimingTimezoneInput } from './date.cell';
4
- import { type DateCellTimingRelativeIndexFactoryInput, type DateCellTimingExpansionFactory } from './date.cell.factory';
2
+ import { type StringOrder, type Maybe, type DayOfWeek, type DecisionFunction, type FilterFunction, type IndexRange, type EnabledDays, type ArrayOrValue, type TimezoneStringRef, type Days, type DateRelativeDirection } from '@dereekb/util';
3
+ import { type DateCell, type DateCellDurationSpan, type DateCellIndex, type DateCellTiming, type DateCellTimingDateRange, type DateCellTimingStartsAtEndRange, type FullDateCellTiming, type DateCellTimingEventStartsAt, type DateCellTimingTimezoneInput, type DateCellIndexDatePair } from './date.cell';
4
+ import { type DateCellTimingRelativeIndexFactoryInput, type DateCellTimingExpansionFactory, type DateCellTimingRelativeIndexFactory } from './date.cell.factory';
5
5
  import { type DateCellRangeOrDateRange, type DateCellRangeWithRange } from './date.cell.index';
6
6
  import { type DateTimezoneUtcNormalInstance } from './date.timezone';
7
7
  import { type YearWeekCodeConfig } from './date.week';
@@ -309,7 +309,9 @@ export type DateCellScheduleDateFilterInput = DateCellTimingRelativeIndexFactory
309
309
  /**
310
310
  * Returns true if the date falls within the schedule.
311
311
  */
312
- export type DateCellScheduleDateFilter = DecisionFunction<DateCellScheduleDateFilterInput>;
312
+ export type DateCellScheduleDateFilter = DecisionFunction<DateCellScheduleDateFilterInput> & {
313
+ readonly _dateCellTimingRelativeIndexFactory: DateCellTimingRelativeIndexFactory;
314
+ };
313
315
  /**
314
316
  * dateCellScheduleDateFilter() configuration.
315
317
  */
@@ -317,11 +319,11 @@ export interface DateCellScheduleDateFilterConfig extends DateCellSchedule, Part
317
319
  /**
318
320
  * The min/max date range for the filter.
319
321
  */
320
- minMaxDateRange?: Maybe<Partial<DateCellRangeOrDateRange>>;
322
+ readonly minMaxDateRange?: Maybe<Partial<DateCellRangeOrDateRange>>;
321
323
  /**
322
324
  * Whether or not to restrict the start as the min date if a min date is not set in minMaxDateRange. True by default.
323
325
  */
324
- setStartAsMinDate?: boolean;
326
+ readonly setStartAsMinDate?: boolean;
325
327
  }
326
328
  export declare function copyDateCellScheduleDateFilterConfig(inputFilter: DateCellScheduleDateFilterConfig): DateCellScheduleDateFilterConfig;
327
329
  /**
@@ -331,6 +333,24 @@ export declare function copyDateCellScheduleDateFilterConfig(inputFilter: DateCe
331
333
  * @returns
332
334
  */
333
335
  export declare function dateCellScheduleDateFilter(config: DateCellScheduleDateFilterConfig): DateCellScheduleDateFilter;
336
+ export interface FindNextDateInDateCellScheduleFilterInput {
337
+ readonly date: DateCellScheduleDateFilterInput;
338
+ readonly filter: DateCellScheduleDateFilter;
339
+ readonly direction: DateRelativeDirection;
340
+ readonly maxDistance: Days;
341
+ /**
342
+ * Whether or not to exclude the input date. False by default.
343
+ */
344
+ readonly excludeInputDate?: boolean;
345
+ }
346
+ /**
347
+ * Passes a number of day values until it reaches an open day on a schedule. There's a maximum distance it searches in a direction before returning null.
348
+ *
349
+ * @param date
350
+ * @param filter
351
+ * @param maxDistance
352
+ */
353
+ export declare function findNextDateInDateCellScheduleFilter(config: FindNextDateInDateCellScheduleFilterInput): Maybe<DateCellIndexDatePair>;
334
354
  export type DateCellScheduleDateCellTimingFilter<B extends DateCell = DateCell> = DecisionFunction<B>;
335
355
  /**
336
356
  * Configuration for dateCellScheduleDateCellTimingFilter()
@@ -1,33 +1,33 @@
1
- import { type Minutes, type DecisionFunction } from '@dereekb/util';
1
+ import { type Minutes, type DecisionFunction, type DateRelativeDirection, type Days, type Maybe } from '@dereekb/util';
2
2
  import { type StepRoundDateTimeDown } from './date.round';
3
- import { type DateCellScheduleDateFilterConfig } from './date.cell.schedule';
3
+ import { type DateCellScheduleDateFilterConfig, type DateCellScheduleDateFilterInput } from './date.cell.schedule';
4
4
  import { type LimitDateTimeConfig } from './date.time.limit';
5
5
  export interface DateTimeMinuteConfig extends LimitDateTimeConfig {
6
6
  /**
7
7
  * Default date to consider.
8
8
  */
9
- date?: Date;
9
+ readonly date?: Date;
10
10
  /**
11
11
  * Number of minutes each "step" is.
12
12
  */
13
- step?: Minutes;
13
+ readonly step?: Minutes;
14
14
  /**
15
15
  * Additional behavior
16
16
  */
17
- behavior?: {
17
+ readonly behavior?: {
18
18
  /**
19
19
  * Whether or not to set the date to the min if the steps go above it.
20
20
  */
21
- capToMinLimit?: boolean;
21
+ readonly capToMinLimit?: boolean;
22
22
  /**
23
23
  * Whether or not to set the date to the max if the steps go above it.
24
24
  */
25
- capToMaxLimit?: boolean;
25
+ readonly capToMaxLimit?: boolean;
26
26
  };
27
27
  /**
28
28
  * Schedule to filter the days to.
29
29
  */
30
- schedule?: DateCellScheduleDateFilterConfig;
30
+ readonly schedule?: DateCellScheduleDateFilterConfig;
31
31
  }
32
32
  /**
33
33
  * Current state of the date in the instance.
@@ -36,30 +36,30 @@ export interface DateTimeMinuteDateStatus {
36
36
  /**
37
37
  * If the date is at the minimum value.
38
38
  */
39
- isAfterMinimum: boolean;
39
+ readonly isAfterMinimum: boolean;
40
40
  /**
41
41
  * If thte date is at the maximum value.
42
42
  */
43
- isBeforeMaximum: boolean;
43
+ readonly isBeforeMaximum: boolean;
44
44
  /**
45
45
  * If the date is in the future.
46
46
  */
47
- inFuture: boolean;
47
+ readonly inFuture: boolean;
48
48
  /**
49
49
  * If the date is in the future at the minimum number of future minutes requested.
50
50
  */
51
- inFutureMinutes: boolean;
51
+ readonly inFutureMinutes: boolean;
52
52
  /**
53
53
  * If the date is in the past.
54
54
  */
55
- inPast: boolean;
55
+ readonly inPast: boolean;
56
56
  /**
57
57
  * If the date is on a schedule day.
58
58
  */
59
- isInSchedule: boolean;
59
+ readonly isInSchedule: boolean;
60
60
  }
61
61
  export interface RoundDateTimeMinute extends StepRoundDateTimeDown {
62
- roundToBound?: boolean;
62
+ readonly roundToBound?: boolean;
63
63
  }
64
64
  /**
65
65
  * Instance for working with a single date/time.
@@ -93,7 +93,11 @@ export declare class DateTimeMinuteInstance {
93
93
  isValid(date?: Date): boolean;
94
94
  getStatus(date?: Date): DateTimeMinuteDateStatus;
95
95
  round(round: RoundDateTimeMinute): Date;
96
- clamp(date?: Date): Date;
96
+ clamp(date?: Date, maxClampDistance?: Days): Date;
97
+ clampToLimit(date?: Date): Date;
98
+ clampToSchedule(date?: Date, maxClampDistance?: Days): Date;
99
+ findNextAvailableDayInSchedule(date: DateCellScheduleDateFilterInput, direction: DateRelativeDirection, maxDistance?: Days): Maybe<Date>;
100
+ isInSchedule(date: DateCellScheduleDateFilterInput): boolean;
97
101
  protected _takeBoundedDate(date?: Date): Date;
98
102
  protected _takeMinimumBoundedDate(date?: Date): Date;
99
103
  protected _takeMaximumBoundedDate(date?: Date): Date;