@dereekb/date 11.1.3 → 11.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
@@ -8733,39 +8733,13 @@ function limitDateTime(config) {
8733
8733
  return new LimitDateTimeInstance(config);
8734
8734
  }
8735
8735
 
8736
- // COMPAT: - TODO - Move to util
8737
- function unixTimeNumberFromDateOrTimeNumber(input) {
8738
- if (input == null) {
8739
- return input;
8740
- } else if (dateFns.isDate(input)) {
8741
- return unixTimeNumberFromDate(input);
8742
- } else {
8743
- return input;
8744
- }
8745
- }
8746
- function unixTimeNumberForNow() {
8747
- return unixTimeNumberFromDate(new Date());
8748
- }
8749
- function unixTimeNumberFromDate(date) {
8750
- return date != null ? Math.ceil(date.getTime() / 1000) : date;
8751
- }
8752
- function dateFromDateOrTimeNumber(input) {
8753
- if (input == null) {
8754
- return input;
8755
- } else if (dateFns.isDate(input)) {
8756
- return input;
8757
- } else {
8758
- return unixTimeNumberToDate(input);
8759
- }
8760
- }
8761
- function unixTimeNumberToDate(dateTimeNumber) {
8762
- return dateTimeNumber != null ? new Date(dateTimeNumber * 1000) : dateTimeNumber;
8763
- }
8764
-
8736
+ // MARK: Compat
8765
8737
  /**
8766
8738
  * Returns true if any of the input items have expired.
8767
8739
  *
8768
8740
  * If the list is empty, returns false.
8741
+ *
8742
+ * @deprecated Use ExpirationDetails and checkAtleastOneNotExpired() instead.
8769
8743
  */
