@dereekb/date 10.1.30 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { MS_IN_HOUR, MS_IN_MINUTE, MINUTES_IN_DAY, isISO8601DateString, filterMaybeValues, asArray, dayOfWeek, sortNumbersAscendingFunction, SORT_VALUE_LESS_THAN, SORT_VALUE_GREATER_THAN, SORT_VALUE_EQUAL, copyArray, compareFnOrder, groupValues, daysOfWeekArray, MS_IN_DAY, minutesToFractionalHours, safeCompareEquality, UTC_TIMEZONE_STRING, isSameNonNullValue, isConsideredUtcTimezoneString, parseISO8601DayStringToUTCDate, cachedGetter, replaceStringsFunction, mapIdentityFunction, repeatString, 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, DATE_NOW_VALUE, roundNumberUpToStep, protectedFactory, MS_IN_SECOND, TimeAM, isLogicalDateStringCode as isLogicalDateStringCode$1, dateFromLogicalDate as dateFromLogicalDate$1, flattenArray, splitJoinRemainder } from '@dereekb/util';
2
- 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, minutesToHours, formatDistanceStrict, formatDistance, format as format$1, differenceInMinutes, formatDistanceToNow, parse, getMinutes, getSeconds, getMilliseconds, differenceInMilliseconds, differenceInHours, getWeek, getYear, setWeek, getDay, addSeconds } from 'date-fns';
1
+ import { MS_IN_HOUR, MS_IN_MINUTE, MINUTES_IN_DAY, isISO8601DateString, filterMaybeValues, 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';
2
+ 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
3
  import { Expose, Type, Exclude } from 'class-transformer';
4
4
  import { IsDate, IsEnum, IsOptional, IsNumber, Min, registerDecorator, buildMessage, IsString, Matches, IsArray, IsBoolean } from 'class-validator';
5
5
  import { utcToZonedTime, format, formatInTimeZone } from 'date-fns-tz';
@@ -2031,6 +2031,8 @@ function utcDayForDate(date) {
2031
2031
  * For example, if it is currently 9PM:
2032
2032
  * - if 10PM on any day is passed then 9PM the next day will be returned.
2033
2033
  * - if 11PM on any day is passed, 11PM today will be returned.
2034
+ *
2035
+ * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
2034
2036
  */
2035
2037
  function takeNextUpcomingTime(date, roundDownToMinute) {
2036
2038
  date = copyHoursAndMinutesFromDateToToday(date, roundDownToMinute);
@@ -2042,6 +2044,8 @@ function takeNextUpcomingTime(date, roundDownToMinute) {
2042
2044
 
2043
2045
  /**
2044
2046
  * Creates a new date and copies the hours/minutes from the previous date and applies them to a date for today.
2047
+ *
2048
+ * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
2045
2049
  */
2046
2050
  function copyHoursAndMinutesFromDateToToday(fromDate, roundDownToMinute) {
2047
2051
  return copyHoursAndMinutesFromDate(new Date(), fromDate, roundDownToMinute);
@@ -2049,6 +2053,8 @@ function copyHoursAndMinutesFromDateToToday(fromDate, roundDownToMinute) {
2049
2053
 
2050
2054
  /**
2051
2055
  * Copies the hours/minutes from now to the target date.
2056
+ *
2057
+ * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
2052
2058
  */
2053
2059
  function copyHoursAndMinutesFromNow(target, roundDownToMinute) {
2054
2060
  return copyHoursAndMinutesFromDate(target, new Date(), roundDownToMinute);
@@ -2056,6 +2062,8 @@ function copyHoursAndMinutesFromNow(target, roundDownToMinute) {
2056
2062
 
2057
2063
  /**
2058
2064
  * Creates a new date and copies the hours/minutes from the input date to the target date.
2065
+ *
2066
+ * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
2059
2067
  */
2060
2068
  function copyHoursAndMinutesFromDate(target, fromDate, roundDownToMinute) {
2061
2069
  return copyHoursAndMinutesToDate({
@@ -2098,23 +2106,59 @@ const copyHoursAndMinutesToToday = copyHoursAndMinutesToDate;
2098
2106
  * Removes the seconds and milliseconds from the input date, or returns the current date with no seconds or milliseconds.
2099
2107
  */
2100
2108
  function roundDownToMinute(date = new Date()) {
2101
- return set$1(date, {
2102
- seconds: 0,
2103
- milliseconds: 0
2104
- });
2109
+ return roundDateDownTo(date, 'minute');
2110
+ }
2111
+
2112
+ /**
2113
+ * Removes the minutes, seconds and milliseconds from the input date, or returns the current date with no mkinutes, seconds or milliseconds.
2114
+ */
2115
+ function roundDownToHour(date = new Date()) {
2116
+ return roundDateDownTo(date, 'hour');
2117
+ }
2118
+ function roundDateDownTo(date, roundToUnit) {
2119
+ return roundDateToDate(date, roundToUnit, 'floor');
2120
+ }
2121
+ function roundDateTo(date, roundToUnit, roundType = 'floor') {
2122
+ return typeof date === 'number' ? roundDateToUnixDateTimeNumber(date, roundToUnit, roundType) : roundDateTo(date, roundToUnit, roundType);
2123
+ }
2124
+ function roundDateToDate(date, roundToUnit, roundType = 'floor') {
2125
+ return new Date(roundDateToUnixDateTimeNumber(date, roundToUnit, roundType));
2105
2126
  }
2106
2127
 
2107
2128
  /**
2108
- * Removes all minutes,
2129
+ * Rounds the input Date value down to the nearest hour, minute, or second.
2130
+ *
2109
2131
  * @param date
2132
+ * @param roundToUnit
2133
+ * @param roundType
2110
2134
  * @returns
2111
2135
  */
2112
- function roundDownToHour(date) {
2113
- return set$1(date, {
2114
- minutes: 0,
2115
- seconds: 0,
2116
- milliseconds: 0
2117
- });
2136
+ function roundDateToUnixDateTimeNumber(date, roundToUnit, roundType = 'floor') {
2137
+ const inputTimeUnrounded = typeof date === 'number' ? date : date.getTime();
2138
+ let roundAmount = 0;
2139
+ switch (roundToUnit) {
2140
+ case 'hour':
2141
+ roundAmount = MS_IN_HOUR;
2142
+ break;
2143
+ case 'second':
2144
+ roundAmount = MS_IN_SECOND;
2145
+ break;
2146
+ default:
2147
+ case 'minute':
2148
+ roundAmount = MS_IN_MINUTE;
2149
+ break;
2150
+ }
2151
+ const secondsAndMs = inputTimeUnrounded % roundAmount; // determine the number of seconds and milliseconds (prepare to round to nearest minute)
2152
+ let roundedTime = inputTimeUnrounded;
2153
+ if (secondsAndMs !== 0) {
2154
+ roundedTime = inputTimeUnrounded - secondsAndMs; // remove seconds and ms as it will throw off the final tzOffset
2155
+
2156
+ if (roundType === 'ceil') {
2157
+ roundedTime += roundAmount; // round up by adding the units
2158
+ }
2159
+ }
2160
+
2161
+ return roundedTime;
2118
2162
  }
2119
2163
  function reduceDatesFunction(reduceDates) {
2120
2164
  return inputDates => {
@@ -3012,6 +3056,70 @@ function isSameDurationSpan(a, b) {
3012
3056
  return safeCompareEquality(a, b, (a, b) => a.duration === b.duration && isSameDate(a.startsAt, b.startsAt));
3013
3057
  }
3014
3058
 
3059
+ const DATE_TODAY_START_VALUE = 'today_start';
3060
+ const DATE_TODAY_END_VALUE = 'today_end';
3061
+ const DATE_WEEK_START_VALUE = 'this_week_start';
3062
+ const DATE_WEEK_END_VALUE = 'this_week_end';
3063
+
3064
+ /**
3065
+ * A date that is characterized by either a known string value, or a Date.
3066
+ */
3067
+
3068
+ function logicalDateStringCodeDateFactory(logicalDateStringCode) {
3069
+ let mapFn;
3070
+ switch (logicalDateStringCode.toLocaleLowerCase()) {
3071
+ case DATE_NOW_VALUE:
3072
+ mapFn = mapIdentityFunction();
3073
+ break;
3074
+ case DATE_TODAY_START_VALUE:
3075
+ mapFn = startOfDay;
3076
+ break;
3077
+ case DATE_TODAY_END_VALUE:
3078
+ mapFn = endOfDay;
3079
+ break;
3080
+ case DATE_WEEK_START_VALUE:
3081
+ mapFn = startOfWeek;
3082
+ break;
3083
+ case DATE_WEEK_END_VALUE:
3084
+ mapFn = endOfWeek;
3085
+ break;
3086
+ default:
3087
+ throw new Error(`Unknown logical date string "${logicalDateStringCode}"`);
3088
+ }
3089
+ return (now = new Date()) => mapFn(now);
3090
+ }
3091
+
3092
+ /**
3093
+ * Returns a Date value from the input LogicalDate.
3094
+ *
3095
+ * @param logicalDate
3096
+ */
3097
+
3098
+ function dateFromLogicalDate(logicalDate, now = new Date()) {
3099
+ let result;
3100
+ if (typeof logicalDate === 'string') {
3101
+ result = logicalDateStringCodeDateFactory(logicalDate)(now);
3102
+ } else {
3103
+ result = logicalDate;
3104
+ }
3105
+ return result;
3106
+ }
3107
+ function isLogicalDateStringCode(logicalDate) {
3108
+ let isLogicalDateStringCode = false;
3109
+ if (typeof logicalDate === 'string') {
3110
+ switch (logicalDate.toLocaleLowerCase()) {
3111
+ case DATE_NOW_VALUE:
3112
+ case DATE_TODAY_START_VALUE:
3113
+ case DATE_TODAY_END_VALUE:
3114
+ case DATE_WEEK_START_VALUE:
3115
+ case DATE_WEEK_END_VALUE:
3116
+ isLogicalDateStringCode = true;
3117
+ break;
3118
+ }
3119
+ }
3120
+ return isLogicalDateStringCode;
3121
+ }
3122
+
3015
3123
  /**
3016
3124
  * Inherited from the RRule library where RRule only deals with UTC date/times, dates going into it must always be in UTC.
3017
3125
  *
@@ -3069,7 +3177,8 @@ function isSameDateTimezoneConversionConfig(a, b) {
3069
3177
  * @returns
3070
3178
  */
3071
3179
  function getCurrentSystemOffsetInMs(date) {
3072
- return minutesToMs(getCurrentSystemOffsetInMinutes(date));
3180
+ const systemTimezone = requireCurrentTimezone();
3181
+ return calculateTimezoneOffset(systemTimezone, date);
3073
3182
  }
3074
3183
 
3075
3184
  /**
@@ -3079,22 +3188,27 @@ function getCurrentSystemOffsetInMs(date) {
3079
3188
  * @returns
3080
3189
  */
3081
3190
  function getCurrentSystemOffsetInHours(date) {
3082
- return minutesToHours(getCurrentSystemOffsetInMinutes(date));
3191
+ return millisecondsToHours(getCurrentSystemOffsetInMs(date));
3083
3192
  }
3084
3193
 
3085
3194
  /**
3086
- * Equivalent to -date.getTimezoneOffset().
3195
+ * Returns the system offset for the input date, in minutes.
3196
+ *
3197
+ * The offset corresponds positively with the UTC offset, so UTC-6 is negative 6 hours, in milliseconds.
3087
3198
  *
3088
3199
  * @param date
3089
3200
  * @returns
3090
3201
  */
3091
3202
  function getCurrentSystemOffsetInMinutes(date) {
3092
- return -date.getTimezoneOffset();
3203
+ return millisecondsToMinutes(getCurrentSystemOffsetInMs(date));
3093
3204
  }
3094
3205
 
3095
3206
  /**
3096
3207
  * Returns the timezone offset in milliseconds.
3097
3208
  *
3209
+ * This is preferential to Date.getTimezoneOffset() or date-fns's getTimezoneOffset() as those are currently wrong for the first
3210
+ * two hours when daylight savings changes.
3211
+ *
3098
3212
  * I.E. GMT-5 = -5 hours (in milliseconds)
3099
3213
  *
3100
3214
  * @param timezone
@@ -3109,14 +3223,20 @@ function calculateTimezoneOffset(timezone, date) {
3109
3223
  const tzOffset = getTimezoneOffset(timezone, date);
3110
3224
  */
3111
3225
 
3112
- // WORKAROUND: This is the current workaround. Performance hit seems negligible for all UI use cases.
3113
- const zoneDate = utcToZonedTime(date, timezone);
3226
+ /*
3227
+ * WORKAROUND: This is the current workaround. Performance hit seems negligible for all UI use cases.
3228
+ */
3229
+
3230
+ // inputTimeDate.setSeconds(0); // NOTE: setting seconds/milliseconds during the daylight savings epoch will also remove an hour
3231
+ // inputTimeDate.setMilliseconds(0); // do not clear seconds in this way.
3232
+
3233
+ const inputTimeUnrounded = date.getTime();
3234
+ const secondsAndMs = inputTimeUnrounded % MS_IN_MINUTE; // determine the number of seconds and milliseconds (prepare to round to nearest minute)
3235
+ const inputTime = inputTimeUnrounded - secondsAndMs; // remove seconds and ms as it will throw off the final tzOffset
3236
+
3237
+ const zoneDate = utcToZonedTime(inputTime, timezone);
3114
3238
  const zoneDateStr = format(zoneDate, 'yyyy-MM-dd HH:mm'); // ignore seconds, etc.
3115
3239
  const zoneDateTime = new Date(zoneDateStr + 'Z').getTime();
3116
- const inputTime = set$1(date, {
3117
- seconds: 0,
3118
- milliseconds: 0
3119
- }).getTime();
3120
3240
  const tzOffset = zoneDateTime - inputTime;
3121
3241
  return tzOffset;
3122
3242
  }
@@ -3179,6 +3299,7 @@ class DateTimezoneUtcNormalInstance {
3179
3299
  this.config = void 0;
3180
3300
  this.hasConversion = void 0;
3181
3301
  this._getOffset = void 0;
3302
+ this._setOnDate = cachedGetter(() => setOnDateWithTimezoneNormalFunction(this));
3182
3303
  let getOffsetInMsFn;
3183
3304
  function useTimezone(timezone) {
3184
3305
  getOffsetInMsFn = date => calculateTimezoneOffset(timezone, date);
@@ -3249,11 +3370,47 @@ class DateTimezoneUtcNormalInstance {
3249
3370
  }
3250
3371
  this.hasConversion = hasConversion;
3251
3372
  }
3252
- _computeOffsetDate(date, from, to) {
3373
+ convertDate(date, from, to) {
3253
3374
  return addMilliseconds(date, this._getOffset(date, from, to));
3254
3375
  }
3255
3376
 
3377
+ /**
3378
+ * A "safer" conversion that will return a "mirrored" offset. Only functional with a "to" UTC value.
3379
+ *
3380
+ * This is required in cases where "reverse" offset will be used and must be consistent so they reverse in both directions the same amount compared to the base.
3381
+ *
3382
+ * For example, when daylight savings changed on November 3, 2024 the offset returned was 5 but to get back to the original an offset of 6 was required.
3383
+ * This is where some contextual data was not being used. This function uses that contextual data to make sure the reverse will be consistent.
3384
+ *
3385
+ * @param baseDate The base date. Should have been derived from the originalContextDate using the convertDate() function
3386
+ * @param originalContextDate Original date used to derive the baseDate.
3387
+ * @param fromOrTo the "type" of date the originalContextDate is
3388
+ */
3389
+ safeMirroredConvertDate(baseDate, originalContextDate, contextType, safeConvert = true) {
3390
+ if (contextType === 'base') {
3391
+ return {
3392
+ date: baseDate,
3393
+ daylightSavingsOffset: 0
3394
+ };
3395
+ } else {
3396
+ const reverseConversion = this.convertDate(baseDate, contextType, 'base');
3397
+
3398
+ // in some cases where daylight savings ends (november 3rd),
3399
+ // the input startsAt time will not be properly recovered due to loss of timezone information
3400
+ // (cannot determine whether or not to apply the -5 or -6 offset after daylight savings ends)
3401
+ const daylightSavingsOffset = safeConvert ? differenceInHours(originalContextDate, reverseConversion) : 0;
3402
+ const date = daylightSavingsOffset ? addHours(reverseConversion, daylightSavingsOffset) : reverseConversion;
3403
+ return {
3404
+ date,
3405
+ daylightSavingsOffset
3406
+ };
3407
+ }
3408
+ }
3409
+
3256
3410
  // MARK: DateTimezoneBaseDateConverter
3411
+ get setOnDate() {
3412
+ return this._setOnDate();
3413
+ }
3257
3414
  getCurrentOffset(date, from, to) {
3258
3415
  return this._getOffset(date, from, to);
3259
3416
  }
@@ -3267,22 +3424,22 @@ class DateTimezoneUtcNormalInstance {
3267
3424
  return transformDateRangeToTimezoneFunction(this, transformType);
3268
3425
  }
3269
3426
  targetDateToBaseDate(date) {
3270
- return this._computeOffsetDate(date, 'target', 'base');
3427
+ return this.convertDate(date, 'target', 'base');
3271
3428
  }
3272
3429
  baseDateToTargetDate(date) {
3273
- return this._computeOffsetDate(date, 'base', 'target');
3430
+ return this.convertDate(date, 'base', 'target');
3274
3431
  }
3275
3432
  baseDateToSystemDate(date) {
3276
- return this._computeOffsetDate(date, 'base', 'system');
3433
+ return this.convertDate(date, 'base', 'system');
3277
3434
  }
3278
3435
  systemDateToBaseDate(date) {
3279
- return this._computeOffsetDate(date, 'system', 'base');
3436
+ return this.convertDate(date, 'system', 'base');
3280
3437
  }
3281
3438
  targetDateToSystemDate(date) {
3282
- return this._computeOffsetDate(date, 'target', 'system');
3439
+ return this.convertDate(date, 'target', 'system');
3283
3440
  }
3284
3441
  systemDateToTargetDate(date) {
3285
- return this._computeOffsetDate(date, 'system', 'target');
3442
+ return this.convertDate(date, 'system', 'target');
3286
3443
  }
3287
3444
  getOffset(date, transform) {
3288
3445
  return this[`${transform}Offset`](date);
@@ -3311,6 +3468,9 @@ class DateTimezoneUtcNormalInstance {
3311
3468
  systemDateToTargetDateOffset(date) {
3312
3469
  return this._getOffset(date, 'system', 'target');
3313
3470
  }
3471
+ conversionOffset(date, from, to) {
3472
+ return this._getOffset(date, from, to);
3473
+ }
3314
3474
  calculateAllOffsets(date, map) {
3315
3475
  return calculateAllConversions(date, this, map);
3316
3476
  }
@@ -3558,6 +3718,90 @@ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
3558
3718
  return startOfDayInTimezoneDayStringFactory(timezone)(day);
3559
3719
  }
3560
3720
 
3721
+ // MARK: Set
3722
+
3723
+ /**
3724
+ * Sets the input values on the input date.
3725
+ */
3726
+
3727
+ /**
3728
+ * Creates a new SetONDateFunction using the input
3729
+ */
3730
+ function setOnDateWithTimezoneNormalFunction(timezone) {
3731
+ const timezoneInstance = dateTimezoneUtcNormal(timezone);
3732
+ const fn = input => {
3733
+ var _copyFrom, _copyFrom2;
3734
+ const {
3735
+ date: inputDate,
3736
+ copyFrom: copyFromInput,
3737
+ copyHours,
3738
+ copyMinutes,
3739
+ inputType: inputInputType,
3740
+ outputType,
3741
+ hours: inputHours,
3742
+ minutes: inputMinutes,
3743
+ roundDownToMinute
3744
+ } = input;
3745
+ const DEFAULT_TYPE = 'target';
3746
+ const inputType = inputInputType != null ? inputInputType : DEFAULT_TYPE;
3747
+ let baseDate;
3748
+ let copyFrom;
3749
+
3750
+ // set copyFrom
3751
+ if (copyFromInput != null) {
3752
+ copyFrom = dateFromLogicalDate(copyFromInput); // read the logical date and set initial value
3753
+
3754
+ // if the input matches the copyFrom values, then skip conversion
3755
+ // this step is also crucial for returning the correct value for daylight savings ending changes
3756
+ if (inputDate != null && isSameDate(copyFrom, inputDate) && copyHours !== false && copyMinutes !== false) {
3757
+ return roundDownToMinute ? roundDateDownTo(inputDate, 'minute') : inputDate;
3758
+ }
3759
+ if (inputType !== 'base') {
3760
+ copyFrom = copyFrom != null ? timezoneInstance.convertDate(copyFrom, 'base', inputType) : undefined;
3761
+ }
3762
+ }
3763
+
3764
+ // set baseDate
3765
+ if (inputDate != null) {
3766
+ if (inputType === 'base') {
3767
+ // use dates directly as UTC
3768
+ baseDate = inputDate;
3769
+ } else {
3770
+ baseDate = timezoneInstance.convertDate(inputDate, 'base', inputType);
3771
+ }
3772
+ } else {
3773
+ baseDate = new Date();
3774
+ }
3775
+ const hours = inputHours != null ? inputHours : copyHours !== false ? (_copyFrom = copyFrom) == null ? void 0 : _copyFrom.getUTCHours() : undefined;
3776
+ const minutes = inputMinutes != null ? inputMinutes : copyMinutes !== false ? (_copyFrom2 = copyFrom) == null ? void 0 : _copyFrom2.getUTCMinutes() : undefined;
3777
+
3778
+ // NOTE: We do the math this way to avoid issues surrounding daylight savings
3779
+ const time = baseDate.getTime();
3780
+ const currentDayMillseconds = time % MS_IN_DAY;
3781
+ const minutesSecondsAndMillseconds = currentDayMillseconds % MS_IN_HOUR;
3782
+ const hoursInTimeInMs = currentDayMillseconds - minutesSecondsAndMillseconds;
3783
+ const secondsAndMilliseconds = minutesSecondsAndMillseconds % MS_IN_MINUTE;
3784
+ const minutesInTime = minutesSecondsAndMillseconds - secondsAndMilliseconds;
3785
+ const nextDay = time - currentDayMillseconds;
3786
+ const nextMinutes = minutes != null ? minutes * MS_IN_MINUTE : minutesInTime;
3787
+ const nextHours = hours != null ? hours * MS_IN_HOUR : hoursInTimeInMs;
3788
+ const nextTime = nextDay + nextHours + nextMinutes + (roundDownToMinute ? 0 : secondsAndMilliseconds);
3789
+ const nextBaseDate = new Date(nextTime);
3790
+ let result = timezoneInstance.convertDate(nextBaseDate, outputType != null ? outputType : inputType, 'base');
3791
+
3792
+ // one more test to limit the "range" of the change
3793
+ // if it is over 1 day, then we can infer there is a timezone mismatch issue. It only occurs in one direction here, so we can safely
3794
+ // infer that the real valid result can be derived by subtracting one day
3795
+ const inputToResultDifferenceInHours = inputDate != null ? differenceInHours(result, inputDate) : 0;
3796
+ if (inputToResultDifferenceInHours >= 24) {
3797
+ result = addHours(result, -24);
3798
+ }
3799
+ return result;
3800
+ };
3801
+ fn._timezoneInstance = timezoneInstance;
3802
+ return fn;
3803
+ }
3804
+
3561
3805
  // MARK: Timezone Utilities
3562
3806
  /**
3563
3807
  * Convenience function for calling copyHoursAndMinutesFromDatesWithTimezoneNormal() with now.
@@ -3567,11 +3811,11 @@ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
3567
3811
  * @returns
3568
3812
  */
3569
3813
  function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
3570
- return copyHoursAndMinutesFromDateWithTimezoneNormal(input, new Date(), timezone);
3814
+ return copyHoursAndMinutesFromDateWithTimezoneNormal(input, 'now', timezone);
3571
3815
  }
3572
3816
 
3573
3817
  /**
3574
- * Converts the two input dates, which are dates in the same timezone/normal but than the current system, using the input DateTimezoneUtcNormalFunctionInput.
3818
+ * Converts the two input dates, which are dates in the same timezone/normal instead of the current system, using the input DateTimezoneUtcNormalFunctionInput.
3575
3819
  *
3576
3820
  * This converts the dates to the system timezone normal, copies the values, then back to the original timezone normal.
3577
3821
  *
@@ -3581,17 +3825,13 @@ function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
3581
3825
  */
3582
3826
  function copyHoursAndMinutesFromDateWithTimezoneNormal(input, copyFrom, timezone) {
3583
3827
  const timezoneInstance = dateTimezoneUtcNormal(timezone);
3584
- const inputInSystemTimezone = timezoneInstance.systemDateToTargetDate(input);
3585
- const copyFromInSystemTimezone = timezoneInstance.systemDateToTargetDate(copyFrom);
3586
-
3587
- // handle the potential system date time offset when the system's timezone offset changes between dates...
3588
- const inputInSystemTimezoneOffset = inputInSystemTimezone.getTimezoneOffset();
3589
- const copyFromInSystemTimezoneOffset = copyFromInSystemTimezone.getTimezoneOffset();
3590
- const offsetDifference = inputInSystemTimezoneOffset - copyFromInSystemTimezoneOffset;
3591
-
3592
- // copy the minutes then add the offset difference to get the appropriate time.
3593
- const copiedInSystemTimezone = addMinutes(copyHoursAndMinutesFromDate(inputInSystemTimezone, copyFromInSystemTimezone), offsetDifference);
3594
- const result = timezoneInstance.targetDateToSystemDate(copiedInSystemTimezone);
3828
+ const result = timezoneInstance.setOnDate({
3829
+ date: input,
3830
+ copyFrom,
3831
+ inputType: 'target',
3832
+ copyHours: true,
3833
+ copyMinutes: true
3834
+ });
3595
3835
  return result;
3596
3836
  }
3597
3837
 
@@ -4827,7 +5067,8 @@ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
4827
5067
  } = durationInput;
4828
5068
 
4829
5069
  // it is important that startsAt is evaluated the base time normal so we can avoid daylight savings issues
4830
- let startsAtInUtc = normalInstance.baseDateToTargetDate(inputStartsAt);
5070
+ const startsAtInUtcInitial = normalInstance.baseDateToTargetDate(inputStartsAt);
5071
+ let startsAtInUtc = startsAtInUtcInitial;
4831
5072
  let numberOfDayBlocks;
4832
5073
  let hasRangeFromInput = false;
4833
5074
  let rangeInUtc;
@@ -4869,13 +5110,21 @@ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
4869
5110
  startsAtInUtc = roundDownToMinute(startsAtInUtc); // clear seconds and milliseconds from startsAt
4870
5111
  }
4871
5112
 
4872
- const lastStartsAtInBaseTimezone = addHours(startsAtInUtc, numberOfDayBlocks * 24); // use addDays so the system (if it experiences daylight savings) can account for change for daylight savings
4873
-
4874
- // calculate end to be the ending date/time of the final duration span
4875
- const end = addMinutes(normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone), duration);
4876
5113
  const utcDay = formatToISO8601DayStringForUTC(startsAtInUtc);
4877
5114
  const start = normalInstance.startOfDayInTargetTimezone(utcDay);
4878
- const startsAt = normalInstance.targetDateToBaseDate(startsAtInUtc);
5115
+ const safeMirror = isEqualDate(startsAtInUtc, startsAtInUtcInitial);
5116
+ const {
5117
+ date: startsAt,
5118
+ daylightSavingsOffset
5119
+ } = normalInstance.safeMirroredConvertDate(startsAtInUtc, inputStartsAt, 'target', safeMirror);
5120
+
5121
+ // calculate end to be the ending date/time of the final duration span
5122
+ const lastStartsAtInBaseTimezone = addHours(startsAtInUtc, numberOfDayBlocks * 24 + daylightSavingsOffset); // use addHours instead of addDays, since addDays will take into account a daylight savings change if the system time changes
5123
+ const lastStartInTarget = normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone);
5124
+ const end = addMinutes(lastStartInTarget, duration);
5125
+
5126
+ // console.log({ lastStartsAtInBaseTimezone, inputStartsAt, startsAtInUtcInitial, startsAtInUtc, startsAt, daylightSavingsOffset, start, lastStartInTarget, end });
5127
+
4879
5128
  return {
4880
5129
  start,
4881
5130
  end,
@@ -5181,11 +5430,25 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
5181
5430
  timezone
5182
5431
  } = timing;
5183
5432
  const normalInstance = dateTimezoneUtcNormal(timezone);
5184
- const startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
5185
- const endInUtcNormal = normalInstance.baseDateToTargetDate(end);
5433
+ let startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
5434
+ let endInUtcNormal = normalInstance.baseDateToTargetDate(end);
5435
+ const {
5436
+ daylightSavingsOffset: startDaylightSavingsOffset
5437
+ } = normalInstance.safeMirroredConvertDate(startsAtInUtcNormal, startsAt, 'target');
5438
+ const {
5439
+ daylightSavingsOffset: endDaylightSavingsOffset
5440
+ } = normalInstance.safeMirroredConvertDate(endInUtcNormal, end, 'target');
5441
+ if (startDaylightSavingsOffset) {
5442
+ startsAtInUtcNormal = addHours(startsAtInUtcNormal, startDaylightSavingsOffset);
5443
+ }
5444
+ if (endDaylightSavingsOffset) {
5445
+ endInUtcNormal = addHours(endInUtcNormal, endDaylightSavingsOffset);
5446
+ }
5186
5447
  const finalMsDifferenceBetweenStartAndEnd = differenceInMilliseconds(endInUtcNormal, startsAtInUtcNormal);
5187
5448
  const duration = finalMsDifferenceBetweenStartAndEnd / MS_IN_MINUTE % MINUTES_IN_DAY || MINUTES_IN_DAY;
5188
- const expectedFinalStartsAt = normalInstance.targetDateToBaseDate(addMinutes(endInUtcNormal, -duration));
5449
+ const expectedFinalStartsAtUtc = addMinutes(endInUtcNormal, -duration);
5450
+ const expectedFinalStartsAt = normalInstance.targetDateToBaseDate(expectedFinalStartsAtUtc); // 2024-11-03T03:00:00.000Z
5451
+
5189
5452
  return {
5190
5453
  duration,
5191
5454
  expectedFinalStartsAt
@@ -8375,70 +8638,6 @@ class DateSet extends HashSet {
8375
8638
  }
8376
8639
  }
8377
8640
 
8378
- const DATE_TODAY_START_VALUE = 'today_start';
8379
- const DATE_TODAY_END_VALUE = 'today_end';
8380
- const DATE_WEEK_START_VALUE = 'this_week_start';
8381
- const DATE_WEEK_END_VALUE = 'this_week_end';
8382
-
8383
- /**
8384
- * A date that is characterized by either a known string value, or a Date.
8385
- */
8386
-
8387
- function logicalDateStringCodeDateFactory(logicalDateStringCode) {
8388
- let mapFn;
8389
- switch (logicalDateStringCode.toLocaleLowerCase()) {
8390
- case DATE_NOW_VALUE:
8391
- mapFn = mapIdentityFunction();
8392
- break;
8393
- case DATE_TODAY_START_VALUE:
8394
- mapFn = startOfDay;
8395
- break;
8396
- case DATE_TODAY_END_VALUE:
8397
- mapFn = endOfDay;
8398
- break;
8399
- case DATE_WEEK_START_VALUE:
8400
- mapFn = startOfWeek;
8401
- break;
8402
- case DATE_WEEK_END_VALUE:
8403
- mapFn = endOfWeek;
8404
- break;
8405
- default:
8406
- throw new Error(`Unknown logical date string "${logicalDateStringCode}"`);
8407
- }
8408
- return (now = new Date()) => mapFn(now);
8409
- }
8410
-
8411
- /**
8412
- * Returns a Date value from the input LogicalDate.
8413
- *
8414
- * @param logicalDate
8415
- */
8416
-
8417
- function dateFromLogicalDate(logicalDate, now = new Date()) {
8418
- let result;
8419
- if (typeof logicalDate === 'string') {
8420
- result = logicalDateStringCodeDateFactory(logicalDate)(now);
8421
- } else {
8422
- result = logicalDate;
8423
- }
8424
- return result;
8425
- }
8426
- function isLogicalDateStringCode(logicalDate) {
8427
- let isLogicalDateStringCode = false;
8428
- if (typeof logicalDate === 'string') {
8429
- switch (logicalDate.toLocaleLowerCase()) {
8430
- case DATE_NOW_VALUE:
8431
- case DATE_TODAY_START_VALUE:
8432
- case DATE_TODAY_END_VALUE:
8433
- case DATE_WEEK_START_VALUE:
8434
- case DATE_WEEK_END_VALUE:
8435
- isLogicalDateStringCode = true;
8436
- break;
8437
- }
8438
- }
8439
- return isLogicalDateStringCode;
8440
- }
8441
-
8442
8641
  // MARK: ISO8601DayStringRange
8443
8642
 
8444
8643
  // MARK: DateOrDayStringRange
@@ -10527,4 +10726,4 @@ class ModelRecurrenceInfoUtility {
10527
10726
  }
10528
10727
  }
10529
10728
 
10530
- 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, 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 };
10729
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "10.1.30",
3
+ "version": "10.2.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",