@dereekb/date 10.1.16 → 10.1.17

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
@@ -2468,6 +2468,18 @@ function dateRange(input, inputRoundToMinute) {
2468
2468
  end
2469
2469
  };
2470
2470
  }
2471
+ /**
2472
+ * Convenience function that calls dateRange() to return the first millisecond and last millisecond of the input date.
2473
+ *
2474
+ * @param date
2475
+ * @returns
2476
+ */
2477
+ function dateRangeFromStartAndEndOfDay(date) {
2478
+ return dateRange({
2479
+ date,
2480
+ type: exports.DateRangeType.DAY
2481
+ });
2482
+ }
2471
2483
  const DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS = 4000;
2472
2484
  class IterateDaysInDateRangeFunctionBailError extends Error {
2473
2485
  constructor(message = 'bail out') {
@@ -7691,6 +7703,9 @@ class LimitDateTimeInstance {
7691
7703
  const {
7692
7704
  instant = new Date()
7693
7705
  } = this.config;
7706
+ return this.dateRangeForInstant(instant);
7707
+ }
7708
+ dateRangeForInstant(instant) {
7694
7709
  const {
7695
7710
  min,
7696
7711
  max
@@ -7749,6 +7764,31 @@ class DateTimeMinuteInstance {
7749
7764
  set step(step) {
7750
7765
  this._step = step;
7751
7766
  }
7767
+ /**
7768
+ * Returns true if the input date is on the schedule and possibly holds a valid value for the limit.
7769
+ *
7770
+ * @param date
7771
+ */
7772
+ dateDayContainsValidDateValue(date) {
7773
+ const isInSchedule = this.dateIsInSchedule(date);
7774
+ let dateDayContainsValidDateValue = false;
7775
+ if (isInSchedule) {
7776
+ const limitRange = this._limit.dateRange();
7777
+ if (limitRange.start == null && limitRange.end == null) {
7778
+ dateDayContainsValidDateValue = true; // no limit
7779
+ } else {
7780
+ const dateStartAndEnd = dateRangeFromStartAndEndOfDay(date);
7781
+ if (limitRange.start != null && limitRange.end != null) {
7782
+ dateDayContainsValidDateValue = dateRangeOverlapsDateRange(dateStartAndEnd, limitRange); // true if there is any overlap at all
7783
+ } else if (limitRange.start != null) {
7784
+ dateDayContainsValidDateValue = !dateFns.isAfter(limitRange.start, dateStartAndEnd.end);
7785
+ } else if (limitRange.end != null) {
7786
+ dateDayContainsValidDateValue = !dateFns.isBefore(limitRange.end, dateStartAndEnd.start);
7787
+ }
7788
+ }
7789
+ }
7790
+ return dateDayContainsValidDateValue;
7791
+ }
7752
7792
  /**
7753
7793
  * Returns true if the input is within the range and in the schedule.
7754
7794
  *
@@ -7803,7 +7843,7 @@ class DateTimeMinuteInstance {
7803
7843
  inPast = dateFns.isBefore(date, now);
7804
7844
  }
7805
7845
  // Schedule
7806
- isInSchedule = this._dateFilter ? this._dateFilter(date) : true; // default
7846
+ isInSchedule = this.dateIsInSchedule(date);
7807
7847
  return {
7808
7848
  isBeforeMaximum,
7809
7849
  isAfterMinimum,
@@ -7813,6 +7853,10 @@ class DateTimeMinuteInstance {
7813
7853
  isInSchedule
7814
7854
  };
7815
7855
  }
7856
+ dateIsInSchedule(date = this.date) {
7857
+ return this._dateFilter ? this._dateFilter(date) : true; // true if no date filter
7858
+ }
7859
+
7816
7860
  round(round) {
7817
7861
  var _a;
7818
7862
  let date = roundDateTimeDownToSteps(this.date, Object.assign(Object.assign({}, round), {
@@ -7922,18 +7966,18 @@ function dateTimeMinuteDecisionFunction(config) {
7922
7966
  return date => instance.isValid(date);
7923
7967
  }
7924
7968
  /**
7925
- * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day.
7969
+ * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day to determine the decision.
7926
7970
  *
7927
7971
  * @param config
7928
- * @param startAndEndOfDayMustBeValue Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
7972
+ * @param startAndEndOfDayMustBeValid Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
7929
7973
  * @returns
7930
7974
  */
7931
- function dateTimeMinuteWholeDayDecisionFunction(config, startAndEndOfDayMustBeValue = false) {
7975
+ function dateTimeMinuteWholeDayDecisionFunction(config, startAndEndOfDayMustBeValid = false) {
7932
7976
  const instance = new DateTimeMinuteInstance(config, null);
7933
- if (startAndEndOfDayMustBeValue) {
7977
+ if (startAndEndOfDayMustBeValid) {
7934
7978
  return date => instance.isValid(dateFns.startOfDay(date)) && instance.isValid(dateFns.endOfDay(date));
7935
7979
  } else {
7936
- return date => instance.isValid(dateFns.startOfDay(date)) || instance.isValid(dateFns.endOfDay(date));
7980
+ return date => instance.dateDayContainsValidDateValue(date);
7937
7981
  }
7938
7982
  }
7939
7983
 
@@ -9482,6 +9526,7 @@ exports.dateOrDayStringRangeToDateRange = dateOrDayStringRangeToDateRange;
9482
9526
  exports.dateOrDayStringRangeToISO8601DayStringRange = dateOrDayStringRangeToISO8601DayStringRange;
9483
9527
  exports.dateRange = dateRange;
9484
9528
  exports.dateRangeDaysCount = dateRangeDaysCount;
9529
+ exports.dateRangeFromStartAndEndOfDay = dateRangeFromStartAndEndOfDay;
9485
9530
  exports.dateRangeOverlapsDateRange = dateRangeOverlapsDateRange;
9486
9531
  exports.dateRangeOverlapsDateRangeFunction = dateRangeOverlapsDateRangeFunction;
9487
9532
  exports.dateRangeRelativeState = dateRangeRelativeState;
package/index.esm.js CHANGED
@@ -2551,6 +2551,19 @@ function dateRange(input, inputRoundToMinute) {
2551
2551
  };
2552
2552
  }
2553
2553
 
2554
+ /**
2555
+ * Convenience function that calls dateRange() to return the first millisecond and last millisecond of the input date.
2556
+ *
2557
+ * @param date
2558
+ * @returns
2559
+ */
2560
+ function dateRangeFromStartAndEndOfDay(date) {
2561
+ return dateRange({
2562
+ date,
2563
+ type: DateRangeType.DAY
2564
+ });
2565
+ }
2566
+
2554
2567
  /**
2555
2568
  * Function that iterates dates within a date range at a pre-configured iteration step.
2556
2569
  */
@@ -8606,6 +8619,9 @@ class LimitDateTimeInstance {
8606
8619
  const {
8607
8620
  instant = new Date()
8608
8621
  } = this.config;
8622
+ return this.dateRangeForInstant(instant);
8623
+ }
8624
+ dateRangeForInstant(instant) {
8609
8625
  const {
8610
8626
  min,
8611
8627
  max
@@ -8674,6 +8690,32 @@ class DateTimeMinuteInstance {
8674
8690
  this._step = step;
8675
8691
  }
8676
8692
 
8693
+ /**
8694
+ * Returns true if the input date is on the schedule and possibly holds a valid value for the limit.
8695
+ *
8696
+ * @param date
8697
+ */
8698
+ dateDayContainsValidDateValue(date) {
8699
+ const isInSchedule = this.dateIsInSchedule(date);
8700
+ let dateDayContainsValidDateValue = false;
8701
+ if (isInSchedule) {
8702
+ const limitRange = this._limit.dateRange();
8703
+ if (limitRange.start == null && limitRange.end == null) {
8704
+ dateDayContainsValidDateValue = true; // no limit
8705
+ } else {
8706
+ const dateStartAndEnd = dateRangeFromStartAndEndOfDay(date);
8707
+ if (limitRange.start != null && limitRange.end != null) {
8708
+ dateDayContainsValidDateValue = dateRangeOverlapsDateRange(dateStartAndEnd, limitRange); // true if there is any overlap at all
8709
+ } else if (limitRange.start != null) {
8710
+ dateDayContainsValidDateValue = !isAfter$1(limitRange.start, dateStartAndEnd.end);
8711
+ } else if (limitRange.end != null) {
8712
+ dateDayContainsValidDateValue = !isBefore(limitRange.end, dateStartAndEnd.start);
8713
+ }
8714
+ }
8715
+ }
8716
+ return dateDayContainsValidDateValue;
8717
+ }
8718
+
8677
8719
  /**
8678
8720
  * Returns true if the input is within the range and in the schedule.
8679
8721
  *
@@ -8732,8 +8774,7 @@ class DateTimeMinuteInstance {
8732
8774
  }
8733
8775
 
8734
8776
  // Schedule
8735
- isInSchedule = this._dateFilter ? this._dateFilter(date) : true; // default
8736
-
8777
+ isInSchedule = this.dateIsInSchedule(date);
8737
8778
  return {
8738
8779
  isBeforeMaximum,
8739
8780
  isAfterMinimum,
@@ -8743,6 +8784,10 @@ class DateTimeMinuteInstance {
8743
8784
  isInSchedule
8744
8785
  };
8745
8786
  }
8787
+ dateIsInSchedule(date = this.date) {
8788
+ return this._dateFilter ? this._dateFilter(date) : true; // true if no date filter
8789
+ }
8790
+
8746
8791
  round(round) {
8747
8792
  var _round$step;
8748
8793
  let date = roundDateTimeDownToSteps(this.date, Object.assign({}, round, {
@@ -8857,18 +8902,18 @@ function dateTimeMinuteDecisionFunction(config) {
8857
8902
  }
8858
8903
 
8859
8904
  /**
8860
- * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day.
8905
+ * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day to determine the decision.
8861
8906
  *
8862
8907
  * @param config
8863
- * @param startAndEndOfDayMustBeValue Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
8908
+ * @param startAndEndOfDayMustBeValid Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
8864
8909
  * @returns
8865
8910
  */
8866
- function dateTimeMinuteWholeDayDecisionFunction(config, startAndEndOfDayMustBeValue = false) {
8911
+ function dateTimeMinuteWholeDayDecisionFunction(config, startAndEndOfDayMustBeValid = false) {
8867
8912
  const instance = new DateTimeMinuteInstance(config, null);
8868
- if (startAndEndOfDayMustBeValue) {
8913
+ if (startAndEndOfDayMustBeValid) {
8869
8914
  return date => instance.isValid(startOfDay(date)) && instance.isValid(endOfDay(date));
8870
8915
  } else {
8871
- return date => instance.isValid(startOfDay(date)) || instance.isValid(endOfDay(date));
8916
+ return date => instance.dateDayContainsValidDateValue(date);
8872
8917
  }
8873
8918
  }
8874
8919
 
@@ -10465,4 +10510,4 @@ class ModelRecurrenceInfoUtility {
10465
10510
  }
10466
10511
  }
10467
10512
 
10468
- 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, isEndOfDayInUTC, 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 };
10513
+ 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, dateRangeFromStartAndEndOfDay, 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, isEndOfDayInUTC, 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.16",
3
+ "version": "10.1.17",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -161,6 +161,13 @@ export type DateRangeInput = (DateRangeTypedInput | DateRangeDistanceInput) & {
161
161
  * @returns
162
162
  */
163
163
  export declare function dateRange(input: DateRangeType | DateRangeInput, inputRoundToMinute?: boolean): DateRange;
164
+ /**
165
+ * Convenience function that calls dateRange() to return the first millisecond and last millisecond of the input date.
166
+ *
167
+ * @param date
168
+ * @returns
169
+ */
170
+ export declare function dateRangeFromStartAndEndOfDay(date: Date): DateRange;
164
171
  /**
165
172
  * Function that iterates dates within a date range at a pre-configured iteration step.
166
173
  */
@@ -60,6 +60,10 @@ export declare class LimitDateTimeInstance {
60
60
  * @returns
61
61
  */
62
62
  dateRange(): Partial<DateRange>;
63
+ dateRangeForInstant(instant: Date): {
64
+ start: Date | undefined;
65
+ end: Date | undefined;
66
+ };
63
67
  /**
64
68
  * Clamps the input date to the current range.
65
69
  */
@@ -77,6 +77,12 @@ export declare class DateTimeMinuteInstance {
77
77
  set date(date: Date);
78
78
  get step(): Minutes;
79
79
  set step(step: Minutes);
80
+ /**
81
+ * Returns true if the input date is on the schedule and possibly holds a valid value for the limit.
82
+ *
83
+ * @param date
84
+ */
85
+ dateDayContainsValidDateValue(date: Date): boolean;
80
86
  /**
81
87
  * Returns true if the input is within the range and in the schedule.
82
88
  *
@@ -92,6 +98,7 @@ export declare class DateTimeMinuteInstance {
92
98
  */
93
99
  isValid(date?: Date): boolean;
94
100
  getStatus(date?: Date): DateTimeMinuteDateStatus;
101
+ dateIsInSchedule(date?: Date): boolean;
95
102
  round(round: RoundDateTimeMinute): Date;
96
103
  clamp(date?: Date, maxClampDistance?: Days): Date;
97
104
  clampToLimit(date?: Date): Date;
@@ -110,10 +117,10 @@ export declare class DateTimeMinuteInstance {
110
117
  */
111
118
  export declare function dateTimeMinuteDecisionFunction(config: DateTimeMinuteConfig): DecisionFunction<Date>;
112
119
  /**
113
- * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day.
120
+ * Similar to dateTimeMinuteDecisionFunction(), but compares the first and last instant of the input day to determine the decision.
114
121
  *
115
122
  * @param config
116
- * @param startAndEndOfDayMustBeValue Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
123
+ * @param startAndEndOfDayMustBeValid Whether or not the start of the day and end of the day must be valid to be considered valid. Defaults to false.
117
124
  * @returns
118
125
  */
119
- export declare function dateTimeMinuteWholeDayDecisionFunction(config: DateTimeMinuteConfig, startAndEndOfDayMustBeValue?: boolean): DecisionFunction<Date>;
126
+ export declare function dateTimeMinuteWholeDayDecisionFunction(config: DateTimeMinuteConfig, startAndEndOfDayMustBeValid?: boolean): DecisionFunction<Date>;