8770
8744
  function atleastOneNotExpired(expires) {
8771
8745
  for (const expire of expires) {
@@ -8779,6 +8753,8 @@ function atleastOneNotExpired(expires) {
8779
8753
  * Returns true if any of the input items has expired.
8780
8754
  *
8781
8755
  * If the list is empty, returns the second argument, or true by default.
8756
+ *
8757
+ * @deprecated Use ExpirationDetails and checkAnyHaveExpired() instead.
8782
8758
  */
8783
8759
  function anyHaveExpired(expires, expireIfEmpty = true) {
8784
8760
  if (expires.length === 0) {
@@ -8797,6 +8773,8 @@ function anyHaveExpired(expires, expireIfEmpty = true) {
8797
8773
  * @param timeNumber
8798
8774
  * @param expiresIn
8799
8775
  * @returns
8776
+ *
8777
+ * @deprecated Use isThrottled() or expirationDetails({ expiresFromDate: time, expiresIn }).hasExpired() instead.
8800
8778
  */
8801
8779
  function timeHasExpired(time, expiresIn) {
8802
8780
  return hasExpired(toExpires(time, expiresIn));
@@ -8804,12 +8782,13 @@ function timeHasExpired(time, expiresIn) {
8804
8782
  /**
8805
8783
  * Creates an Expires object from the input date or time number.
8806
8784
  *
8785
+ * @deprecated Use ExpirationDetails instead.
8786
+ *
8807
8787
  * @param timeNumber Number to convert to a date.
8808
- * @param expiresIn If the input number is the initial date, and not the
8809
- * expiration date, this is used to find the expiresAt time.
8788
+ * @param expiresIn If the input number is the initial date, and not the expiration date, this is used to find the expiresAt time.
8810
8789
  */
8811
8790
  function toExpires(time, expiresIn) {
8812
- let expiresAt = dateFromDateOrTimeNumber(time);
8791
+ let expiresAt = util.dateFromDateOrTimeNumber(time);
8813
8792
  if (expiresAt && expiresIn != null) {
8814
8793
  expiresAt = dateFns.addMilliseconds(expiresAt, expiresIn);
8815
8794
  }
@@ -8819,6 +8798,8 @@ function toExpires(time, expiresIn) {
8819
8798
  }
8820
8799
  /**
8821
8800
  * Checks whether or not the item has expired. If no expiration date is set, it is considered expired.
8801
+ *
8802
+ * @deprecated Use ExpirationDetails instead.
8822
8803
  */
8823
8804
  function hasExpired(expires) {
8824
8805
  const expiresAt = getExpiration(expires);
@@ -8826,13 +8807,15 @@ function hasExpired(expires) {
8826
8807
  }
8827
8808
  /**
8828
8809
  * Returns the expiration date, or a date 1 minute in the past if not defined.
8810
+ *
8811
+ * @deprecated Use ExpirationDetails instead.
8829
8812
  */
8830
8813
  function getExpiration(expires) {
8831
8814
  var _expires$expiresAt;
8832
8815
  return (_expires$expiresAt = expires == null ? void 0 : expires.expiresAt) != null ? _expires$expiresAt : dateFns.addMinutes(new Date(), -1);
8833
8816
  }
8834
- // COMPAT: TODO - Deprecate these classes, and create a new implementation in @dereekb/util with "now" as an option.
8835
8817
 
8818
+ // TODO: Deprecate and move to @dereekb/rxjs
8836
8819
  /**
8837
8820
  * Creates a new Expires object at the current time on emission that will expire in the set amount of time.
8838
8821
  *
@@ -9649,6 +9632,26 @@ class ModelRecurrenceInfoUtility {
9649
9632
  }
9650
9633
  }
9651
9634
 
9635
+ Object.defineProperty(exports, 'dateFromDateOrTimeNumber', {
9636
+ enumerable: true,
9637
+ get: function () { return util.dateFromDateOrTimeNumber; }
9638
+ });
9639
+ Object.defineProperty(exports, 'unixTimeNumberForNow', {
9640
+ enumerable: true,
9641
+ get: function () { return util.unixTimeNumberForNow; }
9642
+ });
9643
+ Object.defineProperty(exports, 'unixTimeNumberFromDate', {
9644
+ enumerable: true,
9645
+ get: function () { return util.unixTimeNumberFromDate; }
9646
+ });
9647
+ Object.defineProperty(exports, 'unixTimeNumberFromDateOrTimeNumber', {
9648
+ enumerable: true,
9649
+ get: function () { return util.unixTimeNumberFromDateOrTimeNumber; }
9650
+ });
9651
+ Object.defineProperty(exports, 'unixTimeNumberToDate', {
9652
+ enumerable: true,
9653
+ get: function () { return util.unixTimeNumberToDate; }
9654
+ });
9652
9655
  exports.AnyIterResult = AnyIterResult;
9653
9656
  exports.CalendarDate = CalendarDate;
9654
9657
  exports.DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX;
@@ -9774,7 +9777,6 @@ exports.dateCellTimingStartsAtDateFactory = dateCellTimingStartsAtDateFactory;
9774
9777
  exports.dateCellTimingStartsAtForStartOfDay = dateCellTimingStartsAtForStartOfDay;
9775
9778
  exports.dateCellTimingTimezoneNormalInstance = dateCellTimingTimezoneNormalInstance;
9776
9779
  exports.dateDurationSpanEndDate = dateDurationSpanEndDate;
9777
- exports.dateFromDateOrTimeNumber = dateFromDateOrTimeNumber;
9778
9780
  exports.dateFromLogicalDate = dateFromLogicalDate;
9779
9781
  exports.dateInterval = dateInterval;
9780
9782
  exports.dateMonthDayStringFormat = dateMonthDayStringFormat;
@@ -10014,10 +10016,6 @@ exports.transformDateRangeDatesFunction = transformDateRangeDatesFunction;
10014
10016
  exports.transformDateRangeInTimezoneNormalFunction = transformDateRangeInTimezoneNormalFunction;
10015
10017
  exports.transformDateRangeToTimezoneFunction = transformDateRangeToTimezoneFunction;
10016
10018
  exports.transformDateRangeWithStartOfDay = transformDateRangeWithStartOfDay;
10017
- exports.unixTimeNumberForNow = unixTimeNumberForNow;
10018
- exports.unixTimeNumberFromDate = unixTimeNumberFromDate;
10019
- exports.unixTimeNumberFromDateOrTimeNumber = unixTimeNumberFromDateOrTimeNumber;
10020
- exports.unixTimeNumberToDate = unixTimeNumberToDate;
10021
10019
  exports.updateDateCellTimingToSystemTimezone = updateDateCellTimingToSystemTimezone;
10022
10020
  exports.updateDateCellTimingToTimezone = updateDateCellTimingToTimezone;
10023
10021
  exports.updateDateCellTimingToTimezoneFunction = updateDateCellTimingToTimezoneFunction;
package/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
- import { MS_IN_HOUR, MS_IN_MINUTE, MINUTES_IN_DAY, isISO8601DateString, filterMaybeArrayValues, asArray, dayOfWeek, sortNumbersAscendingFunction, MS_IN_SECOND, SORT_VALUE_LESS_THAN, SORT_VALUE_GREATER_THAN, SORT_VALUE_EQUAL, copyArray, compareFnOrder, groupValues, daysOfWeekArray, MS_IN_DAY, minutesToFractionalHours, safeCompareEquality, DATE_NOW_VALUE, mapIdentityFunction, UTC_TIMEZONE_STRING, isSameNonNullValue, isConsideredUtcTimezoneString, cachedGetter, parseISO8601DayStringToUTCDate, replaceStringsFunction, repeatString, isEqualDate, startOfDayForUTCDateInUTC, sortAscendingIndexNumberRefFunction, range, pushArrayItemsIntoArray, sumOfIntegersBetween, makeValuesGroupMap, lastValue, asGetter, indexRangeCheckFunction, mergeFilterFunctions, isDate as isDate$2, HOURS_IN_DAY, getNextDay, enabledDaysFromDaysOfWeek, daysOfWeekFromEnabledDays, firstValueFromIterable, forEachInIterable, addToSet, iterablesAreSetEquivalent, invertFilter, HashSet, roundNumberUpToStep, protectedFactory, TimeAM, isLogicalDateStringCode as isLogicalDateStringCode$1, dateFromLogicalDate as dateFromLogicalDate$1, flattenArray, splitJoinRemainder } from '@dereekb/util';
1
+ import { MS_IN_HOUR, MS_IN_MINUTE, MINUTES_IN_DAY, isISO8601DateString, filterMaybeArrayValues, asArray, dayOfWeek, sortNumbersAscendingFunction, MS_IN_SECOND, SORT_VALUE_LESS_THAN, SORT_VALUE_GREATER_THAN, SORT_VALUE_EQUAL, copyArray, compareFnOrder, groupValues, daysOfWeekArray, MS_IN_DAY, minutesToFractionalHours, safeCompareEquality, DATE_NOW_VALUE, mapIdentityFunction, UTC_TIMEZONE_STRING, isSameNonNullValue, isConsideredUtcTimezoneString, cachedGetter, parseISO8601DayStringToUTCDate, replaceStringsFunction, repeatString, isEqualDate, startOfDayForUTCDateInUTC, sortAscendingIndexNumberRefFunction, range, pushArrayItemsIntoArray, sumOfIntegersBetween, makeValuesGroupMap, lastValue, asGetter, indexRangeCheckFunction, mergeFilterFunctions, isDate as isDate$2, HOURS_IN_DAY, getNextDay, enabledDaysFromDaysOfWeek, daysOfWeekFromEnabledDays, firstValueFromIterable, forEachInIterable, addToSet, iterablesAreSetEquivalent, invertFilter, HashSet, roundNumberUpToStep, protectedFactory, TimeAM, isLogicalDateStringCode as isLogicalDateStringCode$1, dateFromLogicalDate as dateFromLogicalDate$1, dateFromDateOrTimeNumber, flattenArray, splitJoinRemainder } from '@dereekb/util';
2
+ export { dateFromDateOrTimeNumber, unixTimeNumberForNow, unixTimeNumberFromDate, unixTimeNumberFromDateOrTimeNumber, unixTimeNumberToDate } from '@dereekb/util';
2
3
  import { isDate as isDate$1, startOfMinute, isValid, parseISO, min as min$5, max as max$2, isAfter as isAfter$1, isBefore as isBefore$1, isEqual, isSameDay, isPast, addDays, set as set$1, differenceInDays, startOfMonth, endOfWeek, startOfWeek, endOfMonth, addHours, addMinutes, addMilliseconds, startOfDay, addMonths, addWeeks, endOfDay, endOfHour, startOfHour, endOfMinute, millisecondsToHours, millisecondsToMinutes, differenceInHours, formatDistanceStrict, formatDistance, format as format$1, differenceInMinutes, formatDistanceToNow, parse, getMinutes, getSeconds, getMilliseconds, differenceInMilliseconds, getWeek, getYear, setWeek, getDay, addSeconds } from 'date-fns';
3
4
  import { Expose, Type, Exclude } from 'class-transformer';
4
5
  import { IsDate, IsEnum, IsOptional, IsNumber, Min, registerDecorator, buildMessage, IsString, Matches, IsArray, IsBoolean } from 'class-validator';
@@ -9698,44 +9699,13 @@ function limitDateTime(config) {
9698
9699
  return new LimitDateTimeInstance(config);
9699
9700
  }
9700
9701
 
9701
- // COMPAT: - TODO - Move to util
9702
-
9703
- function unixTimeNumberFromDateOrTimeNumber(input) {
9704
- if (input == null) {
9705
- return input;
9706
- } else if (isDate$1(input)) {
9707
- return unixTimeNumberFromDate(input);
9708
- } else {
9709
- return input;
9710
- }
9711
- }
9712
- function unixTimeNumberForNow() {
9713
- return unixTimeNumberFromDate(new Date());
9714
- }
9715
- function unixTimeNumberFromDate(date) {
9716
- return date != null ? Math.ceil(date.getTime() / 1000) : date;
9717
- }
9718
- function dateFromDateOrTimeNumber(input) {
9719
- if (input == null) {
9720
- return input;
9721
- } else if (isDate$1(input)) {
9722
- return input;
9723
- } else {
9724
- return unixTimeNumberToDate(input);
9725
- }
9726
- }
9727
- function unixTimeNumberToDate(dateTimeNumber) {
9728
- return dateTimeNumber != null ? new Date(dateTimeNumber * 1000) : dateTimeNumber;
9729
- }
9730
-
9731
- /**
9732
- * An object that can expire.
9733
- */
9734
-
9702
+ // MARK: Compat
9735
9703
  /**
9736
9704
  * Returns true if any of the input items have expired.
9737
9705
  *
9738
9706
  * If the list is empty, returns false.
9707
+ *
9708
+ * @deprecated Use ExpirationDetails and checkAtleastOneNotExpired() instead.
9739
9709
  */
9740
9710
  function atleastOneNotExpired(expires) {
9741
9711
  for (const expire of expires) {
@@ -9750,6 +9720,8 @@ function atleastOneNotExpired(expires) {
9750
9720
  * Returns true if any of the input items has expired.
9751
9721
  *
9752
9722
  * If the list is empty, returns the second argument, or true by default.
9723
+ *
9724
+ * @deprecated Use ExpirationDetails and checkAnyHaveExpired() instead.
9753
9725
  */
9754
9726
  function anyHaveExpired(expires, expireIfEmpty = true) {
9755
9727
  if (expires.length === 0) {
@@ -9769,6 +9741,8 @@ function anyHaveExpired(expires, expireIfEmpty = true) {
9769
9741
  * @param timeNumber
9770
9742
  * @param expiresIn
9771
9743
  * @returns
9744
+ *
9745
+ * @deprecated Use isThrottled() or expirationDetails({ expiresFromDate: time, expiresIn }).hasExpired() instead.
9772
9746
  */
9773
9747
  function timeHasExpired(time, expiresIn) {
9774
9748
  return hasExpired(toExpires(time, expiresIn));
@@ -9777,9 +9751,10 @@ function timeHasExpired(time, expiresIn) {
9777
9751
  /**
9778
9752
  * Creates an Expires object from the input date or time number.
9779
9753
  *
9754
+ * @deprecated Use ExpirationDetails instead.
9755
+ *
9780
9756
  * @param timeNumber Number to convert to a date.
9781
- * @param expiresIn If the input number is the initial date, and not the
9782
- * expiration date, this is used to find the expiresAt time.
9757
+ * @param expiresIn If the input number is the initial date, and not the expiration date, this is used to find the expiresAt time.
9783
9758
  */
9784
9759
  function toExpires(time, expiresIn) {
9785
9760
  let expiresAt = dateFromDateOrTimeNumber(time);
@@ -9793,6 +9768,8 @@ function toExpires(time, expiresIn) {
9793
9768
 
9794
9769
  /**
9795
9770
  * Checks whether or not the item has expired. If no expiration date is set, it is considered expired.
9771
+ *
9772
+ * @deprecated Use ExpirationDetails instead.
9796
9773
  */
9797
9774
  function hasExpired(expires) {
9798
9775
  const expiresAt = getExpiration(expires);
@@ -9801,13 +9778,15 @@ function hasExpired(expires) {
9801
9778
 
9802
9779
  /**
9803
9780
  * Returns the expiration date, or a date 1 minute in the past if not defined.
9781
+ *
9782
+ * @deprecated Use ExpirationDetails instead.
9804
9783
  */
9805
9784
  function getExpiration(expires) {
9806
9785
  var _expires$expiresAt;
9807
9786
  return (_expires$expiresAt = expires == null ? void 0 : expires.expiresAt) != null ? _expires$expiresAt : addMinutes(new Date(), -1);
9808
9787
  }
9809
9788
 
9810
- // COMPAT: TODO - Deprecate these classes, and create a new implementation in @dereekb/util with "now" as an option.
9789
+ // TODO: Deprecate and move to @dereekb/rxjs
9811
9790
 
9812
9791
  /**
9813
9792
  * Creates a new Expires object at the current time on emission that will expire in the set amount of time.
@@ -10743,4 +10722,4 @@ class ModelRecurrenceInfoUtility {
10743
10722
  }
10744
10723
  }
10745
10724
 
10746
- 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, allIndexesInDateCellRangesToArray, 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, isBefore, 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, roundDateDownTo, roundDateTimeDown, roundDateTimeDownToSteps, roundDateTo, roundDateToDate, roundDateToUnixDateTimeNumber, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, setOnDateWithTimezoneNormalFunction, 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 };
10725
+ 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, allIndexesInDateCellRangesToArray, 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, 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, isBefore, 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, roundDateDownTo, roundDateTimeDown, roundDateTimeDownToSteps, roundDateTo, roundDateToDate, roundDateToUnixDateTimeNumber, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, setOnDateWithTimezoneNormalFunction, 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, 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": "11.1.3",
3
+ "version": "11.1.5",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -1,7 +1 @@
1
- import { type MaybeNot, type Maybe, type DateOrUnixDateTimeNumber, type UnixDateTimeNumber } from '@dereekb/util';
2
- export declare function unixTimeNumberFromDateOrTimeNumber(input: Maybe<DateOrUnixDateTimeNumber>): Maybe<UnixDateTimeNumber>;
3
- export declare function unixTimeNumberForNow(): UnixDateTimeNumber;
4
- export declare function unixTimeNumberFromDate(date: Date): UnixDateTimeNumber;
5
- export declare function unixTimeNumberFromDate(date: MaybeNot): MaybeNot;
6
- export declare function dateFromDateOrTimeNumber(input: Maybe<DateOrUnixDateTimeNumber>): Maybe<Date>;
7
- export declare function unixTimeNumberToDate(dateTimeNumber: Maybe<UnixDateTimeNumber>): Maybe<Date>;
1
+ export { unixTimeNumberFromDateOrTimeNumber, unixTimeNumberForNow, unixTimeNumberFromDate, dateFromDateOrTimeNumber, unixTimeNumberToDate } from '@dereekb/util';
@@ -1,23 +1,19 @@
1
- import { type DateOrUnixDateTimeNumber, type Maybe, type Milliseconds } from '@dereekb/util';
2
- /**
3
- * An object that can expire.
4
- */
5
- export interface Expires {
6
- /**
7
- * Date this object expires at. If not defined, it has expired.
8
- */
9
- expiresAt?: Maybe<Date>;
10
- }
1
+ import { type Expires, type DateOrUnixDateTimeNumber, type Maybe, type Milliseconds } from '@dereekb/util';
2
+ export type { Expires } from '@dereekb/util';
11
3
  /**
12
4
  * Returns true if any of the input items have expired.
13
5
  *
14
6
  * If the list is empty, returns false.
7
+ *
8
+ * @deprecated Use ExpirationDetails and checkAtleastOneNotExpired() instead.
15
9
  */
16
10
  export declare function atleastOneNotExpired(expires: Maybe<Expires>[]): boolean;
17
11
  /**
18
12
  * Returns true if any of the input items has expired.
19
13
  *
20
14
  * If the list is empty, returns the second argument, or true by default.
15
+ *
16
+ * @deprecated Use ExpirationDetails and checkAnyHaveExpired() instead.
21
17
  */
22
18
  export declare function anyHaveExpired(expires: Maybe<Expires>[], expireIfEmpty?: boolean): boolean;
23
19
  /**
@@ -26,21 +22,28 @@ export declare function anyHaveExpired(expires: Maybe<Expires>[], expireIfEmpty?
26
22
  * @param timeNumber
27
23
  * @param expiresIn
28
24
  * @returns
25
+ *
26
+ * @deprecated Use isThrottled() or expirationDetails({ expiresFromDate: time, expiresIn }).hasExpired() instead.
29
27
  */
30
28
  export declare function timeHasExpired(time: Maybe<DateOrUnixDateTimeNumber>, expiresIn?: Milliseconds): boolean;
31
29
  /**
32
30
  * Creates an Expires object from the input date or time number.
33
31
  *
32
+ * @deprecated Use ExpirationDetails instead.
33
+ *
34
34
  * @param timeNumber Number to convert to a date.
35
- * @param expiresIn If the input number is the initial date, and not the
36
- * expiration date, this is used to find the expiresAt time.
35
+ * @param expiresIn If the input number is the initial date, and not the expiration date, this is used to find the expiresAt time.
37
36
  */
38
37
  export declare function toExpires(time: Maybe<DateOrUnixDateTimeNumber>, expiresIn?: Milliseconds): Expires;
39
38
  /**
40
39
  * Checks whether or not the item has expired. If no expiration date is set, it is considered expired.
40
+ *
41
+ * @deprecated Use ExpirationDetails instead.
41
42
  */
42
43
  export declare function hasExpired(expires: Maybe<Expires>): boolean;
43
44
  /**
44
45
  * Returns the expiration date, or a date 1 minute in the past if not defined.
46
+ *
47
+ * @deprecated Use ExpirationDetails instead.
45
48
  */
46
49
  export declare function getExpiration(expires: Maybe<Expires>): Date;