@dereekb/date 10.1.30 → 11.0.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.cjs.js +506 -266
- package/index.esm.js +318 -118
- package/package.json +1 -1
- package/src/lib/date/date.d.ts +22 -3
- package/src/lib/date/date.timezone.d.ts +95 -9
package/index.cjs.js
CHANGED
|
@@ -1903,8 +1903,8 @@ function toISODateString(input) {
|
|
|
1903
1903
|
* @returns
|
|
1904
1904
|
*/
|
|
1905
1905
|
function guessCurrentTimezone() {
|
|
1906
|
-
var
|
|
1907
|
-
return (
|
|
1906
|
+
var _Intl$DateTimeFormat;
|
|
1907
|
+
return (_Intl$DateTimeFormat = Intl.DateTimeFormat()) == null || (_Intl$DateTimeFormat = _Intl$DateTimeFormat.resolvedOptions()) == null ? void 0 : _Intl$DateTimeFormat.timeZone;
|
|
1908
1908
|
}
|
|
1909
1909
|
/**
|
|
1910
1910
|
* Convenience function for getCurrentTimezone() that asserts a timezone is returned.
|
|
@@ -1928,8 +1928,8 @@ function safeToJsDate(input) {
|
|
|
1928
1928
|
* @returns
|
|
1929
1929
|
*/
|
|
1930
1930
|
function toJsDate(input) {
|
|
1931
|
-
var
|
|
1932
|
-
return isDate(input) ? input : (
|
|
1931
|
+
var _parseJsDateString;
|
|
1932
|
+
return isDate(input) ? input : (_parseJsDateString = parseJsDateString(input)) != null ? _parseJsDateString : new Date(input);
|
|
1933
1933
|
}
|
|
1934
1934
|
function parseJsDateString(input) {
|
|
1935
1935
|
const date = typeof input === 'string' && util.isISO8601DateString(input) ? dateFns.parseISO(input) : new Date(input);
|
|
@@ -1973,6 +1973,8 @@ function utcDayForDate(date) {
|
|
|
1973
1973
|
* For example, if it is currently 9PM:
|
|
1974
1974
|
* - if 10PM on any day is passed then 9PM the next day will be returned.
|
|
1975
1975
|
* - if 11PM on any day is passed, 11PM today will be returned.
|
|
1976
|
+
*
|
|
1977
|
+
* @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.
|
|
1976
1978
|
*/
|
|
1977
1979
|
function takeNextUpcomingTime(date, roundDownToMinute) {
|
|
1978
1980
|
date = copyHoursAndMinutesFromDateToToday(date, roundDownToMinute);
|
|
@@ -1983,18 +1985,24 @@ function takeNextUpcomingTime(date, roundDownToMinute) {
|
|
|
1983
1985
|
}
|
|
1984
1986
|
/**
|
|
1985
1987
|
* Creates a new date and copies the hours/minutes from the previous date and applies them to a date for today.
|
|
1988
|
+
*
|
|
1989
|
+
* @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.
|
|
1986
1990
|
*/
|
|
1987
1991
|
function copyHoursAndMinutesFromDateToToday(fromDate, roundDownToMinute) {
|
|
1988
1992
|
return copyHoursAndMinutesFromDate(new Date(), fromDate, roundDownToMinute);
|
|
1989
1993
|
}
|
|
1990
1994
|
/**
|
|
1991
1995
|
* Copies the hours/minutes from now to the target date.
|
|
1996
|
+
*
|
|
1997
|
+
* @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.
|
|
1992
1998
|
*/
|
|
1993
1999
|
function copyHoursAndMinutesFromNow(target, roundDownToMinute) {
|
|
1994
2000
|
return copyHoursAndMinutesFromDate(target, new Date(), roundDownToMinute);
|
|
1995
2001
|
}
|
|
1996
2002
|
/**
|
|
1997
2003
|
* Creates a new date and copies the hours/minutes from the input date to the target date.
|
|
2004
|
+
*
|
|
2005
|
+
* @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.
|
|
1998
2006
|
*/
|
|
1999
2007
|
function copyHoursAndMinutesFromDate(target, fromDate, roundDownToMinute) {
|
|
2000
2008
|
return copyHoursAndMinutesToDate({
|
|
@@ -2020,11 +2028,11 @@ function copyHoursAndMinutesToDate({
|
|
|
2020
2028
|
removeSeconds,
|
|
2021
2029
|
roundDownToMinute = true
|
|
2022
2030
|
}, target) {
|
|
2023
|
-
return dateFns.set(target
|
|
2031
|
+
return dateFns.set(target != null ? target : new Date(), Object.assign({
|
|
2024
2032
|
hours
|
|
2025
2033
|
}, minutes != null ? {
|
|
2026
2034
|
minutes
|
|
2027
|
-
} : undefined
|
|
2035
|
+
} : undefined, roundDownToMinute || removeSeconds ? {
|
|
2028
2036
|
seconds: 0,
|
|
2029
2037
|
milliseconds: 0
|
|
2030
2038
|
} : undefined));
|
|
@@ -2034,22 +2042,56 @@ const copyHoursAndMinutesToToday = copyHoursAndMinutesToDate;
|
|
|
2034
2042
|
* Removes the seconds and milliseconds from the input date, or returns the current date with no seconds or milliseconds.
|
|
2035
2043
|
*/
|
|
2036
2044
|
function roundDownToMinute(date = new Date()) {
|
|
2037
|
-
return
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2045
|
+
return roundDateDownTo(date, 'minute');
|
|
2046
|
+
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Removes the minutes, seconds and milliseconds from the input date, or returns the current date with no mkinutes, seconds or milliseconds.
|
|
2049
|
+
*/
|
|
2050
|
+
function roundDownToHour(date = new Date()) {
|
|
2051
|
+
return roundDateDownTo(date, 'hour');
|
|
2052
|
+
}
|
|
2053
|
+
function roundDateDownTo(date, roundToUnit) {
|
|
2054
|
+
return roundDateToDate(date, roundToUnit, 'floor');
|
|
2055
|
+
}
|
|
2056
|
+
function roundDateTo(date, roundToUnit, roundType = 'floor') {
|
|
2057
|
+
return typeof date === 'number' ? roundDateToUnixDateTimeNumber(date, roundToUnit, roundType) : roundDateTo(date, roundToUnit, roundType);
|
|
2058
|
+
}
|
|
2059
|
+
function roundDateToDate(date, roundToUnit, roundType = 'floor') {
|
|
2060
|
+
return new Date(roundDateToUnixDateTimeNumber(date, roundToUnit, roundType));
|
|
2041
2061
|
}
|
|
2042
2062
|
/**
|
|
2043
|
-
*
|
|
2063
|
+
* Rounds the input Date value down to the nearest hour, minute, or second.
|
|
2064
|
+
*
|
|
2044
2065
|
* @param date
|
|
2066
|
+
* @param roundToUnit
|
|
2067
|
+
* @param roundType
|
|
2045
2068
|
* @returns
|
|
2046
2069
|
*/
|
|
2047
|
-
function
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2070
|
+
function roundDateToUnixDateTimeNumber(date, roundToUnit, roundType = 'floor') {
|
|
2071
|
+
const inputTimeUnrounded = typeof date === 'number' ? date : date.getTime();
|
|
2072
|
+
let roundAmount = 0;
|
|
2073
|
+
switch (roundToUnit) {
|
|
2074
|
+
case 'hour':
|
|
2075
|
+
roundAmount = util.MS_IN_HOUR;
|
|
2076
|
+
break;
|
|
2077
|
+
case 'second':
|
|
2078
|
+
roundAmount = util.MS_IN_SECOND;
|
|
2079
|
+
break;
|
|
2080
|
+
default:
|
|
2081
|
+
case 'minute':
|
|
2082
|
+
roundAmount = util.MS_IN_MINUTE;
|
|
2083
|
+
break;
|
|
2084
|
+
}
|
|
2085
|
+
const secondsAndMs = inputTimeUnrounded % roundAmount; // determine the number of seconds and milliseconds (prepare to round to nearest minute)
|
|
2086
|
+
let roundedTime = inputTimeUnrounded;
|
|
2087
|
+
if (secondsAndMs !== 0) {
|
|
2088
|
+
roundedTime = inputTimeUnrounded - secondsAndMs; // remove seconds and ms as it will throw off the final tzOffset
|
|
2089
|
+
if (roundType === 'ceil') {
|
|
2090
|
+
roundedTime += roundAmount; // round up by adding the units
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
return roundedTime;
|
|
2053
2095
|
}
|
|
2054
2096
|
function reduceDatesFunction(reduceDates) {
|
|
2055
2097
|
return inputDates => {
|
|
@@ -2208,6 +2250,8 @@ function isDateRangeStart(value) {
|
|
|
2208
2250
|
const sortDateRangeStartAscendingCompareFunction = sortByDateFunction(x => x.start);
|
|
2209
2251
|
class DateRange {
|
|
2210
2252
|
constructor(template) {
|
|
2253
|
+
this.start = void 0;
|
|
2254
|
+
this.end = void 0;
|
|
2211
2255
|
if (template != null) {
|
|
2212
2256
|
this.start = template.start;
|
|
2213
2257
|
this.end = template.end;
|
|
@@ -2256,11 +2300,10 @@ function isFullDateRange(input) {
|
|
|
2256
2300
|
return input.start != null && input.end != null;
|
|
2257
2301
|
}
|
|
2258
2302
|
function dateOrDateRangeToDateRange(startOrDateRange, end) {
|
|
2259
|
-
var _a;
|
|
2260
2303
|
if (isDate(startOrDateRange)) {
|
|
2261
2304
|
return {
|
|
2262
2305
|
start: startOrDateRange,
|
|
2263
|
-
end:
|
|
2306
|
+
end: end != null ? end : startOrDateRange
|
|
2264
2307
|
};
|
|
2265
2308
|
} else {
|
|
2266
2309
|
return startOrDateRange;
|
|
@@ -2342,6 +2385,7 @@ class DateRangeParams {
|
|
|
2342
2385
|
* Date to filter on. If not provided, assumes now.
|
|
2343
2386
|
*/
|
|
2344
2387
|
this.date = new Date();
|
|
2388
|
+
this.distance = void 0;
|
|
2345
2389
|
if (template) {
|
|
2346
2390
|
this.type = template.type;
|
|
2347
2391
|
this.date = template.date;
|
|
@@ -2369,10 +2413,10 @@ function dateRange(input, inputRoundToMinute) {
|
|
|
2369
2413
|
distance: inputDistance,
|
|
2370
2414
|
roundToMinute: inputConfigRoundToMinute = false
|
|
2371
2415
|
} = config;
|
|
2372
|
-
const rawDistance = inputDistance
|
|
2373
|
-
const roundToMinute = inputRoundToMinute
|
|
2374
|
-
let date = inputDate
|
|
2375
|
-
let distance = inputDistance
|
|
2416
|
+
const rawDistance = inputDistance != null ? inputDistance : undefined;
|
|
2417
|
+
const roundToMinute = inputRoundToMinute != null ? inputRoundToMinute : inputConfigRoundToMinute;
|
|
2418
|
+
let date = inputDate != null ? inputDate : new Date();
|
|
2419
|
+
let distance = inputDistance != null ? inputDistance : 1;
|
|
2376
2420
|
let start = date;
|
|
2377
2421
|
let end = date;
|
|
2378
2422
|
if (roundToMinute) {
|
|
@@ -2696,25 +2740,25 @@ function fitUTCDateRangeToDayPeriod(dateRange) {
|
|
|
2696
2740
|
newDistance = util.MS_IN_DAY;
|
|
2697
2741
|
}
|
|
2698
2742
|
const end = dateFns.addMilliseconds(dateRange.start, newDistance);
|
|
2699
|
-
return Object.assign(
|
|
2743
|
+
return Object.assign({}, dateRange, {
|
|
2700
2744
|
start: dateRange.start,
|
|
2701
2745
|
end
|
|
2702
2746
|
});
|
|
2703
2747
|
}
|
|
2704
2748
|
function clampDateFunction(dateRange) {
|
|
2705
|
-
var _a, _b;
|
|
2706
2749
|
let fn;
|
|
2707
2750
|
const hasStartDate = dateRange.start != null;
|
|
2708
2751
|
const hasEndDate = dateRange.end != null;
|
|
2709
2752
|
if (hasStartDate || hasEndDate) {
|
|
2753
|
+
var _dateRange$start, _dateRange$end;
|
|
2710
2754
|
// Start Clamp
|
|
2711
|
-
const startTime = ((
|
|
2755
|
+
const startTime = ((_dateRange$start = dateRange.start) == null ? void 0 : _dateRange$start.getTime()) || 0;
|
|
2712
2756
|
const clampStart = input => {
|
|
2713
2757
|
const time = input.getTime();
|
|
2714
2758
|
return time >= startTime ? input : dateRange.start;
|
|
2715
2759
|
};
|
|
2716
2760
|
// End Clamp
|
|
2717
|
-
const endTime = ((
|
|
2761
|
+
const endTime = ((_dateRange$end = dateRange.end) == null ? void 0 : _dateRange$end.getTime()) || 0;
|
|
2718
2762
|
const clampEnd = input => {
|
|
2719
2763
|
const time = input.getTime();
|
|
2720
2764
|
return time <= endTime ? input : dateRange.end;
|
|
@@ -2806,6 +2850,8 @@ function getDaysOfWeekInDateRange(dateRange) {
|
|
|
2806
2850
|
|
|
2807
2851
|
class DateDurationSpan {
|
|
2808
2852
|
constructor(template) {
|
|
2853
|
+
this.startsAt = void 0;
|
|
2854
|
+
this.duration = void 0;
|
|
2809
2855
|
if (template != null) {
|
|
2810
2856
|
this.startsAt = template.startsAt;
|
|
2811
2857
|
this.duration = template.duration;
|
|
@@ -2840,6 +2886,58 @@ function isSameDurationSpan(a, b) {
|
|
|
2840
2886
|
return util.safeCompareEquality(a, b, (a, b) => a.duration === b.duration && isSameDate(a.startsAt, b.startsAt));
|
|
2841
2887
|
}
|
|
2842
2888
|
|
|
2889
|
+
const DATE_TODAY_START_VALUE = 'today_start';
|
|
2890
|
+
const DATE_TODAY_END_VALUE = 'today_end';
|
|
2891
|
+
const DATE_WEEK_START_VALUE = 'this_week_start';
|
|
2892
|
+
const DATE_WEEK_END_VALUE = 'this_week_end';
|
|
2893
|
+
function logicalDateStringCodeDateFactory(logicalDateStringCode) {
|
|
2894
|
+
let mapFn;
|
|
2895
|
+
switch (logicalDateStringCode.toLocaleLowerCase()) {
|
|
2896
|
+
case util.DATE_NOW_VALUE:
|
|
2897
|
+
mapFn = util.mapIdentityFunction();
|
|
2898
|
+
break;
|
|
2899
|
+
case DATE_TODAY_START_VALUE:
|
|
2900
|
+
mapFn = dateFns.startOfDay;
|
|
2901
|
+
break;
|
|
2902
|
+
case DATE_TODAY_END_VALUE:
|
|
2903
|
+
mapFn = dateFns.endOfDay;
|
|
2904
|
+
break;
|
|
2905
|
+
case DATE_WEEK_START_VALUE:
|
|
2906
|
+
mapFn = dateFns.startOfWeek;
|
|
2907
|
+
break;
|
|
2908
|
+
case DATE_WEEK_END_VALUE:
|
|
2909
|
+
mapFn = dateFns.endOfWeek;
|
|
2910
|
+
break;
|
|
2911
|
+
default:
|
|
2912
|
+
throw new Error(`Unknown logical date string "${logicalDateStringCode}"`);
|
|
2913
|
+
}
|
|
2914
|
+
return (now = new Date()) => mapFn(now);
|
|
2915
|
+
}
|
|
2916
|
+
function dateFromLogicalDate(logicalDate, now = new Date()) {
|
|
2917
|
+
let result;
|
|
2918
|
+
if (typeof logicalDate === 'string') {
|
|
2919
|
+
result = logicalDateStringCodeDateFactory(logicalDate)(now);
|
|
2920
|
+
} else {
|
|
2921
|
+
result = logicalDate;
|
|
2922
|
+
}
|
|
2923
|
+
return result;
|
|
2924
|
+
}
|
|
2925
|
+
function isLogicalDateStringCode(logicalDate) {
|
|
2926
|
+
let isLogicalDateStringCode = false;
|
|
2927
|
+
if (typeof logicalDate === 'string') {
|
|
2928
|
+
switch (logicalDate.toLocaleLowerCase()) {
|
|
2929
|
+
case util.DATE_NOW_VALUE:
|
|
2930
|
+
case DATE_TODAY_START_VALUE:
|
|
2931
|
+
case DATE_TODAY_END_VALUE:
|
|
2932
|
+
case DATE_WEEK_START_VALUE:
|
|
2933
|
+
case DATE_WEEK_END_VALUE:
|
|
2934
|
+
isLogicalDateStringCode = true;
|
|
2935
|
+
break;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
return isLogicalDateStringCode;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2843
2941
|
/**
|
|
2844
2942
|
* Returns true if any DateTimezoneConversionConfig configuration value is provided.
|
|
2845
2943
|
*
|
|
@@ -2874,7 +2972,8 @@ function isSameDateTimezoneConversionConfig(a, b) {
|
|
|
2874
2972
|
* @returns
|
|
2875
2973
|
*/
|
|
2876
2974
|
function getCurrentSystemOffsetInMs(date) {
|
|
2877
|
-
|
|
2975
|
+
const systemTimezone = requireCurrentTimezone();
|
|
2976
|
+
return calculateTimezoneOffset(systemTimezone, date);
|
|
2878
2977
|
}
|
|
2879
2978
|
/**
|
|
2880
2979
|
* Returns the current system time offset in hours.
|
|
@@ -2883,20 +2982,25 @@ function getCurrentSystemOffsetInMs(date) {
|
|
|
2883
2982
|
* @returns
|
|
2884
2983
|
*/
|
|
2885
2984
|
function getCurrentSystemOffsetInHours(date) {
|
|
2886
|
-
return dateFns.
|
|
2985
|
+
return dateFns.millisecondsToHours(getCurrentSystemOffsetInMs(date));
|
|
2887
2986
|
}
|
|
2888
2987
|
/**
|
|
2889
|
-
*
|
|
2988
|
+
* Returns the system offset for the input date, in minutes.
|
|
2989
|
+
*
|
|
2990
|
+
* The offset corresponds positively with the UTC offset, so UTC-6 is negative 6 hours, in milliseconds.
|
|
2890
2991
|
*
|
|
2891
2992
|
* @param date
|
|
2892
2993
|
* @returns
|
|
2893
2994
|
*/
|
|
2894
2995
|
function getCurrentSystemOffsetInMinutes(date) {
|
|
2895
|
-
return
|
|
2996
|
+
return dateFns.millisecondsToMinutes(getCurrentSystemOffsetInMs(date));
|
|
2896
2997
|
}
|
|
2897
2998
|
/**
|
|
2898
2999
|
* Returns the timezone offset in milliseconds.
|
|
2899
3000
|
*
|
|
3001
|
+
* This is preferential to Date.getTimezoneOffset() or date-fns's getTimezoneOffset() as those are currently wrong for the first
|
|
3002
|
+
* two hours when daylight savings changes.
|
|
3003
|
+
*
|
|
2900
3004
|
* I.E. GMT-5 = -5 hours (in milliseconds)
|
|
2901
3005
|
*
|
|
2902
3006
|
* @param timezone
|
|
@@ -2910,14 +3014,17 @@ function calculateTimezoneOffset(timezone, date) {
|
|
|
2910
3014
|
|
|
2911
3015
|
const tzOffset = getTimezoneOffset(timezone, date);
|
|
2912
3016
|
*/
|
|
2913
|
-
|
|
2914
|
-
|
|
3017
|
+
/*
|
|
3018
|
+
* WORKAROUND: This is the current workaround. Performance hit seems negligible for all UI use cases.
|
|
3019
|
+
*/
|
|
3020
|
+
// inputTimeDate.setSeconds(0); // NOTE: setting seconds/milliseconds during the daylight savings epoch will also remove an hour
|
|
3021
|
+
// inputTimeDate.setMilliseconds(0); // do not clear seconds in this way.
|
|
3022
|
+
const inputTimeUnrounded = date.getTime();
|
|
3023
|
+
const secondsAndMs = inputTimeUnrounded % util.MS_IN_MINUTE; // determine the number of seconds and milliseconds (prepare to round to nearest minute)
|
|
3024
|
+
const inputTime = inputTimeUnrounded - secondsAndMs; // remove seconds and ms as it will throw off the final tzOffset
|
|
3025
|
+
const zoneDate = dateFnsTz.utcToZonedTime(inputTime, timezone);
|
|
2915
3026
|
const zoneDateStr = dateFnsTz.format(zoneDate, 'yyyy-MM-dd HH:mm'); // ignore seconds, etc.
|
|
2916
3027
|
const zoneDateTime = new Date(zoneDateStr + 'Z').getTime();
|
|
2917
|
-
const inputTime = dateFns.set(date, {
|
|
2918
|
-
seconds: 0,
|
|
2919
|
-
milliseconds: 0
|
|
2920
|
-
}).getTime();
|
|
2921
3028
|
const tzOffset = zoneDateTime - inputTime;
|
|
2922
3029
|
return tzOffset;
|
|
2923
3030
|
}
|
|
@@ -2973,15 +3080,20 @@ class DateTimezoneUtcNormalInstance {
|
|
|
2973
3080
|
const {
|
|
2974
3081
|
timezone
|
|
2975
3082
|
} = this.config;
|
|
2976
|
-
return timezone
|
|
3083
|
+
return timezone != null ? timezone : this.config.useSystemTimezone ? guessCurrentTimezone() : undefined;
|
|
2977
3084
|
}
|
|
2978
3085
|
constructor(config) {
|
|
3086
|
+
this.config = void 0;
|
|
3087
|
+
this.hasConversion = void 0;
|
|
3088
|
+
this._getOffset = void 0;
|
|
3089
|
+
this._setOnDate = util.cachedGetter(() => setOnDateWithTimezoneNormalFunction(this));
|
|
2979
3090
|
let getOffsetInMsFn;
|
|
2980
3091
|
function useTimezone(timezone) {
|
|
2981
3092
|
getOffsetInMsFn = date => calculateTimezoneOffset(timezone, date);
|
|
2982
3093
|
}
|
|
2983
3094
|
if (config == null || typeof config === 'string') {
|
|
2984
|
-
|
|
3095
|
+
var _config;
|
|
3096
|
+
const timezone = (_config = config) != null ? _config : util.UTC_TIMEZONE_STRING;
|
|
2985
3097
|
config = {
|
|
2986
3098
|
timezone
|
|
2987
3099
|
};
|
|
@@ -3045,10 +3157,44 @@ class DateTimezoneUtcNormalInstance {
|
|
|
3045
3157
|
}
|
|
3046
3158
|
this.hasConversion = hasConversion;
|
|
3047
3159
|
}
|
|
3048
|
-
|
|
3160
|
+
convertDate(date, from, to) {
|
|
3049
3161
|
return dateFns.addMilliseconds(date, this._getOffset(date, from, to));
|
|
3050
3162
|
}
|
|
3163
|
+
/**
|
|
3164
|
+
* A "safer" conversion that will return a "mirrored" offset. Only functional with a "to" UTC value.
|
|
3165
|
+
*
|
|
3166
|
+
* 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.
|
|
3167
|
+
*
|
|
3168
|
+
* 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.
|
|
3169
|
+
* This is where some contextual data was not being used. This function uses that contextual data to make sure the reverse will be consistent.
|
|
3170
|
+
*
|
|
3171
|
+
* @param baseDate The base date. Should have been derived from the originalContextDate using the convertDate() function
|
|
3172
|
+
* @param originalContextDate Original date used to derive the baseDate.
|
|
3173
|
+
* @param fromOrTo the "type" of date the originalContextDate is
|
|
3174
|
+
*/
|
|
3175
|
+
safeMirroredConvertDate(baseDate, originalContextDate, contextType, safeConvert = true) {
|
|
3176
|
+
if (contextType === 'base') {
|
|
3177
|
+
return {
|
|
3178
|
+
date: baseDate,
|
|
3179
|
+
daylightSavingsOffset: 0
|
|
3180
|
+
};
|
|
3181
|
+
} else {
|
|
3182
|
+
const reverseConversion = this.convertDate(baseDate, contextType, 'base');
|
|
3183
|
+
// in some cases where daylight savings ends (november 3rd),
|
|
3184
|
+
// the input startsAt time will not be properly recovered due to loss of timezone information
|
|
3185
|
+
// (cannot determine whether or not to apply the -5 or -6 offset after daylight savings ends)
|
|
3186
|
+
const daylightSavingsOffset = safeConvert ? dateFns.differenceInHours(originalContextDate, reverseConversion) : 0;
|
|
3187
|
+
const date = daylightSavingsOffset ? dateFns.addHours(reverseConversion, daylightSavingsOffset) : reverseConversion;
|
|
3188
|
+
return {
|
|
3189
|
+
date,
|
|
3190
|
+
daylightSavingsOffset
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3051
3194
|
// MARK: DateTimezoneBaseDateConverter
|
|
3195
|
+
get setOnDate() {
|
|
3196
|
+
return this._setOnDate();
|
|
3197
|
+
}
|
|
3052
3198
|
getCurrentOffset(date, from, to) {
|
|
3053
3199
|
return this._getOffset(date, from, to);
|
|
3054
3200
|
}
|
|
@@ -3062,22 +3208,22 @@ class DateTimezoneUtcNormalInstance {
|
|
|
3062
3208
|
return transformDateRangeToTimezoneFunction(this, transformType);
|
|
3063
3209
|
}
|
|
3064
3210
|
targetDateToBaseDate(date) {
|
|
3065
|
-
return this.
|
|
3211
|
+
return this.convertDate(date, 'target', 'base');
|
|
3066
3212
|
}
|
|
3067
3213
|
baseDateToTargetDate(date) {
|
|
3068
|
-
return this.
|
|
3214
|
+
return this.convertDate(date, 'base', 'target');
|
|
3069
3215
|
}
|
|
3070
3216
|
baseDateToSystemDate(date) {
|
|
3071
|
-
return this.
|
|
3217
|
+
return this.convertDate(date, 'base', 'system');
|
|
3072
3218
|
}
|
|
3073
3219
|
systemDateToBaseDate(date) {
|
|
3074
|
-
return this.
|
|
3220
|
+
return this.convertDate(date, 'system', 'base');
|
|
3075
3221
|
}
|
|
3076
3222
|
targetDateToSystemDate(date) {
|
|
3077
|
-
return this.
|
|
3223
|
+
return this.convertDate(date, 'target', 'system');
|
|
3078
3224
|
}
|
|
3079
3225
|
systemDateToTargetDate(date) {
|
|
3080
|
-
return this.
|
|
3226
|
+
return this.convertDate(date, 'system', 'target');
|
|
3081
3227
|
}
|
|
3082
3228
|
getOffset(date, transform) {
|
|
3083
3229
|
return this[`${transform}Offset`](date);
|
|
@@ -3106,6 +3252,9 @@ class DateTimezoneUtcNormalInstance {
|
|
|
3106
3252
|
systemDateToTargetDateOffset(date) {
|
|
3107
3253
|
return this._getOffset(date, 'system', 'target');
|
|
3108
3254
|
}
|
|
3255
|
+
conversionOffset(date, from, to) {
|
|
3256
|
+
return this._getOffset(date, from, to);
|
|
3257
|
+
}
|
|
3109
3258
|
calculateAllOffsets(date, map) {
|
|
3110
3259
|
return calculateAllConversions(date, this, map);
|
|
3111
3260
|
}
|
|
@@ -3136,7 +3285,7 @@ class DateTimezoneUtcNormalInstance {
|
|
|
3136
3285
|
if (typeof date === 'string') {
|
|
3137
3286
|
return util.parseISO8601DayStringToUTCDate(date);
|
|
3138
3287
|
} else {
|
|
3139
|
-
const startOfDayForSystem = dateFns.startOfDay(date
|
|
3288
|
+
const startOfDayForSystem = dateFns.startOfDay(date != null ? date : new Date());
|
|
3140
3289
|
return this.baseDateToSystemDate(startOfDayForSystem);
|
|
3141
3290
|
}
|
|
3142
3291
|
}
|
|
@@ -3162,7 +3311,7 @@ class DateTimezoneUtcNormalInstance {
|
|
|
3162
3311
|
const utcDate = util.parseISO8601DayStringToUTCDate(date);
|
|
3163
3312
|
return this.systemDateToBaseDate(utcDate);
|
|
3164
3313
|
} else {
|
|
3165
|
-
return dateFns.startOfDay(date
|
|
3314
|
+
return dateFns.startOfDay(date != null ? date : new Date());
|
|
3166
3315
|
}
|
|
3167
3316
|
}
|
|
3168
3317
|
/**
|
|
@@ -3317,6 +3466,78 @@ function startOfDayInTimezoneDayStringFactory(timezone) {
|
|
|
3317
3466
|
function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
|
|
3318
3467
|
return startOfDayInTimezoneDayStringFactory(timezone)(day);
|
|
3319
3468
|
}
|
|
3469
|
+
/**
|
|
3470
|
+
* Creates a new SetONDateFunction using the input
|
|
3471
|
+
*/
|
|
3472
|
+
function setOnDateWithTimezoneNormalFunction(timezone) {
|
|
3473
|
+
const timezoneInstance = dateTimezoneUtcNormal(timezone);
|
|
3474
|
+
const fn = input => {
|
|
3475
|
+
var _copyFrom, _copyFrom2;
|
|
3476
|
+
const {
|
|
3477
|
+
date: inputDate,
|
|
3478
|
+
copyFrom: copyFromInput,
|
|
3479
|
+
copyHours,
|
|
3480
|
+
copyMinutes,
|
|
3481
|
+
inputType: inputInputType,
|
|
3482
|
+
outputType,
|
|
3483
|
+
hours: inputHours,
|
|
3484
|
+
minutes: inputMinutes,
|
|
3485
|
+
roundDownToMinute
|
|
3486
|
+
} = input;
|
|
3487
|
+
const DEFAULT_TYPE = 'target';
|
|
3488
|
+
const inputType = inputInputType != null ? inputInputType : DEFAULT_TYPE;
|
|
3489
|
+
let baseDate;
|
|
3490
|
+
let copyFrom;
|
|
3491
|
+
// set copyFrom
|
|
3492
|
+
if (copyFromInput != null) {
|
|
3493
|
+
copyFrom = dateFromLogicalDate(copyFromInput); // read the logical date and set initial value
|
|
3494
|
+
// if the input matches the copyFrom values, then skip conversion
|
|
3495
|
+
// this step is also crucial for returning the correct value for daylight savings ending changes
|
|
3496
|
+
if (inputDate != null && isSameDate(copyFrom, inputDate) && copyHours !== false && copyMinutes !== false) {
|
|
3497
|
+
return roundDownToMinute ? roundDateDownTo(inputDate, 'minute') : inputDate;
|
|
3498
|
+
}
|
|
3499
|
+
if (inputType !== 'base') {
|
|
3500
|
+
copyFrom = copyFrom != null ? timezoneInstance.convertDate(copyFrom, 'base', inputType) : undefined;
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
// set baseDate
|
|
3504
|
+
if (inputDate != null) {
|
|
3505
|
+
if (inputType === 'base') {
|
|
3506
|
+
// use dates directly as UTC
|
|
3507
|
+
baseDate = inputDate;
|
|
3508
|
+
} else {
|
|
3509
|
+
baseDate = timezoneInstance.convertDate(inputDate, 'base', inputType);
|
|
3510
|
+
}
|
|
3511
|
+
} else {
|
|
3512
|
+
baseDate = new Date();
|
|
3513
|
+
}
|
|
3514
|
+
const hours = inputHours != null ? inputHours : copyHours !== false ? (_copyFrom = copyFrom) == null ? void 0 : _copyFrom.getUTCHours() : undefined;
|
|
3515
|
+
const minutes = inputMinutes != null ? inputMinutes : copyMinutes !== false ? (_copyFrom2 = copyFrom) == null ? void 0 : _copyFrom2.getUTCMinutes() : undefined;
|
|
3516
|
+
// NOTE: We do the math this way to avoid issues surrounding daylight savings
|
|
3517
|
+
const time = baseDate.getTime();
|
|
3518
|
+
const currentDayMillseconds = time % util.MS_IN_DAY;
|
|
3519
|
+
const minutesSecondsAndMillseconds = currentDayMillseconds % util.MS_IN_HOUR;
|
|
3520
|
+
const hoursInTimeInMs = currentDayMillseconds - minutesSecondsAndMillseconds;
|
|
3521
|
+
const secondsAndMilliseconds = minutesSecondsAndMillseconds % util.MS_IN_MINUTE;
|
|
3522
|
+
const minutesInTime = minutesSecondsAndMillseconds - secondsAndMilliseconds;
|
|
3523
|
+
const nextDay = time - currentDayMillseconds;
|
|
3524
|
+
const nextMinutes = minutes != null ? minutes * util.MS_IN_MINUTE : minutesInTime;
|
|
3525
|
+
const nextHours = hours != null ? hours * util.MS_IN_HOUR : hoursInTimeInMs;
|
|
3526
|
+
const nextTime = nextDay + nextHours + nextMinutes + (roundDownToMinute ? 0 : secondsAndMilliseconds);
|
|
3527
|
+
const nextBaseDate = new Date(nextTime);
|
|
3528
|
+
let result = timezoneInstance.convertDate(nextBaseDate, outputType != null ? outputType : inputType, 'base');
|
|
3529
|
+
// one more test to limit the "range" of the change
|
|
3530
|
+
// 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
|
|
3531
|
+
// infer that the real valid result can be derived by subtracting one day
|
|
3532
|
+
const inputToResultDifferenceInHours = inputDate != null ? dateFns.differenceInHours(result, inputDate) : 0;
|
|
3533
|
+
if (inputToResultDifferenceInHours >= 24) {
|
|
3534
|
+
result = dateFns.addHours(result, -24);
|
|
3535
|
+
}
|
|
3536
|
+
return result;
|
|
3537
|
+
};
|
|
3538
|
+
fn._timezoneInstance = timezoneInstance;
|
|
3539
|
+
return fn;
|
|
3540
|
+
}
|
|
3320
3541
|
// MARK: Timezone Utilities
|
|
3321
3542
|
/**
|
|
3322
3543
|
* Convenience function for calling copyHoursAndMinutesFromDatesWithTimezoneNormal() with now.
|
|
@@ -3326,10 +3547,10 @@ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
|
|
|
3326
3547
|
* @returns
|
|
3327
3548
|
*/
|
|
3328
3549
|
function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
|
|
3329
|
-
return copyHoursAndMinutesFromDateWithTimezoneNormal(input,
|
|
3550
|
+
return copyHoursAndMinutesFromDateWithTimezoneNormal(input, 'now', timezone);
|
|
3330
3551
|
}
|
|
3331
3552
|
/**
|
|
3332
|
-
* Converts the two input dates, which are dates in the same timezone/normal
|
|
3553
|
+
* Converts the two input dates, which are dates in the same timezone/normal instead of the current system, using the input DateTimezoneUtcNormalFunctionInput.
|
|
3333
3554
|
*
|
|
3334
3555
|
* This converts the dates to the system timezone normal, copies the values, then back to the original timezone normal.
|
|
3335
3556
|
*
|
|
@@ -3339,15 +3560,13 @@ function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
|
|
|
3339
3560
|
*/
|
|
3340
3561
|
function copyHoursAndMinutesFromDateWithTimezoneNormal(input, copyFrom, timezone) {
|
|
3341
3562
|
const timezoneInstance = dateTimezoneUtcNormal(timezone);
|
|
3342
|
-
const
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
const copiedInSystemTimezone = dateFns.addMinutes(copyHoursAndMinutesFromDate(inputInSystemTimezone, copyFromInSystemTimezone), offsetDifference);
|
|
3350
|
-
const result = timezoneInstance.targetDateToSystemDate(copiedInSystemTimezone);
|
|
3563
|
+
const result = timezoneInstance.setOnDate({
|
|
3564
|
+
date: input,
|
|
3565
|
+
copyFrom,
|
|
3566
|
+
inputType: 'target',
|
|
3567
|
+
copyHours: true,
|
|
3568
|
+
copyMinutes: true
|
|
3569
|
+
});
|
|
3351
3570
|
return result;
|
|
3352
3571
|
}
|
|
3353
3572
|
|
|
@@ -3826,8 +4045,8 @@ const allTimezoneInfos = util.cachedGetter(() => {
|
|
|
3826
4045
|
return allTimezoneStrings().map(x => timezoneStringToTimezoneInfo(x, now));
|
|
3827
4046
|
});
|
|
3828
4047
|
function timezoneInfoForSystem() {
|
|
3829
|
-
var
|
|
3830
|
-
return timezoneStringToTimezoneInfo((
|
|
4048
|
+
var _guessCurrentTimezone;
|
|
4049
|
+
return timezoneStringToTimezoneInfo((_guessCurrentTimezone = guessCurrentTimezone()) != null ? _guessCurrentTimezone : util.UTC_TIMEZONE_STRING);
|
|
3831
4050
|
}
|
|
3832
4051
|
function getTimezoneAbbreviation(timezone, date = new Date()) {
|
|
3833
4052
|
return timezone === util.UTC_TIMEZONE_STRING ? util.UTC_TIMEZONE_STRING : timezone ? dateFnsTz.formatInTimeZone(date, timezone, 'zzz') : 'UKNOWN';
|
|
@@ -3878,7 +4097,7 @@ function IsKnownTimezone(validationOptions) {
|
|
|
3878
4097
|
options: validationOptions,
|
|
3879
4098
|
validator: {
|
|
3880
4099
|
validate: isKnownTimezone,
|
|
3881
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args
|
|
4100
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args == null ? void 0 : args.value}" is not a known timezone.`, validationOptions)
|
|
3882
4101
|
}
|
|
3883
4102
|
});
|
|
3884
4103
|
};
|
|
@@ -3892,7 +4111,7 @@ function IsKnownTimezone(validationOptions) {
|
|
|
3892
4111
|
*/
|
|
3893
4112
|
function fitDateRangeToDayPeriodFunction(timezone) {
|
|
3894
4113
|
const transformFn = transformDateRangeInTimezoneNormalFunction(timezone, 'baseDateToTargetDate');
|
|
3895
|
-
const fn = input => Object.assign(
|
|
4114
|
+
const fn = input => Object.assign({}, input, transformFn(input, fitUTCDateRangeToDayPeriod));
|
|
3896
4115
|
fn._timezoneInstance = transformFn._timezoneInstance;
|
|
3897
4116
|
return fn;
|
|
3898
4117
|
}
|
|
@@ -4065,7 +4284,7 @@ function formatDateRangeDistanceFunction(inputConfig) {
|
|
|
4065
4284
|
timeRangeTimezone,
|
|
4066
4285
|
strict = false
|
|
4067
4286
|
} = inputConfig;
|
|
4068
|
-
const transform = inputTransform
|
|
4287
|
+
const transform = inputTransform != null ? inputTransform : onlyTimeRange ? timeRangeTimezone ? fitDateRangeToDayPeriodFunction(timeRangeTimezone) : fitUTCDateRangeToDayPeriod : util.mapIdentityFunction();
|
|
4069
4288
|
return (startOrDateRange, inputEnd) => {
|
|
4070
4289
|
const dateRange = transform(dateOrDateRangeToDateRange(startOrDateRange, inputEnd));
|
|
4071
4290
|
const {
|
|
@@ -4128,6 +4347,7 @@ function formatToDayTimeRangeString(startOrDateRange, end) {
|
|
|
4128
4347
|
});
|
|
4129
4348
|
}
|
|
4130
4349
|
function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
4350
|
+
var _inputFormat;
|
|
4131
4351
|
let end;
|
|
4132
4352
|
if (endOrFormat != null) {
|
|
4133
4353
|
if (typeof endOrFormat === 'function') {
|
|
@@ -4136,7 +4356,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
4136
4356
|
end = endOrFormat;
|
|
4137
4357
|
}
|
|
4138
4358
|
}
|
|
4139
|
-
const format =
|
|
4359
|
+
const format = (_inputFormat = inputFormat) != null ? _inputFormat : formatToShortDateString;
|
|
4140
4360
|
return formatDateRange(dateOrDateRangeToDateRange(startOrDateRange, end), {
|
|
4141
4361
|
format,
|
|
4142
4362
|
simplifySameDate: true
|
|
@@ -4278,6 +4498,7 @@ function isValidDateCellIndex(input) {
|
|
|
4278
4498
|
}
|
|
4279
4499
|
class DateCell {
|
|
4280
4500
|
constructor(template) {
|
|
4501
|
+
this.i = void 0;
|
|
4281
4502
|
if (template) {
|
|
4282
4503
|
this.i = template.i;
|
|
4283
4504
|
}
|
|
@@ -4302,8 +4523,8 @@ function dateCell(dateCellOrIndex) {
|
|
|
4302
4523
|
* @returns
|
|
4303
4524
|
*/
|
|
4304
4525
|
function dateCellTimingStartsAtForStartOfDay(input = {}) {
|
|
4305
|
-
var
|
|
4306
|
-
const timezone = (
|
|
4526
|
+
var _input$timezone;
|
|
4527
|
+
const timezone = (_input$timezone = input.timezone) != null ? _input$timezone : requireCurrentTimezone();
|
|
4307
4528
|
let startsAt = dateFns.startOfDay(new Date());
|
|
4308
4529
|
if (input.timezone != null) {
|
|
4309
4530
|
startsAt = dateTimezoneUtcNormal(timezone).targetDateToSystemDate(startsAt);
|
|
@@ -4316,6 +4537,8 @@ function dateCellTimingStartsAtForStartOfDay(input = {}) {
|
|
|
4316
4537
|
class DateCellTiming extends DateDurationSpan {
|
|
4317
4538
|
constructor(template) {
|
|
4318
4539
|
super(template);
|
|
4540
|
+
this.end = void 0;
|
|
4541
|
+
this.timezone = void 0;
|
|
4319
4542
|
if (template) {
|
|
4320
4543
|
this.end = template.end;
|
|
4321
4544
|
this.timezone = template.timezone;
|
|
@@ -4414,7 +4637,8 @@ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
|
|
|
4414
4637
|
startsAt: inputStartsAt
|
|
4415
4638
|
} = durationInput;
|
|
4416
4639
|
// it is important that startsAt is evaluated the base time normal so we can avoid daylight savings issues
|
|
4417
|
-
|
|
4640
|
+
const startsAtInUtcInitial = normalInstance.baseDateToTargetDate(inputStartsAt);
|
|
4641
|
+
let startsAtInUtc = startsAtInUtcInitial;
|
|
4418
4642
|
let numberOfDayBlocks;
|
|
4419
4643
|
let hasRangeFromInput = false;
|
|
4420
4644
|
let rangeInUtc;
|
|
@@ -4456,12 +4680,18 @@ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
|
|
|
4456
4680
|
startsAtInUtc = roundDownToMinute(startsAtInUtc); // clear seconds and milliseconds from startsAt
|
|
4457
4681
|
}
|
|
4458
4682
|
|
|
4459
|
-
const lastStartsAtInBaseTimezone = dateFns.addHours(startsAtInUtc, numberOfDayBlocks * 24); // use addDays so the system (if it experiences daylight savings) can account for change for daylight savings
|
|
4460
|
-
// calculate end to be the ending date/time of the final duration span
|
|
4461
|
-
const end = dateFns.addMinutes(normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone), duration);
|
|
4462
4683
|
const utcDay = formatToISO8601DayStringForUTC(startsAtInUtc);
|
|
4463
4684
|
const start = normalInstance.startOfDayInTargetTimezone(utcDay);
|
|
4464
|
-
const
|
|
4685
|
+
const safeMirror = util.isEqualDate(startsAtInUtc, startsAtInUtcInitial);
|
|
4686
|
+
const {
|
|
4687
|
+
date: startsAt,
|
|
4688
|
+
daylightSavingsOffset
|
|
4689
|
+
} = normalInstance.safeMirroredConvertDate(startsAtInUtc, inputStartsAt, 'target', safeMirror);
|
|
4690
|
+
// calculate end to be the ending date/time of the final duration span
|
|
4691
|
+
const lastStartsAtInBaseTimezone = dateFns.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
|
|
4692
|
+
const lastStartInTarget = normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone);
|
|
4693
|
+
const end = dateFns.addMinutes(lastStartInTarget, duration);
|
|
4694
|
+
// console.log({ lastStartsAtInBaseTimezone, inputStartsAt, startsAtInUtcInitial, startsAtInUtc, startsAt, daylightSavingsOffset, start, lastStartInTarget, end });
|
|
4465
4695
|
return {
|
|
4466
4696
|
start,
|
|
4467
4697
|
end,
|
|
@@ -4613,7 +4843,7 @@ function updateDateCellTimingToTimezoneFunction(timezone) {
|
|
|
4613
4843
|
const {
|
|
4614
4844
|
startsAt
|
|
4615
4845
|
} = timing;
|
|
4616
|
-
const newTiming = Object.assign(
|
|
4846
|
+
const newTiming = Object.assign({}, timing, {
|
|
4617
4847
|
start: dateCellTimingStart({
|
|
4618
4848
|
startsAt,
|
|
4619
4849
|
timezone
|
|
@@ -4668,7 +4898,7 @@ function shiftDateCellTimingToTimezoneFunction(timezoneInput) {
|
|
|
4668
4898
|
const endNormal = inputTimingNormalInstance.baseDateToTargetDate(timing.end);
|
|
4669
4899
|
const startsAt = normalInstance.targetDateToBaseDate(startsAtNormal);
|
|
4670
4900
|
const end = normalInstance.targetDateToBaseDate(endNormal);
|
|
4671
|
-
const newTiming = Object.assign(
|
|
4901
|
+
const newTiming = Object.assign({}, timing, {
|
|
4672
4902
|
start: dateCellTimingStart({
|
|
4673
4903
|
startsAt,
|
|
4674
4904
|
timezone
|
|
@@ -4723,11 +4953,24 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
4723
4953
|
timezone
|
|
4724
4954
|
} = timing;
|
|
4725
4955
|
const normalInstance = dateTimezoneUtcNormal(timezone);
|
|
4726
|
-
|
|
4727
|
-
|
|
4956
|
+
let startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
|
|
4957
|
+
let endInUtcNormal = normalInstance.baseDateToTargetDate(end);
|
|
4958
|
+
const {
|
|
4959
|
+
daylightSavingsOffset: startDaylightSavingsOffset
|
|
4960
|
+
} = normalInstance.safeMirroredConvertDate(startsAtInUtcNormal, startsAt, 'target');
|
|
4961
|
+
const {
|
|
4962
|
+
daylightSavingsOffset: endDaylightSavingsOffset
|
|
4963
|
+
} = normalInstance.safeMirroredConvertDate(endInUtcNormal, end, 'target');
|
|
4964
|
+
if (startDaylightSavingsOffset) {
|
|
4965
|
+
startsAtInUtcNormal = dateFns.addHours(startsAtInUtcNormal, startDaylightSavingsOffset);
|
|
4966
|
+
}
|
|
4967
|
+
if (endDaylightSavingsOffset) {
|
|
4968
|
+
endInUtcNormal = dateFns.addHours(endInUtcNormal, endDaylightSavingsOffset);
|
|
4969
|
+
}
|
|
4728
4970
|
const finalMsDifferenceBetweenStartAndEnd = dateFns.differenceInMilliseconds(endInUtcNormal, startsAtInUtcNormal);
|
|
4729
4971
|
const duration = finalMsDifferenceBetweenStartAndEnd / util.MS_IN_MINUTE % util.MINUTES_IN_DAY || util.MINUTES_IN_DAY;
|
|
4730
|
-
const
|
|
4972
|
+
const expectedFinalStartsAtUtc = dateFns.addMinutes(endInUtcNormal, -duration);
|
|
4973
|
+
const expectedFinalStartsAt = normalInstance.targetDateToBaseDate(expectedFinalStartsAtUtc); // 2024-11-03T03:00:00.000Z
|
|
4731
4974
|
return {
|
|
4732
4975
|
duration,
|
|
4733
4976
|
expectedFinalStartsAt
|
|
@@ -4855,6 +5098,7 @@ function isValidFullDateCellTiming(timing) {
|
|
|
4855
5098
|
class DateCellRange extends DateCell {
|
|
4856
5099
|
constructor(template) {
|
|
4857
5100
|
super(template);
|
|
5101
|
+
this.to = void 0;
|
|
4858
5102
|
if (template) {
|
|
4859
5103
|
this.to = template.to;
|
|
4860
5104
|
}
|
|
@@ -4922,8 +5166,8 @@ function isValidDateCellRangeSeries(input) {
|
|
|
4922
5166
|
* The input range is not expected to be sorted.
|
|
4923
5167
|
*/
|
|
4924
5168
|
function getLeastDateCellIndexInDateCellRanges(input) {
|
|
4925
|
-
var
|
|
4926
|
-
return (
|
|
5169
|
+
var _getLeastAndGreatestD, _getLeastAndGreatestD2;
|
|
5170
|
+
return (_getLeastAndGreatestD = (_getLeastAndGreatestD2 = getLeastAndGreatestDateCellIndexInDateCellRanges(input)) == null ? void 0 : _getLeastAndGreatestD2.leastIndex) != null ? _getLeastAndGreatestD : 0;
|
|
4927
5171
|
}
|
|
4928
5172
|
/**
|
|
4929
5173
|
* Returns the largest index between all the input date block ranges. Returns 0 by default.
|
|
@@ -4931,8 +5175,8 @@ function getLeastDateCellIndexInDateCellRanges(input) {
|
|
|
4931
5175
|
* The input range is not expected to be sorted.
|
|
4932
5176
|
*/
|
|
4933
5177
|
function getGreatestDateCellIndexInDateCellRanges(input) {
|
|
4934
|
-
var
|
|
4935
|
-
return (
|
|
5178
|
+
var _getLeastAndGreatestD3, _getLeastAndGreatestD4;
|
|
5179
|
+
return (_getLeastAndGreatestD3 = (_getLeastAndGreatestD4 = getLeastAndGreatestDateCellIndexInDateCellRanges(input)) == null ? void 0 : _getLeastAndGreatestD4.greatestIndex) != null ? _getLeastAndGreatestD3 : 0;
|
|
4936
5180
|
}
|
|
4937
5181
|
/**
|
|
4938
5182
|
* Returns the largest index between all the input date block ranges. Returns null if the input is empty.
|
|
@@ -4977,7 +5221,7 @@ function getLeastAndGreatestDateCellIndexInDateCellRanges(input) {
|
|
|
4977
5221
|
function dateCellRange(i, to) {
|
|
4978
5222
|
return {
|
|
4979
5223
|
i,
|
|
4980
|
-
to: to
|
|
5224
|
+
to: to != null ? to : i
|
|
4981
5225
|
};
|
|
4982
5226
|
}
|
|
4983
5227
|
/**
|
|
@@ -5014,9 +5258,9 @@ function dateCellRangeIncludedByRangeFunction(inputRange) {
|
|
|
5014
5258
|
to
|
|
5015
5259
|
} = dateCellRangeWithRange(inputRange);
|
|
5016
5260
|
return input => {
|
|
5017
|
-
var
|
|
5261
|
+
var _range$to;
|
|
5018
5262
|
const range = dateCellRangeWithRange(input);
|
|
5019
|
-
return range.i <= i && ((
|
|
5263
|
+
return range.i <= i && ((_range$to = range == null ? void 0 : range.to) != null ? _range$to : range.i) >= to;
|
|
5020
5264
|
};
|
|
5021
5265
|
}
|
|
5022
5266
|
/**
|
|
@@ -5031,9 +5275,9 @@ function dateCellRangeOverlapsRangeFunction(inputRange) {
|
|
|
5031
5275
|
to
|
|
5032
5276
|
} = dateCellRangeWithRange(inputRange);
|
|
5033
5277
|
return input => {
|
|
5034
|
-
var
|
|
5278
|
+
var _range$to2;
|
|
5035
5279
|
const range = dateCellRangeWithRange(input);
|
|
5036
|
-
return range.i <= to && ((
|
|
5280
|
+
return range.i <= to && ((_range$to2 = range == null ? void 0 : range.to) != null ? _range$to2 : range.i) >= i;
|
|
5037
5281
|
};
|
|
5038
5282
|
}
|
|
5039
5283
|
/**
|
|
@@ -5055,8 +5299,8 @@ function dateCellRangeOverlapsRange(rangeA, rangeB) {
|
|
|
5055
5299
|
*/
|
|
5056
5300
|
function sortDateCellRangeAndSizeFunction() {
|
|
5057
5301
|
return (a, b) => {
|
|
5058
|
-
var _a, _b;
|
|
5059
|
-
return a.i - b.i || ((_a = a.to)
|
|
5302
|
+
var _a$to, _b$to;
|
|
5303
|
+
return a.i - b.i || ((_a$to = a.to) != null ? _a$to : a.i) - ((_b$to = b.to) != null ? _b$to : b.i);
|
|
5060
5304
|
};
|
|
5061
5305
|
}
|
|
5062
5306
|
/**
|
|
@@ -5074,7 +5318,6 @@ function sortDateCellRanges(input) {
|
|
|
5074
5318
|
* @param input
|
|
5075
5319
|
*/
|
|
5076
5320
|
function groupToDateCellRanges(input) {
|
|
5077
|
-
var _a;
|
|
5078
5321
|
if (input.length === 0) {
|
|
5079
5322
|
return [];
|
|
5080
5323
|
}
|
|
@@ -5087,7 +5330,7 @@ function groupToDateCellRanges(input) {
|
|
|
5087
5330
|
} = blocks[blocksArrayIndex];
|
|
5088
5331
|
return {
|
|
5089
5332
|
i,
|
|
5090
|
-
to: to
|
|
5333
|
+
to: to != null ? to : i
|
|
5091
5334
|
};
|
|
5092
5335
|
}
|
|
5093
5336
|
// start at the first block
|
|
@@ -5097,8 +5340,9 @@ function groupToDateCellRanges(input) {
|
|
|
5097
5340
|
const block = blocks[i];
|
|
5098
5341
|
const isContinuous = block.i <= current.to + 1;
|
|
5099
5342
|
if (isContinuous) {
|
|
5343
|
+
var _blocks$i$to;
|
|
5100
5344
|
// extend the current block.
|
|
5101
|
-
current.to = (
|
|
5345
|
+
current.to = (_blocks$i$to = blocks[i].to) != null ? _blocks$i$to : blocks[i].i;
|
|
5102
5346
|
} else {
|
|
5103
5347
|
// complete/create new block.
|
|
5104
5348
|
results.push(current);
|
|
@@ -5155,14 +5399,14 @@ function filterDateCellsInDateCellRange(blocks, range) {
|
|
|
5155
5399
|
function isDateCellWithinDateCellRangeFunction(inputRange) {
|
|
5156
5400
|
const range = dateCellRangeWithRange(inputRange);
|
|
5157
5401
|
return input => {
|
|
5158
|
-
var _a;
|
|
5159
5402
|
if (typeof input === 'number') {
|
|
5160
5403
|
input = {
|
|
5161
5404
|
i: input
|
|
5162
5405
|
};
|
|
5163
5406
|
}
|
|
5164
5407
|
if (input.i >= range.i) {
|
|
5165
|
-
|
|
5408
|
+
var _input$to;
|
|
5409
|
+
const to = (_input$to = input.to) != null ? _input$to : input.i;
|
|
5166
5410
|
return to <= range.to;
|
|
5167
5411
|
}
|
|
5168
5412
|
return false;
|
|
@@ -5228,7 +5472,7 @@ function dateCellRangesFullyCoverDateCellRangeFunction(ranges) {
|
|
|
5228
5472
|
* @param input
|
|
5229
5473
|
*/
|
|
5230
5474
|
function getNextDateCellTimingIndex(input) {
|
|
5231
|
-
var
|
|
5475
|
+
var _relativeStateGroups$, _relativeStateGroups$2, _relativeStateGroups$3;
|
|
5232
5476
|
const {
|
|
5233
5477
|
ranges,
|
|
5234
5478
|
currentIndex
|
|
@@ -5236,9 +5480,9 @@ function getNextDateCellTimingIndex(input) {
|
|
|
5236
5480
|
const relativeStateGroups = util.makeValuesGroupMap(util.asArray(ranges), range => {
|
|
5237
5481
|
return dateRelativeStateForDateCellRangeComparedToIndex(range, currentIndex);
|
|
5238
5482
|
});
|
|
5239
|
-
const pastResults = (
|
|
5240
|
-
const presentResults = (
|
|
5241
|
-
const futureResults = (
|
|
5483
|
+
const pastResults = (_relativeStateGroups$ = relativeStateGroups.get('past')) != null ? _relativeStateGroups$ : [];
|
|
5484
|
+
const presentResults = (_relativeStateGroups$2 = relativeStateGroups.get('present')) != null ? _relativeStateGroups$2 : [];
|
|
5485
|
+
const futureResults = (_relativeStateGroups$3 = relativeStateGroups.get('future')) != null ? _relativeStateGroups$3 : [];
|
|
5242
5486
|
const currentResult = presentResults[0];
|
|
5243
5487
|
let nextResult;
|
|
5244
5488
|
let nextIndex = currentIndex + 1;
|
|
@@ -5293,7 +5537,7 @@ function dateRelativeStateForDateCellRangeComparedToIndex(range, nowIndex) {
|
|
|
5293
5537
|
*/
|
|
5294
5538
|
function expandDateCellRange(block) {
|
|
5295
5539
|
return util.range(block.i, dateCellEndIndex(block) + 1).map(i => {
|
|
5296
|
-
return Object.assign(
|
|
5540
|
+
return Object.assign({}, block, {
|
|
5297
5541
|
i,
|
|
5298
5542
|
to: i
|
|
5299
5543
|
}); // copy block, set to as i
|
|
@@ -5314,22 +5558,22 @@ function dateCellRangeHasRange(input) {
|
|
|
5314
5558
|
* @returns
|
|
5315
5559
|
*/
|
|
5316
5560
|
function dateCellEndIndex(input) {
|
|
5317
|
-
var
|
|
5318
|
-
return (
|
|
5561
|
+
var _input$to2;
|
|
5562
|
+
return (_input$to2 = input.to) != null ? _input$to2 : input.i;
|
|
5319
5563
|
}
|
|
5320
5564
|
/**
|
|
5321
5565
|
* Groups all input DateCellRange or UniqueDateCell values into a UniqueDateCellRangeGroup value amd sorts the input.
|
|
5322
5566
|
*/
|
|
5323
5567
|
function groupUniqueDateCells(input) {
|
|
5324
|
-
var _a;
|
|
5325
5568
|
const blocks = sortDateCellRanges([...input]);
|
|
5326
5569
|
const i = 0;
|
|
5327
5570
|
let to;
|
|
5328
5571
|
if (blocks.length === 0) {
|
|
5329
5572
|
to = i;
|
|
5330
5573
|
} else {
|
|
5574
|
+
var _lastBlock$to;
|
|
5331
5575
|
const lastBlock = util.lastValue(blocks);
|
|
5332
|
-
to = (
|
|
5576
|
+
to = (_lastBlock$to = lastBlock.to) != null ? _lastBlock$to : lastBlock.i;
|
|
5333
5577
|
}
|
|
5334
5578
|
return {
|
|
5335
5579
|
i,
|
|
@@ -5345,8 +5589,8 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5345
5589
|
fillFactory: inputFillFactory,
|
|
5346
5590
|
retainOnOverlap: inputRetainOnOverlap
|
|
5347
5591
|
} = config;
|
|
5348
|
-
const retainOnOverlap = inputRetainOnOverlap
|
|
5349
|
-
const maxAllowedIndex = endAtIndex
|
|
5592
|
+
const retainOnOverlap = inputRetainOnOverlap != null ? inputRetainOnOverlap : 'next';
|
|
5593
|
+
const maxAllowedIndex = endAtIndex != null ? endAtIndex : Number.MAX_SAFE_INTEGER;
|
|
5350
5594
|
const fillFactory = inputFillFactory;
|
|
5351
5595
|
if (!fillFactory && fill === 'fill') {
|
|
5352
5596
|
throw new Error('fillFactory is required when fillOption is "fill".');
|
|
@@ -5383,7 +5627,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5383
5627
|
const to = Math.min(inputTo, maxAllowedIndex) || 0;
|
|
5384
5628
|
let block = null;
|
|
5385
5629
|
if (inputBlock != null) {
|
|
5386
|
-
block = Object.assign(
|
|
5630
|
+
block = Object.assign({}, inputBlock, {
|
|
5387
5631
|
i,
|
|
5388
5632
|
to
|
|
5389
5633
|
});
|
|
@@ -5406,7 +5650,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5406
5650
|
to
|
|
5407
5651
|
};
|
|
5408
5652
|
const block = fillFactory(dateCellRange);
|
|
5409
|
-
addBlockWithRange(block, i, to
|
|
5653
|
+
addBlockWithRange(block, i, to != null ? to : i);
|
|
5410
5654
|
} else if (fill === 'empty') ; else if (blocks.length > 0) {
|
|
5411
5655
|
// only extend if one or more blocks have been pushed
|
|
5412
5656
|
const blockToExtend = util.lastValue(blocks);
|
|
@@ -5489,7 +5733,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5489
5733
|
// add current
|
|
5490
5734
|
addBlockWithRange(current.block, currentNextIndex, currentEndIndex);
|
|
5491
5735
|
// change next to start at the next range
|
|
5492
|
-
continueToNext(Object.assign(
|
|
5736
|
+
continueToNext(Object.assign({}, next.block, {
|
|
5493
5737
|
i: currentEndIndex + 1,
|
|
5494
5738
|
to: nextEndIndex
|
|
5495
5739
|
}), next.priority);
|
|
@@ -5509,7 +5753,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5509
5753
|
// add the next item first since it overwrites the current
|
|
5510
5754
|
addBlockWithRange(next.block, nextStartIndex, nextEndIndex);
|
|
5511
5755
|
// continue with the current item as next.
|
|
5512
|
-
continueToNext(Object.assign(
|
|
5756
|
+
continueToNext(Object.assign({}, current.block, {
|
|
5513
5757
|
i: nextEndIndex + 1,
|
|
5514
5758
|
to: currentEndIndex
|
|
5515
5759
|
}), current.priority);
|
|
@@ -5524,7 +5768,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5524
5768
|
addBlockWithRange(current.block, currentNextIndex, currentEndIndex);
|
|
5525
5769
|
if (nextEndIndex > currentEndIndex) {
|
|
5526
5770
|
// change next to start at the next range
|
|
5527
|
-
continueToNext(Object.assign(
|
|
5771
|
+
continueToNext(Object.assign({}, next.block, {
|
|
5528
5772
|
i: currentEndIndex + 1,
|
|
5529
5773
|
to: nextEndIndex
|
|
5530
5774
|
}), next.priority);
|
|
@@ -5540,7 +5784,7 @@ function expandUniqueDateCellsFunction(config) {
|
|
|
5540
5784
|
// add the next
|
|
5541
5785
|
addBlockWithRange(next.block, nextStartIndex, nextEndIndex);
|
|
5542
5786
|
// continue with the current
|
|
5543
|
-
continueToNext(Object.assign(
|
|
5787
|
+
continueToNext(Object.assign({}, current.block, {
|
|
5544
5788
|
i: nextEndIndex + 1,
|
|
5545
5789
|
to: currentEndIndex
|
|
5546
5790
|
}), next.priority);
|
|
@@ -5594,7 +5838,7 @@ function dateCellRangeOfTimingFactory(config) {
|
|
|
5594
5838
|
limitToCompletedIndexes: onlyIncludeIfComplete = false,
|
|
5595
5839
|
now: inputNowGetter
|
|
5596
5840
|
} = config;
|
|
5597
|
-
const nowGetter = util.asGetter(inputNowGetter
|
|
5841
|
+
const nowGetter = util.asGetter(inputNowGetter != null ? inputNowGetter : () => new Date());
|
|
5598
5842
|
const indexFactory = dateCellTimingRelativeIndexFactory(timing);
|
|
5599
5843
|
const minIndex = fitToTimingRange ? 0 : Number.MIN_SAFE_INTEGER;
|
|
5600
5844
|
const maxIndex = fitToTimingRange ? indexFactory(indexFactory._timing.end) : Number.MAX_SAFE_INTEGER;
|
|
@@ -5637,9 +5881,9 @@ function dateCellRangeOfTimingFactory(config) {
|
|
|
5637
5881
|
const {
|
|
5638
5882
|
i: start,
|
|
5639
5883
|
to: end
|
|
5640
|
-
} = input
|
|
5641
|
-
const startIndex = indexFactory(start
|
|
5642
|
-
const endIndex = indexFactory(end
|
|
5884
|
+
} = input != null ? input : {};
|
|
5885
|
+
const startIndex = indexFactory(start != null ? start : 0);
|
|
5886
|
+
const endIndex = indexFactory(end != null ? end : nowGetter());
|
|
5643
5887
|
const maxIndex = getCurrentMaxIndex();
|
|
5644
5888
|
const to = Math.min(maxIndex, endIndex); // calculate to first to get the max value
|
|
5645
5889
|
const i = Math.min(Math.max(minIndex, startIndex), to); // i should never be greater than to
|
|
@@ -5669,11 +5913,11 @@ function dateCellRangeOfTiming(config, input) {
|
|
|
5669
5913
|
* By default fitToTimingRange is true.
|
|
5670
5914
|
*/
|
|
5671
5915
|
function dateCellTimingCompletedTimeRange(timing, config) {
|
|
5672
|
-
var
|
|
5916
|
+
var _config$fitToTimingRa;
|
|
5673
5917
|
return dateCellRangeOfTiming({
|
|
5674
5918
|
timing,
|
|
5675
|
-
now: config
|
|
5676
|
-
fitToTimingRange: (
|
|
5919
|
+
now: config == null ? void 0 : config.now,
|
|
5920
|
+
fitToTimingRange: (_config$fitToTimingRa = config == null ? void 0 : config.fitToTimingRange) != null ? _config$fitToTimingRa : true,
|
|
5677
5921
|
limitToCompletedIndexes: true
|
|
5678
5922
|
});
|
|
5679
5923
|
}
|
|
@@ -5691,10 +5935,10 @@ function dateCellTimingLatestCompletedIndex(timing, now) {
|
|
|
5691
5935
|
}).to;
|
|
5692
5936
|
}
|
|
5693
5937
|
function dateCellRangeToDateCellIndexRange(range) {
|
|
5694
|
-
var
|
|
5938
|
+
var _range$to;
|
|
5695
5939
|
return {
|
|
5696
5940
|
minIndex: range.i,
|
|
5697
|
-
maxIndex: ((
|
|
5941
|
+
maxIndex: ((_range$to = range.to) != null ? _range$to : range.i) + 1
|
|
5698
5942
|
};
|
|
5699
5943
|
}
|
|
5700
5944
|
function dateCellIndexRangeToDateCellRange(range) {
|
|
@@ -5788,7 +6032,7 @@ function dateCellTimingExpansionFactory(config) {
|
|
|
5788
6032
|
});
|
|
5789
6033
|
const filter = util.mergeFilterFunctions(x => isInRange(x.i), inputFilter);
|
|
5790
6034
|
const startsAtFactory = dateCellTimingStartsAtDateFactory(timing);
|
|
5791
|
-
const durationSpanFilter = inputDurationSpanFilter
|
|
6035
|
+
const durationSpanFilter = inputDurationSpanFilter != null ? inputDurationSpanFilter : () => true;
|
|
5792
6036
|
return input => {
|
|
5793
6037
|
const blocks = Array.isArray(input) ? input : input.blocks;
|
|
5794
6038
|
const spans = [];
|
|
@@ -5798,7 +6042,7 @@ function dateCellTimingExpansionFactory(config) {
|
|
|
5798
6042
|
blocksEvaluated += 1;
|
|
5799
6043
|
if (filter(block, blockIndex)) {
|
|
5800
6044
|
const startsAt = startsAtFactory(block.i);
|
|
5801
|
-
const durationSpan = Object.assign(
|
|
6045
|
+
const durationSpan = Object.assign({}, block, {
|
|
5802
6046
|
startsAt,
|
|
5803
6047
|
duration
|
|
5804
6048
|
});
|
|
@@ -5816,7 +6060,7 @@ function dateCellTimingExpansionFactory(config) {
|
|
|
5816
6060
|
if (dateCellRangeHasRange(block)) {
|
|
5817
6061
|
// Expands the block's range as if it is at a single index
|
|
5818
6062
|
util.range(block.i, block.to + 1).findIndex(i => {
|
|
5819
|
-
const blockAtIndex = Object.assign(
|
|
6063
|
+
const blockAtIndex = Object.assign({}, block, {
|
|
5820
6064
|
i,
|
|
5821
6065
|
to: i
|
|
5822
6066
|
}); // copy block, set to as i
|
|
@@ -5856,7 +6100,7 @@ function dateCellDayTimingInfoFactory(config) {
|
|
|
5856
6100
|
const date = typeof input === 'number' ? dayFactory(input) : input;
|
|
5857
6101
|
const dayIndex = indexFactory(input);
|
|
5858
6102
|
const isInRange = checkIsInRange(dayIndex);
|
|
5859
|
-
const now = inputNow
|
|
6103
|
+
const now = inputNow != null ? inputNow : date;
|
|
5860
6104
|
const startsAtOnDay = startsAtFactory(dayIndex); // convert back to the proper date
|
|
5861
6105
|
const endsAtOnDay = dateFns.addMinutes(startsAtOnDay, duration);
|
|
5862
6106
|
const potentiallyInProgress = !dateFns.isAfter(startsAtOnDay, now); // is potentially in progress if the now is equal-to or after the start time.
|
|
@@ -5961,13 +6205,13 @@ function dateCellTimingRelativeIndexArrayFactory(indexFactory) {
|
|
|
5961
6205
|
const inputAsArray = util.asArray(input);
|
|
5962
6206
|
const result = [];
|
|
5963
6207
|
inputAsArray.forEach(value => {
|
|
5964
|
-
var _a;
|
|
5965
6208
|
let resultIndexes;
|
|
5966
6209
|
if (typeof value === 'object' && !util.isDate(value)) {
|
|
5967
6210
|
if (isDateRange(value)) {
|
|
5968
6211
|
resultIndexes = util.range(indexFactory(value.start), indexFactory(value.end) + 1);
|
|
5969
6212
|
} else {
|
|
5970
|
-
|
|
6213
|
+
var _value$to;
|
|
6214
|
+
resultIndexes = util.range(value.i, ((_value$to = value.to) != null ? _value$to : value.i) + 1);
|
|
5971
6215
|
}
|
|
5972
6216
|
} else {
|
|
5973
6217
|
resultIndexes = [indexFactory(value)];
|
|
@@ -6005,7 +6249,7 @@ function dateCellTimingDateFactory(timing) {
|
|
|
6005
6249
|
if (util.isDate(input)) {
|
|
6006
6250
|
return input;
|
|
6007
6251
|
} else {
|
|
6008
|
-
const now = inputNow
|
|
6252
|
+
const now = inputNow != null ? inputNow : new Date();
|
|
6009
6253
|
const nowHours = now.getUTCHours();
|
|
6010
6254
|
const utcStartDateWithNowTime = new Date(Date.UTC(utcStartDate.getUTCFullYear(), utcStartDate.getUTCMonth(), utcStartDate.getUTCDate(), nowHours, now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()));
|
|
6011
6255
|
// if the current hours are less than the UTC offset hours, then bump one extra day forward to be sure we're in the correct day.
|
|
@@ -6304,7 +6548,7 @@ function modifyDateCellsToFitRangeFunction(range) {
|
|
|
6304
6548
|
const asRange = dateCellRangeWithRange(x);
|
|
6305
6549
|
const rangesOverlap = overlapsRange(asRange);
|
|
6306
6550
|
if (rangesOverlap) {
|
|
6307
|
-
result = Object.assign(
|
|
6551
|
+
result = Object.assign({}, x, {
|
|
6308
6552
|
i: Math.max(i, asRange.i),
|
|
6309
6553
|
to: Math.min(to, asRange.to) // should be no larger than to
|
|
6310
6554
|
});
|
|
@@ -6419,7 +6663,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6419
6663
|
* @returns
|
|
6420
6664
|
*/
|
|
6421
6665
|
function yearWeekCodeFactory(config) {
|
|
6422
|
-
const normal = yearWeekCodeDateTimezoneInstance(config
|
|
6666
|
+
const normal = yearWeekCodeDateTimezoneInstance(config == null ? void 0 : config.timezone);
|
|
6423
6667
|
const result = (dateOrYear, inputWeek) => {
|
|
6424
6668
|
let pair;
|
|
6425
6669
|
if (isDate(dateOrYear)) {
|
|
@@ -6522,7 +6766,7 @@ function yearWeekCodeForCalendarMonthFactory(factory = yearWeekCodeFactory()) {
|
|
|
6522
6766
|
* @returns
|
|
6523
6767
|
*/
|
|
6524
6768
|
function yearWeekCodeDateFactory(config) {
|
|
6525
|
-
const normal = yearWeekCodeDateTimezoneInstance(config
|
|
6769
|
+
const normal = yearWeekCodeDateTimezoneInstance(config == null ? void 0 : config.timezone);
|
|
6526
6770
|
return yearWeekCode => {
|
|
6527
6771
|
const pair = yearWeekCodePair(yearWeekCode);
|
|
6528
6772
|
const utcYearDate = new Date(Date.UTC(pair.year, 0, 1, 0, 0, 0, 0));
|
|
@@ -6831,7 +7075,7 @@ function rawDateCellScheduleDayCodes(input) {
|
|
|
6831
7075
|
* @returns
|
|
6832
7076
|
*/
|
|
6833
7077
|
function dateCellScheduleDayCodeFactory(config) {
|
|
6834
|
-
const normal = yearWeekCodeDateTimezoneInstance(config
|
|
7078
|
+
const normal = yearWeekCodeDateTimezoneInstance(config == null ? void 0 : config.timezone);
|
|
6835
7079
|
return date => {
|
|
6836
7080
|
const target = normal.systemDateToTargetDate(date);
|
|
6837
7081
|
const day = dateFns.getDay(target);
|
|
@@ -6864,15 +7108,18 @@ function isDateCellSchedule(input) {
|
|
|
6864
7108
|
return false;
|
|
6865
7109
|
}
|
|
6866
7110
|
function isSameDateCellSchedule(a, b) {
|
|
6867
|
-
var _a, _b, _c, _d;
|
|
6868
7111
|
if (a && b) {
|
|
6869
|
-
|
|
7112
|
+
var _a$ex, _b$ex, _a$d, _b$d;
|
|
7113
|
+
return a.w === b.w && util.iterablesAreSetEquivalent((_a$ex = a.ex) != null ? _a$ex : [], (_b$ex = b.ex) != null ? _b$ex : []) && util.iterablesAreSetEquivalent((_a$d = a.d) != null ? _a$d : [], (_b$d = b.d) != null ? _b$d : []);
|
|
6870
7114
|
} else {
|
|
6871
7115
|
return a == b;
|
|
6872
7116
|
}
|
|
6873
7117
|
}
|
|
6874
7118
|
class DateCellSchedule {
|
|
6875
7119
|
constructor(template) {
|
|
7120
|
+
this.w = void 0;
|
|
7121
|
+
this.d = void 0;
|
|
7122
|
+
this.ex = void 0;
|
|
6876
7123
|
if (template) {
|
|
6877
7124
|
this.w = template.w;
|
|
6878
7125
|
this.d = template.d;
|
|
@@ -6950,7 +7197,7 @@ function dateCellScheduleDateRange(input) {
|
|
|
6950
7197
|
end: inputEnd,
|
|
6951
7198
|
timezone: inputTimezone
|
|
6952
7199
|
} = input;
|
|
6953
|
-
const timezone = inputTimezone
|
|
7200
|
+
const timezone = inputTimezone != null ? inputTimezone : requireCurrentTimezone(); // treat input as the current timezone
|
|
6954
7201
|
const normalInstance = dateTimezoneUtcNormal(timezone);
|
|
6955
7202
|
let start;
|
|
6956
7203
|
let end;
|
|
@@ -6968,7 +7215,7 @@ function dateCellScheduleDateRange(input) {
|
|
|
6968
7215
|
}
|
|
6969
7216
|
}
|
|
6970
7217
|
// set the end value
|
|
6971
|
-
end = inputEnd
|
|
7218
|
+
end = inputEnd != null ? inputEnd : dateFns.addMinutes(start, 1); // default the end to one minute after the start
|
|
6972
7219
|
return {
|
|
6973
7220
|
w,
|
|
6974
7221
|
ex,
|
|
@@ -7083,8 +7330,8 @@ function fullDateCellScheduleRange(input) {
|
|
|
7083
7330
|
} else {
|
|
7084
7331
|
// fill in the blanks for the date range
|
|
7085
7332
|
const initialDateRange = dateCellScheduleDateRange(dateCellScheduleRange);
|
|
7086
|
-
initialDateRange.startsAt = inputStartsAt
|
|
7087
|
-
initialDateRange.duration = inputDuration
|
|
7333
|
+
initialDateRange.startsAt = inputStartsAt != null ? inputStartsAt : initialDateRange.start;
|
|
7334
|
+
initialDateRange.duration = inputDuration != null ? inputDuration : DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION; // copy duration and startsAt
|
|
7088
7335
|
initialFullDateRange = initialDateRange;
|
|
7089
7336
|
if (isDateCellScheduleStartOfDayDateRange(dateCellScheduleRange)) {
|
|
7090
7337
|
const startOfLastDay = initialFullDateRange.end;
|
|
@@ -7098,8 +7345,8 @@ function fullDateCellScheduleRange(input) {
|
|
|
7098
7345
|
fullDateCellTiming = updateDateCellTimingWithDateCellTimingEvent({
|
|
7099
7346
|
timing: initialFullDateRange,
|
|
7100
7347
|
event: {
|
|
7101
|
-
startsAt: inputDefaultStartsAtTime
|
|
7102
|
-
duration: inputDefaultDuration
|
|
7348
|
+
startsAt: inputDefaultStartsAtTime != null ? inputDefaultStartsAtTime : initialFullDateRange.startsAt,
|
|
7349
|
+
duration: inputDefaultDuration != null ? inputDefaultDuration : initialFullDateRange.duration
|
|
7103
7350
|
},
|
|
7104
7351
|
// flag to replace the necessary items
|
|
7105
7352
|
replaceStartsAt: needsStartsAtAdjustment,
|
|
@@ -7148,10 +7395,10 @@ function dateCellScheduleDateFilter(config) {
|
|
|
7148
7395
|
setStartAsMinDate = true,
|
|
7149
7396
|
minMaxDateRange
|
|
7150
7397
|
} = config;
|
|
7151
|
-
const timezone = inputTimezone
|
|
7398
|
+
const timezone = inputTimezone != null ? inputTimezone : requireCurrentTimezone(); // if the timezone is not provided, assume the startsAt is a system timezone normal.
|
|
7152
7399
|
const normalInstance = dateTimezoneUtcNormal(timezone);
|
|
7153
7400
|
// derive the startsAt time for the range. If not provided, defaults to inputStart, or midnight today in the target timezone.
|
|
7154
|
-
const startsAt = inputStartsAt != null ? inputStartsAt : inputStart
|
|
7401
|
+
const startsAt = inputStartsAt != null ? inputStartsAt : inputStart != null ? inputStart : normalInstance.startOfDayInTargetTimezone();
|
|
7155
7402
|
const allowedDays = expandDateCellScheduleDayCodesToDayOfWeekSet(w);
|
|
7156
7403
|
const startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
|
|
7157
7404
|
const firstDateDay = dateFns.getDay(startsAtInSystem);
|
|
@@ -7173,8 +7420,8 @@ function dateCellScheduleDateFilter(config) {
|
|
|
7173
7420
|
end = expectedFinalStartsAt;
|
|
7174
7421
|
}
|
|
7175
7422
|
const indexFloor = setStartAsMinDate ? 0 : Number.MIN_SAFE_INTEGER;
|
|
7176
|
-
const minAllowedIndex = (minMaxDateRange
|
|
7177
|
-
const maxAllowedIndex = end != null ? _dateCellTimingRelativeIndexFactory(end) : (minMaxDateRange
|
|
7423
|
+
const minAllowedIndex = (minMaxDateRange == null ? void 0 : minMaxDateRange.start) != null ? Math.max(indexFloor, _dateCellTimingRelativeIndexFactory(minMaxDateRange.start)) : indexFloor; // start date should be the min inde
|
|
7424
|
+
const maxAllowedIndex = end != null ? _dateCellTimingRelativeIndexFactory(end) : (minMaxDateRange == null ? void 0 : minMaxDateRange.end) != null ? _dateCellTimingRelativeIndexFactory(minMaxDateRange.end) : Number.MAX_SAFE_INTEGER; // max "to" value
|
|
7178
7425
|
const includedIndexes = new Set(config.d);
|
|
7179
7426
|
const excludedIndexes = new Set(config.ex);
|
|
7180
7427
|
const fn = input => {
|
|
@@ -7337,7 +7584,7 @@ function expandDateCellScheduleRange(input) {
|
|
|
7337
7584
|
startsAtTime,
|
|
7338
7585
|
updateWithDefaults: true
|
|
7339
7586
|
});
|
|
7340
|
-
return expandDateCellSchedule(Object.assign(
|
|
7587
|
+
return expandDateCellSchedule(Object.assign({}, input, {
|
|
7341
7588
|
schedule: fullDateRange,
|
|
7342
7589
|
timing: fullDateRange
|
|
7343
7590
|
}));
|
|
@@ -7369,7 +7616,7 @@ function IsValidDateCellTiming(validationOptions) {
|
|
|
7369
7616
|
options: validationOptions,
|
|
7370
7617
|
validator: {
|
|
7371
7618
|
validate: isValidDateCellTiming,
|
|
7372
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args
|
|
7619
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args == null ? void 0 : args.value)}" is not a valid DateCellTiming.`, validationOptions)
|
|
7373
7620
|
}
|
|
7374
7621
|
});
|
|
7375
7622
|
};
|
|
@@ -7386,7 +7633,7 @@ function IsValidDateCellRange(validationOptions) {
|
|
|
7386
7633
|
options: validationOptions,
|
|
7387
7634
|
validator: {
|
|
7388
7635
|
validate: isValidDateCellRange,
|
|
7389
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args
|
|
7636
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args == null ? void 0 : args.value)}" is not a valid DateCellRange.`, validationOptions)
|
|
7390
7637
|
}
|
|
7391
7638
|
});
|
|
7392
7639
|
};
|
|
@@ -7403,7 +7650,7 @@ function IsValidDateCellRangeSeries(validationOptions) {
|
|
|
7403
7650
|
options: validationOptions,
|
|
7404
7651
|
validator: {
|
|
7405
7652
|
validate: isValidDateCellRangeSeries,
|
|
7406
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args
|
|
7653
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${JSON.stringify(args == null ? void 0 : args.value)}" is not a valid DateCellRange series. Items must be sorted in ascending order and have no repeat indexes.`, validationOptions)
|
|
7407
7654
|
}
|
|
7408
7655
|
});
|
|
7409
7656
|
};
|
|
@@ -7437,7 +7684,7 @@ class CalendarDate extends DateDurationSpan {
|
|
|
7437
7684
|
}
|
|
7438
7685
|
__decorate([classTransformer.Expose(), classValidator.IsEnum(exports.CalendarDateType), __metadata("design:type", String)], CalendarDate.prototype, "type", void 0);
|
|
7439
7686
|
function calendarDateFactory(config) {
|
|
7440
|
-
const normalConfig = (config
|
|
7687
|
+
const normalConfig = (config == null ? void 0 : config.timezone) === undefined ? {
|
|
7441
7688
|
useSystemTimezone: true
|
|
7442
7689
|
} : {
|
|
7443
7690
|
timezone: config.timezone ? config.timezone : undefined
|
|
@@ -7472,58 +7719,6 @@ class DateSet extends util.HashSet {
|
|
|
7472
7719
|
}
|
|
7473
7720
|
}
|
|
7474
7721
|
|
|
7475
|
-
const DATE_TODAY_START_VALUE = 'today_start';
|
|
7476
|
-
const DATE_TODAY_END_VALUE = 'today_end';
|
|
7477
|
-
const DATE_WEEK_START_VALUE = 'this_week_start';
|
|
7478
|
-
const DATE_WEEK_END_VALUE = 'this_week_end';
|
|
7479
|
-
function logicalDateStringCodeDateFactory(logicalDateStringCode) {
|
|
7480
|
-
let mapFn;
|
|
7481
|
-
switch (logicalDateStringCode.toLocaleLowerCase()) {
|
|
7482
|
-
case util.DATE_NOW_VALUE:
|
|
7483
|
-
mapFn = util.mapIdentityFunction();
|
|
7484
|
-
break;
|
|
7485
|
-
case DATE_TODAY_START_VALUE:
|
|
7486
|
-
mapFn = dateFns.startOfDay;
|
|
7487
|
-
break;
|
|
7488
|
-
case DATE_TODAY_END_VALUE:
|
|
7489
|
-
mapFn = dateFns.endOfDay;
|
|
7490
|
-
break;
|
|
7491
|
-
case DATE_WEEK_START_VALUE:
|
|
7492
|
-
mapFn = dateFns.startOfWeek;
|
|
7493
|
-
break;
|
|
7494
|
-
case DATE_WEEK_END_VALUE:
|
|
7495
|
-
mapFn = dateFns.endOfWeek;
|
|
7496
|
-
break;
|
|
7497
|
-
default:
|
|
7498
|
-
throw new Error(`Unknown logical date string "${logicalDateStringCode}"`);
|
|
7499
|
-
}
|
|
7500
|
-
return (now = new Date()) => mapFn(now);
|
|
7501
|
-
}
|
|
7502
|
-
function dateFromLogicalDate(logicalDate, now = new Date()) {
|
|
7503
|
-
let result;
|
|
7504
|
-
if (typeof logicalDate === 'string') {
|
|
7505
|
-
result = logicalDateStringCodeDateFactory(logicalDate)(now);
|
|
7506
|
-
} else {
|
|
7507
|
-
result = logicalDate;
|
|
7508
|
-
}
|
|
7509
|
-
return result;
|
|
7510
|
-
}
|
|
7511
|
-
function isLogicalDateStringCode(logicalDate) {
|
|
7512
|
-
let isLogicalDateStringCode = false;
|
|
7513
|
-
if (typeof logicalDate === 'string') {
|
|
7514
|
-
switch (logicalDate.toLocaleLowerCase()) {
|
|
7515
|
-
case util.DATE_NOW_VALUE:
|
|
7516
|
-
case DATE_TODAY_START_VALUE:
|
|
7517
|
-
case DATE_TODAY_END_VALUE:
|
|
7518
|
-
case DATE_WEEK_START_VALUE:
|
|
7519
|
-
case DATE_WEEK_END_VALUE:
|
|
7520
|
-
isLogicalDateStringCode = true;
|
|
7521
|
-
break;
|
|
7522
|
-
}
|
|
7523
|
-
}
|
|
7524
|
-
return isLogicalDateStringCode;
|
|
7525
|
-
}
|
|
7526
|
-
|
|
7527
7722
|
function dateOrDayStringRangeToDateRange(range) {
|
|
7528
7723
|
return {
|
|
7529
7724
|
start: toJsDayDate(range.start),
|
|
@@ -7544,7 +7739,7 @@ function roundDateTimeDownToSteps(date, round) {
|
|
|
7544
7739
|
roundToSteps = true
|
|
7545
7740
|
} = round;
|
|
7546
7741
|
if (roundToSteps) {
|
|
7547
|
-
date = roundToMinuteSteps(date, step
|
|
7742
|
+
date = roundToMinuteSteps(date, step != null ? step : 1);
|
|
7548
7743
|
}
|
|
7549
7744
|
return roundDateTimeDown(date, round);
|
|
7550
7745
|
}
|
|
@@ -7555,13 +7750,13 @@ function roundDateTimeDown(date, round) {
|
|
|
7555
7750
|
} = round;
|
|
7556
7751
|
let rounding = {};
|
|
7557
7752
|
if (roundDownToMinute) {
|
|
7558
|
-
rounding = Object.assign(
|
|
7753
|
+
rounding = Object.assign({}, rounding, {
|
|
7559
7754
|
seconds: 0,
|
|
7560
7755
|
milliseconds: 0
|
|
7561
7756
|
});
|
|
7562
7757
|
}
|
|
7563
7758
|
if (roundDownToDay) {
|
|
7564
|
-
rounding = Object.assign(
|
|
7759
|
+
rounding = Object.assign({}, rounding, {
|
|
7565
7760
|
hours: 0,
|
|
7566
7761
|
minutes: 0
|
|
7567
7762
|
});
|
|
@@ -7608,7 +7803,7 @@ function dateInterval(config) {
|
|
|
7608
7803
|
if (!logicalDate && !inputFactory) {
|
|
7609
7804
|
logicalDate = 'now';
|
|
7610
7805
|
}
|
|
7611
|
-
const intervalPeriod = period
|
|
7806
|
+
const intervalPeriod = period != null ? period : util.MS_IN_SECOND;
|
|
7612
7807
|
const factory = inputFactory ? inputFactory : util.protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
|
|
7613
7808
|
let obs = rxjs.interval(intervalPeriod, scheduler).pipe(rxjs.startWith(-1), rxjs.map(factory));
|
|
7614
7809
|
if (emitAll !== true) {
|
|
@@ -7635,13 +7830,13 @@ function nowInterval(period) {
|
|
|
7635
7830
|
*/
|
|
7636
7831
|
class LimitDateTimeInstance {
|
|
7637
7832
|
constructor(config = {}) {
|
|
7833
|
+
this.config = void 0;
|
|
7638
7834
|
this.config = config;
|
|
7639
7835
|
}
|
|
7640
7836
|
get instant() {
|
|
7641
7837
|
return this.config.instant || 'now';
|
|
7642
7838
|
}
|
|
7643
7839
|
get minimumMinutesIntoFuture() {
|
|
7644
|
-
var _a;
|
|
7645
7840
|
const {
|
|
7646
7841
|
limits = {}
|
|
7647
7842
|
} = this.config;
|
|
@@ -7650,7 +7845,8 @@ class LimitDateTimeInstance {
|
|
|
7650
7845
|
} = limits;
|
|
7651
7846
|
let minutes;
|
|
7652
7847
|
if (future) {
|
|
7653
|
-
|
|
7848
|
+
var _future$minutes;
|
|
7849
|
+
minutes = (_future$minutes = future.minutes) != null ? _future$minutes : 0;
|
|
7654
7850
|
if (future.hours) {
|
|
7655
7851
|
minutes += Math.floor(future.hours * 60);
|
|
7656
7852
|
}
|
|
@@ -7676,7 +7872,7 @@ class LimitDateTimeInstance {
|
|
|
7676
7872
|
limit = util.DATE_NOW_VALUE;
|
|
7677
7873
|
} else if (future) {
|
|
7678
7874
|
const minimumMinutesIntoFuture = this.minimumMinutesIntoFuture;
|
|
7679
|
-
limit = dateFns.addMinutes(instant, minimumMinutesIntoFuture
|
|
7875
|
+
limit = dateFns.addMinutes(instant, minimumMinutesIntoFuture != null ? minimumMinutesIntoFuture : 0);
|
|
7680
7876
|
}
|
|
7681
7877
|
}
|
|
7682
7878
|
return limit;
|
|
@@ -7723,12 +7919,12 @@ class LimitDateTimeInstance {
|
|
|
7723
7919
|
* Clamps the input date to the current range.
|
|
7724
7920
|
*/
|
|
7725
7921
|
clamp(date) {
|
|
7726
|
-
var _a;
|
|
7727
7922
|
let result = date;
|
|
7728
7923
|
const dateRange = this.dateRange();
|
|
7729
7924
|
result = clampDateToDateRange(date, dateRange);
|
|
7730
7925
|
if (this.config.takeNextUpcomingTime) {
|
|
7731
|
-
|
|
7926
|
+
var _this$config$roundDow;
|
|
7927
|
+
result = takeNextUpcomingTime(result, (_this$config$roundDow = this.config.roundDownToMinute) != null ? _this$config$roundDow : false);
|
|
7732
7928
|
} else if (this.config.roundDownToMinute) {
|
|
7733
7929
|
result = roundDownToMinute(result);
|
|
7734
7930
|
}
|
|
@@ -7749,10 +7945,15 @@ function limitDateTimeInstance(config) {
|
|
|
7749
7945
|
*/
|
|
7750
7946
|
class DateTimeMinuteInstance {
|
|
7751
7947
|
constructor(config = {}, dateOverride) {
|
|
7752
|
-
var
|
|
7948
|
+
var _config$step;
|
|
7949
|
+
this.config = void 0;
|
|
7950
|
+
this._date = void 0;
|
|
7951
|
+
this._step = void 0;
|
|
7952
|
+
this._limit = void 0;
|
|
7953
|
+
this._dateFilter = void 0;
|
|
7753
7954
|
this.config = config;
|
|
7754
7955
|
this._date = (dateOverride == undefined ? config.date : dateOverride) || new Date();
|
|
7755
|
-
this._step = (
|
|
7956
|
+
this._step = (_config$step = config.step) != null ? _config$step : 1;
|
|
7756
7957
|
this._limit = new LimitDateTimeInstance(config);
|
|
7757
7958
|
this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
|
|
7758
7959
|
}
|
|
@@ -7868,9 +8069,9 @@ class DateTimeMinuteInstance {
|
|
|
7868
8069
|
}
|
|
7869
8070
|
|
|
7870
8071
|
round(round) {
|
|
7871
|
-
var
|
|
7872
|
-
let date = roundDateTimeDownToSteps(this.date, Object.assign(
|
|
7873
|
-
step: (
|
|
8072
|
+
var _round$step;
|
|
8073
|
+
let date = roundDateTimeDownToSteps(this.date, Object.assign({}, round, {
|
|
8074
|
+
step: (_round$step = round.step) != null ? _round$step : this.step
|
|
7874
8075
|
}));
|
|
7875
8076
|
if (round.roundToBound) {
|
|
7876
8077
|
date = this._takeBoundedDate(date);
|
|
@@ -7884,6 +8085,7 @@ class DateTimeMinuteInstance {
|
|
|
7884
8085
|
return this._limit.clamp(date);
|
|
7885
8086
|
}
|
|
7886
8087
|
clampToSchedule(date = this.date, maxClampDistance = 370) {
|
|
8088
|
+
var _nextAvailableDate;
|
|
7887
8089
|
let nextAvailableDate;
|
|
7888
8090
|
if (this._dateFilter != null) {
|
|
7889
8091
|
const maxLimitedDateRange = this._limit.dateRange();
|
|
@@ -7920,7 +8122,7 @@ class DateTimeMinuteInstance {
|
|
|
7920
8122
|
}
|
|
7921
8123
|
}
|
|
7922
8124
|
}
|
|
7923
|
-
return
|
|
8125
|
+
return (_nextAvailableDate = nextAvailableDate) != null ? _nextAvailableDate : date;
|
|
7924
8126
|
}
|
|
7925
8127
|
findNextAvailableDayInSchedule(date, direction, maxDistance = 370) {
|
|
7926
8128
|
let nextAvailableDate;
|
|
@@ -7945,8 +8147,8 @@ class DateTimeMinuteInstance {
|
|
|
7945
8147
|
return this._takeMaximumBoundedDate(this._takeMinimumBoundedDate(date));
|
|
7946
8148
|
}
|
|
7947
8149
|
_takeMinimumBoundedDate(date = this.date) {
|
|
7948
|
-
var
|
|
7949
|
-
if (((
|
|
8150
|
+
var _this$config$behavior;
|
|
8151
|
+
if (((_this$config$behavior = this.config.behavior) == null ? void 0 : _this$config$behavior.capToMinLimit) !== false) {
|
|
7950
8152
|
const min = dateFromLogicalDate(this._limit.min);
|
|
7951
8153
|
if (min && dateFns.isBefore(date, min)) {
|
|
7952
8154
|
date = min;
|
|
@@ -7955,8 +8157,8 @@ class DateTimeMinuteInstance {
|
|
|
7955
8157
|
return date;
|
|
7956
8158
|
}
|
|
7957
8159
|
_takeMaximumBoundedDate(date = this.date) {
|
|
7958
|
-
var
|
|
7959
|
-
if (((
|
|
8160
|
+
var _this$config$behavior2;
|
|
8161
|
+
if (((_this$config$behavior2 = this.config.behavior) == null ? void 0 : _this$config$behavior2.capToMaxLimit) !== false) {
|
|
7960
8162
|
const max = dateFromLogicalDate(this._limit.max);
|
|
7961
8163
|
if (max && dateFns.isAfter(date, max)) {
|
|
7962
8164
|
date = max;
|
|
@@ -8311,17 +8513,18 @@ class DateTimeUtilityInstance {
|
|
|
8311
8513
|
* If the timezone is not defined, it defaults to UTC.
|
|
8312
8514
|
*/
|
|
8313
8515
|
constructor(timezone) {
|
|
8516
|
+
this.normalInstance = void 0;
|
|
8314
8517
|
this.normalInstance = new DateTimezoneUtcNormalInstance(timezone);
|
|
8315
8518
|
}
|
|
8316
8519
|
get timezone() {
|
|
8317
8520
|
return this.normalInstance.configuredTimezoneString;
|
|
8318
8521
|
}
|
|
8319
8522
|
getTimeAM(date = new Date(), timezone) {
|
|
8320
|
-
const am = dateFnsTz.formatInTimeZone(date, timezone
|
|
8523
|
+
const am = dateFnsTz.formatInTimeZone(date, timezone != null ? timezone : this.timezone, 'a');
|
|
8321
8524
|
return am;
|
|
8322
8525
|
}
|
|
8323
8526
|
toTimeString(date, timezone) {
|
|
8324
|
-
return dateFnsTz.formatInTimeZone(date, timezone
|
|
8527
|
+
return dateFnsTz.formatInTimeZone(date, timezone != null ? timezone : this.timezone, `h:mma`);
|
|
8325
8528
|
}
|
|
8326
8529
|
parseTimeString(input, config) {
|
|
8327
8530
|
const timestringResult = this._timeStringToDate(input, config);
|
|
@@ -8471,13 +8674,13 @@ class DateTimeUtilityInstance {
|
|
|
8471
8674
|
return output;
|
|
8472
8675
|
}
|
|
8473
8676
|
_normalizeInstanceForConfig(config) {
|
|
8474
|
-
var _a;
|
|
8475
8677
|
let instance;
|
|
8476
8678
|
if (isSameDateTimezoneConversionConfig(this.normalInstance.config, config)) {
|
|
8477
8679
|
instance = this.normalInstance;
|
|
8478
8680
|
} else {
|
|
8479
|
-
|
|
8480
|
-
|
|
8681
|
+
var _config$timezone;
|
|
8682
|
+
instance = new DateTimezoneUtcNormalInstance(Object.assign({}, config, {
|
|
8683
|
+
timezone: (_config$timezone = config.timezone) != null ? _config$timezone : this.normalInstance.config.timezone
|
|
8481
8684
|
}));
|
|
8482
8685
|
}
|
|
8483
8686
|
return instance;
|
|
@@ -8487,7 +8690,7 @@ function dateTimeInstanceUtc() {
|
|
|
8487
8690
|
return dateTimeInstance(util.UTC_TIMEZONE_STRING);
|
|
8488
8691
|
}
|
|
8489
8692
|
function dateTimeInstance(timezone) {
|
|
8490
|
-
return new DateTimeUtilityInstance(timezone
|
|
8693
|
+
return new DateTimeUtilityInstance(timezone != null ? timezone : util.UTC_TIMEZONE_STRING);
|
|
8491
8694
|
}
|
|
8492
8695
|
function getTimeAM(date = new Date(), timezone) {
|
|
8493
8696
|
return dateTimeInstance(timezone).getTimeAM(date);
|
|
@@ -8514,10 +8717,10 @@ function toReadableTimeString(date, timezone) {
|
|
|
8514
8717
|
* @returns
|
|
8515
8718
|
*/
|
|
8516
8719
|
function parseReadableTimeString(input, config) {
|
|
8517
|
-
return dateTimeInstance(config
|
|
8720
|
+
return dateTimeInstance(config == null ? void 0 : config.timezone).parseTimeString(input, config);
|
|
8518
8721
|
}
|
|
8519
8722
|
function readableTimeStringToDate(input, config) {
|
|
8520
|
-
return dateTimeInstance(config
|
|
8723
|
+
return dateTimeInstance(config == null ? void 0 : config.timezone).timeStringToDate(input, config);
|
|
8521
8724
|
}
|
|
8522
8725
|
// MARK: Limits
|
|
8523
8726
|
function limitDateTime(config) {
|
|
@@ -8618,8 +8821,8 @@ function hasExpired(expires) {
|
|
|
8618
8821
|
* Returns the expiration date, or a date 1 minute in the past if not defined.
|
|
8619
8822
|
*/
|
|
8620
8823
|
function getExpiration(expires) {
|
|
8621
|
-
var
|
|
8622
|
-
return (
|
|
8824
|
+
var _expires$expiresAt;
|
|
8825
|
+
return (_expires$expiresAt = expires == null ? void 0 : expires.expiresAt) != null ? _expires$expiresAt : dateFns.addMinutes(new Date(), -1);
|
|
8623
8826
|
}
|
|
8624
8827
|
|
|
8625
8828
|
/**
|
|
@@ -8684,7 +8887,7 @@ function makeDateQueryForDateItemRangeFilter(find) {
|
|
|
8684
8887
|
const result = {};
|
|
8685
8888
|
result.timezone = find.timezone;
|
|
8686
8889
|
// Apply the timezone to the date range if provided.
|
|
8687
|
-
const range = find.timezone ? Object.assign(
|
|
8890
|
+
const range = find.timezone ? Object.assign({}, find.range, {
|
|
8688
8891
|
date: dateFnsTz.utcToZonedTime(find.range.date, find.timezone)
|
|
8689
8892
|
}) : find.range;
|
|
8690
8893
|
const dates = dateRange(range);
|
|
@@ -8709,28 +8912,29 @@ function makeDateQueryForDateItemRangeFilter(find) {
|
|
|
8709
8912
|
return result;
|
|
8710
8913
|
}
|
|
8711
8914
|
function makeDateQueryForDateStartsEndsFilter(find) {
|
|
8712
|
-
var _a, _b;
|
|
8713
8915
|
const result = {};
|
|
8714
8916
|
result.timezone = find.timezone;
|
|
8715
8917
|
if (find.starts) {
|
|
8918
|
+
var _result$startsGte;
|
|
8716
8919
|
const {
|
|
8717
8920
|
before,
|
|
8718
8921
|
after,
|
|
8719
8922
|
at: equals
|
|
8720
8923
|
} = find.starts;
|
|
8721
|
-
result.startsGte = after
|
|
8722
|
-
result.startsLte = before
|
|
8723
|
-
result.rStart = (
|
|
8924
|
+
result.startsGte = after != null ? after : equals;
|
|
8925
|
+
result.startsLte = before != null ? before : equals;
|
|
8926
|
+
result.rStart = (_result$startsGte = result.startsGte) != null ? _result$startsGte : result.startsLte;
|
|
8724
8927
|
}
|
|
8725
8928
|
if (find.ends) {
|
|
8929
|
+
var _result$endsGte;
|
|
8726
8930
|
const {
|
|
8727
8931
|
before,
|
|
8728
8932
|
after,
|
|
8729
8933
|
at: equals
|
|
8730
8934
|
} = find.ends;
|
|
8731
|
-
result.endsGte = after
|
|
8732
|
-
result.endsLte = before
|
|
8733
|
-
result.rEnd = (
|
|
8935
|
+
result.endsGte = after != null ? after : equals;
|
|
8936
|
+
result.endsLte = before != null ? before : equals;
|
|
8937
|
+
result.rEnd = (_result$endsGte = result.endsGte) != null ? _result$endsGte : result.endsLte;
|
|
8734
8938
|
}
|
|
8735
8939
|
return result;
|
|
8736
8940
|
}
|
|
@@ -8769,10 +8973,10 @@ function makeDaysAndTimeFiltersFunction(builder) {
|
|
|
8769
8973
|
}
|
|
8770
8974
|
|
|
8771
8975
|
function mergeMongoDBLikeRangeFilters(startsAt, endsAt) {
|
|
8772
|
-
var
|
|
8976
|
+
var _startsAt$$lte, _endsAt$$gte;
|
|
8773
8977
|
return {
|
|
8774
|
-
$lte: (
|
|
8775
|
-
$gte: (
|
|
8978
|
+
$lte: (_startsAt$$lte = startsAt == null ? void 0 : startsAt.$lte) != null ? _startsAt$$lte : endsAt == null ? void 0 : endsAt.$lte,
|
|
8979
|
+
$gte: (_endsAt$$gte = endsAt == null ? void 0 : endsAt.$gte) != null ? _endsAt$$gte : startsAt == null ? void 0 : startsAt.$gte
|
|
8776
8980
|
};
|
|
8777
8981
|
}
|
|
8778
8982
|
function makeMongoDBLikeDateQueryBuilder(config) {
|
|
@@ -8783,9 +8987,9 @@ function makeMongoDBLikeDateQueryBuilder(config) {
|
|
|
8783
8987
|
makeRangeFilter(gte, lte) {
|
|
8784
8988
|
let result;
|
|
8785
8989
|
if (gte || lte) {
|
|
8786
|
-
result = Object.assign(
|
|
8990
|
+
result = Object.assign({}, gte ? {
|
|
8787
8991
|
$gte: gte
|
|
8788
|
-
} : undefined
|
|
8992
|
+
} : undefined, lte ? {
|
|
8789
8993
|
$lte: lte
|
|
8790
8994
|
} : undefined);
|
|
8791
8995
|
}
|
|
@@ -8812,7 +9016,7 @@ function makeMongoDBLikeDateQueryBuilder(config) {
|
|
|
8812
9016
|
[fields.end]: endsAt
|
|
8813
9017
|
} : undefined;
|
|
8814
9018
|
}
|
|
8815
|
-
const filter = Object.assign(
|
|
9019
|
+
const filter = Object.assign({}, startsAtFilter, endsAtFilter);
|
|
8816
9020
|
return filter;
|
|
8817
9021
|
}
|
|
8818
9022
|
};
|
|
@@ -8871,8 +9075,9 @@ class BaseRRuleIter {
|
|
|
8871
9075
|
class LastIterResult extends BaseRRuleIter {
|
|
8872
9076
|
constructor(maxIterationsAllowed = DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED) {
|
|
8873
9077
|
super();
|
|
8874
|
-
this.maxIterationsAllowed =
|
|
9078
|
+
this.maxIterationsAllowed = void 0;
|
|
8875
9079
|
this.maxDate = maxFutureDate();
|
|
9080
|
+
this.maxIterationsAllowed = maxIterationsAllowed;
|
|
8876
9081
|
}
|
|
8877
9082
|
accept(date) {
|
|
8878
9083
|
++this.total;
|
|
@@ -8896,9 +9101,12 @@ class LastIterResult extends BaseRRuleIter {
|
|
|
8896
9101
|
class NextIterResult extends BaseRRuleIter {
|
|
8897
9102
|
constructor(minDate, maxIterationsAllowed = DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED) {
|
|
8898
9103
|
super();
|
|
9104
|
+
this.minDate = void 0;
|
|
9105
|
+
this.maxIterationsAllowed = void 0;
|
|
9106
|
+
this.maxDate = void 0;
|
|
8899
9107
|
this.minDate = minDate;
|
|
8900
9108
|
this.maxIterationsAllowed = maxIterationsAllowed;
|
|
8901
|
-
this.maxDate =
|
|
9109
|
+
this.maxDate = minDate;
|
|
8902
9110
|
}
|
|
8903
9111
|
accept(date) {
|
|
8904
9112
|
this.total += 1;
|
|
@@ -8921,14 +9129,15 @@ class NextIterResult extends BaseRRuleIter {
|
|
|
8921
9129
|
}
|
|
8922
9130
|
class AnyIterResult extends BaseRRuleIter {
|
|
8923
9131
|
constructor(filter, maxIterationsAllowed = DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED) {
|
|
8924
|
-
var _a, _b;
|
|
8925
9132
|
super();
|
|
8926
|
-
this.maxIterationsAllowed =
|
|
9133
|
+
this.maxIterationsAllowed = void 0;
|
|
8927
9134
|
this.minDate = null;
|
|
8928
9135
|
this.maxDate = null;
|
|
9136
|
+
this.maxIterationsAllowed = maxIterationsAllowed;
|
|
8929
9137
|
if (filter) {
|
|
8930
|
-
|
|
8931
|
-
this.
|
|
9138
|
+
var _filter$minDate, _filter$maxDate;
|
|
9139
|
+
this.minDate = (_filter$minDate = filter.minDate) != null ? _filter$minDate : null;
|
|
9140
|
+
this.maxDate = (_filter$maxDate = filter.maxDate) != null ? _filter$maxDate : null;
|
|
8932
9141
|
}
|
|
8933
9142
|
}
|
|
8934
9143
|
accept(date) {
|
|
@@ -9056,8 +9265,8 @@ class DateRRuleParseUtility {
|
|
|
9056
9265
|
return DateRRuleParseUtility.parseExdateAttributeFromProperty(property);
|
|
9057
9266
|
}
|
|
9058
9267
|
static parseExdateAttributeFromProperty(property) {
|
|
9059
|
-
var
|
|
9060
|
-
const timezone = (
|
|
9268
|
+
var _property$params$find;
|
|
9269
|
+
const timezone = (_property$params$find = property.params.find(x => x.key === 'TZID')) == null ? void 0 : _property$params$find.value;
|
|
9061
9270
|
const rawDates = property.values.split(',');
|
|
9062
9271
|
const conversion = new DateTimezoneUtcNormalInstance({
|
|
9063
9272
|
timezone
|
|
@@ -9158,20 +9367,22 @@ class DateRRuleInstance {
|
|
|
9158
9367
|
* Creates a new DateRRuleInstance from the input.
|
|
9159
9368
|
*/
|
|
9160
9369
|
static make(params) {
|
|
9161
|
-
var
|
|
9370
|
+
var _params$rruleStringLi, _params$options$exclu;
|
|
9162
9371
|
if (!(params.rruleLines || params.rruleStringLineSet)) {
|
|
9163
9372
|
throw new Error('Missing rruleLines or rruleStringLineSet input.');
|
|
9164
9373
|
}
|
|
9165
|
-
const rruleStringLineSet = (
|
|
9374
|
+
const rruleStringLineSet = (_params$rruleStringLi = params.rruleStringLineSet) != null ? _params$rruleStringLi : DateRRuleParseUtility.toRRuleStringSet(params.rruleLines);
|
|
9166
9375
|
const rruleOptions = DateRRuleUtility.toRRuleOptions(rruleStringLineSet);
|
|
9167
|
-
const exclude = rruleOptions.exdates.addAll((
|
|
9376
|
+
const exclude = rruleOptions.exdates.addAll((_params$options$exclu = params.options.exclude) == null ? void 0 : _params$options$exclu.valuesArray());
|
|
9168
9377
|
const rrule = new DateRRule(rruleOptions.options);
|
|
9169
|
-
return new DateRRuleInstance(rrule, Object.assign(
|
|
9378
|
+
return new DateRRuleInstance(rrule, Object.assign({}, params.options, {
|
|
9170
9379
|
exclude
|
|
9171
9380
|
}));
|
|
9172
9381
|
}
|
|
9173
9382
|
constructor(rrule, options) {
|
|
9174
|
-
|
|
9383
|
+
this.options = void 0;
|
|
9384
|
+
this.rrule = void 0;
|
|
9385
|
+
this.normalInstance = void 0;
|
|
9175
9386
|
this.options = options;
|
|
9176
9387
|
const tzid = rrule.origOptions.tzid;
|
|
9177
9388
|
let dtstart = rrule.origOptions.dtstart;
|
|
@@ -9182,17 +9393,19 @@ class DateRRuleInstance {
|
|
|
9182
9393
|
*/
|
|
9183
9394
|
this.normalInstance = new DateTimezoneUtcNormalInstance(timezone);
|
|
9184
9395
|
if (dtstart && tzid) ; else if (timezone) {
|
|
9185
|
-
|
|
9396
|
+
var _options$date;
|
|
9397
|
+
const startsAt = (_options$date = options.date) == null ? void 0 : _options$date.startsAt;
|
|
9186
9398
|
// If startsAt is provided, need to change it to start from the base UTC date, if any timezone is provided.
|
|
9187
9399
|
if (startsAt) {
|
|
9188
9400
|
const baseStartDate = this.normalInstance.baseDateToTargetDate(startsAt);
|
|
9189
9401
|
dtstart = baseStartDate;
|
|
9190
9402
|
}
|
|
9191
9403
|
} else {
|
|
9404
|
+
var _dtstart, _options$date2;
|
|
9192
9405
|
// If start date is provided without a timezone, assume timezone is UTC. Do nothing.
|
|
9193
|
-
dtstart =
|
|
9406
|
+
dtstart = (_dtstart = dtstart) != null ? _dtstart : (_options$date2 = options.date) == null ? void 0 : _options$date2.startsAt;
|
|
9194
9407
|
}
|
|
9195
|
-
const rruleOptions = Object.assign(
|
|
9408
|
+
const rruleOptions = Object.assign({}, rrule.origOptions, {
|
|
9196
9409
|
tzid: undefined,
|
|
9197
9410
|
dtstart
|
|
9198
9411
|
});
|
|
@@ -9237,13 +9450,13 @@ class DateRRuleInstance {
|
|
|
9237
9450
|
startsAtDates = this.rrule.all();
|
|
9238
9451
|
}
|
|
9239
9452
|
const referenceDate = this.options.date;
|
|
9240
|
-
const allDates = startsAtDates.map(startsAt => Object.assign(
|
|
9453
|
+
const allDates = startsAtDates.map(startsAt => Object.assign({}, referenceDate, {
|
|
9241
9454
|
startsAt
|
|
9242
9455
|
})); // Inherit calendar time, etc.
|
|
9243
9456
|
let dates = allDates;
|
|
9244
9457
|
// Fix Dates w/ Timezones
|
|
9245
9458
|
if (this.normalInstance.hasConversion) {
|
|
9246
|
-
dates = dates.map(x => Object.assign(
|
|
9459
|
+
dates = dates.map(x => Object.assign({}, x, {
|
|
9247
9460
|
startsAt: this.normalInstance.targetDateToBaseDate(x.startsAt)
|
|
9248
9461
|
}));
|
|
9249
9462
|
}
|
|
@@ -9287,7 +9500,7 @@ class DateRRuleInstance {
|
|
|
9287
9500
|
end = this.rrule.last();
|
|
9288
9501
|
}
|
|
9289
9502
|
const referenceDate = this.options.date;
|
|
9290
|
-
const finalRecurrenceDateRange = durationSpanToDateRange(Object.assign(
|
|
9503
|
+
const finalRecurrenceDateRange = durationSpanToDateRange(Object.assign({}, referenceDate, {
|
|
9291
9504
|
startsAt: end
|
|
9292
9505
|
}));
|
|
9293
9506
|
finalRecurrenceEndsAt = finalRecurrenceDateRange.end;
|
|
@@ -9316,11 +9529,11 @@ class DateRRuleUtility {
|
|
|
9316
9529
|
* Creates the expansion item results based on the input.
|
|
9317
9530
|
*/
|
|
9318
9531
|
static expand(options) {
|
|
9319
|
-
var
|
|
9532
|
+
var _options$instance;
|
|
9320
9533
|
if (!options.instance && !options.instanceFrom) {
|
|
9321
9534
|
throw new Error('Rrules be defined for expansion.');
|
|
9322
9535
|
}
|
|
9323
|
-
const dateRrule = (
|
|
9536
|
+
const dateRrule = (_options$instance = options.instance) != null ? _options$instance : DateRRuleInstance.make(options.instanceFrom);
|
|
9324
9537
|
return dateRrule.expand(options);
|
|
9325
9538
|
}
|
|
9326
9539
|
static makeInstance(params) {
|
|
@@ -9331,7 +9544,7 @@ class DateRRuleUtility {
|
|
|
9331
9544
|
const rules = DateRRuleParseUtility.separateRRuleStringSetValues(rruleStringLineSet);
|
|
9332
9545
|
const lines = DateRRuleParseUtility.toRRuleLines(rules.basic);
|
|
9333
9546
|
const ruleOptions = rrule.RRule.parseString(lines);
|
|
9334
|
-
return Object.assign(
|
|
9547
|
+
return Object.assign({}, rules, {
|
|
9335
9548
|
options: ruleOptions
|
|
9336
9549
|
});
|
|
9337
9550
|
}
|
|
@@ -9342,6 +9555,28 @@ class DateRRuleUtility {
|
|
|
9342
9555
|
*/
|
|
9343
9556
|
exports.ModelRecurrenceInfo = class ModelRecurrenceInfo {
|
|
9344
9557
|
constructor(template) {
|
|
9558
|
+
/**
|
|
9559
|
+
* Timezone the rule is a part of.
|
|
9560
|
+
*
|
|
9561
|
+
* Required for RRules that have timezone-sensitive implementations.
|
|
9562
|
+
*/
|
|
9563
|
+
this.timezone = void 0;
|
|
9564
|
+
/**
|
|
9565
|
+
* RRules for this recurrence.
|
|
9566
|
+
*/
|
|
9567
|
+
this.rrule = void 0;
|
|
9568
|
+
/**
|
|
9569
|
+
* First instance of the recurrence.
|
|
9570
|
+
*/
|
|
9571
|
+
this.start = void 0;
|
|
9572
|
+
/**
|
|
9573
|
+
* Final instance of the recurrence.
|
|
9574
|
+
*/
|
|
9575
|
+
this.end = void 0;
|
|
9576
|
+
/**
|
|
9577
|
+
* True if the recurrence has no end.
|
|
9578
|
+
*/
|
|
9579
|
+
this.forever = void 0;
|
|
9345
9580
|
if (template != null) {
|
|
9346
9581
|
this.timezone = template.timezone;
|
|
9347
9582
|
this.rrule = template.rrule;
|
|
@@ -9365,7 +9600,7 @@ class ModelRecurrenceInfoUtility {
|
|
|
9365
9600
|
* Creates a ModelRecurrenceInfo instance from the input ModelRecurrenceStart.
|
|
9366
9601
|
*/
|
|
9367
9602
|
static expandModelRecurrenceStartToModelRecurrenceInfo(update) {
|
|
9368
|
-
var
|
|
9603
|
+
var _dates$finalRecurrenc;
|
|
9369
9604
|
const {
|
|
9370
9605
|
date,
|
|
9371
9606
|
rrule,
|
|
@@ -9383,7 +9618,7 @@ class ModelRecurrenceInfoUtility {
|
|
|
9383
9618
|
timezone,
|
|
9384
9619
|
rrule: rruleSetString,
|
|
9385
9620
|
start: dates.start,
|
|
9386
|
-
end: (
|
|
9621
|
+
end: (_dates$finalRecurrenc = dates.finalRecurrenceEndsAt) != null ? _dates$finalRecurrenc : dates.end,
|
|
9387
9622
|
forever: dates.forever
|
|
9388
9623
|
};
|
|
9389
9624
|
return new exports.ModelRecurrenceInfo(recurrenceInfo);
|
|
@@ -9709,14 +9944,19 @@ exports.readDaysOfWeekNames = readDaysOfWeekNames;
|
|
|
9709
9944
|
exports.readableTimeStringToDate = readableTimeStringToDate;
|
|
9710
9945
|
exports.reduceDatesFunction = reduceDatesFunction;
|
|
9711
9946
|
exports.requireCurrentTimezone = requireCurrentTimezone;
|
|
9947
|
+
exports.roundDateDownTo = roundDateDownTo;
|
|
9712
9948
|
exports.roundDateTimeDown = roundDateTimeDown;
|
|
9713
9949
|
exports.roundDateTimeDownToSteps = roundDateTimeDownToSteps;
|
|
9950
|
+
exports.roundDateTo = roundDateTo;
|
|
9951
|
+
exports.roundDateToDate = roundDateToDate;
|
|
9952
|
+
exports.roundDateToUnixDateTimeNumber = roundDateToUnixDateTimeNumber;
|
|
9714
9953
|
exports.roundDownToHour = roundDownToHour;
|
|
9715
9954
|
exports.roundDownToMinute = roundDownToMinute;
|
|
9716
9955
|
exports.roundToMinuteSteps = roundToMinuteSteps;
|
|
9717
9956
|
exports.safeFormatToISO8601DateString = safeFormatToISO8601DateString;
|
|
9718
9957
|
exports.safeToJsDate = safeToJsDate;
|
|
9719
9958
|
exports.searchTimezoneInfos = searchTimezoneInfos;
|
|
9959
|
+
exports.setOnDateWithTimezoneNormalFunction = setOnDateWithTimezoneNormalFunction;
|
|
9720
9960
|
exports.shiftDateCellTimingToSystemTimezone = shiftDateCellTimingToSystemTimezone;
|
|
9721
9961
|
exports.shiftDateCellTimingToTimezone = shiftDateCellTimingToTimezone;
|
|
9722
9962
|
exports.shiftDateCellTimingToTimezoneFunction = shiftDateCellTimingToTimezoneFunction;
|