@dereekb/date 13.3.1 → 13.4.1
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 +987 -356
- package/index.esm.js +983 -357
- package/package.json +5 -4
- package/src/lib/date/date.calendar.d.ts +3 -3
- package/src/lib/date/date.cell.d.ts +5 -0
- package/src/lib/date/date.cell.factory.d.ts +77 -0
- package/src/lib/date/date.cell.filter.d.ts +7 -0
- package/src/lib/date/date.cell.index.d.ts +44 -4
- package/src/lib/date/date.cell.schedule.d.ts +2 -0
- package/src/lib/date/date.d.ts +6 -0
- package/src/lib/date/date.day.d.ts +22 -3
- package/src/lib/date/date.format.d.ts +70 -8
- package/src/lib/date/date.range.d.ts +105 -2
- package/src/lib/date/date.range.timezone.d.ts +1 -0
- package/src/lib/date/date.time.d.ts +12 -0
- package/src/lib/date/date.time.limit.d.ts +9 -0
- package/src/lib/date/date.time.minute.d.ts +28 -0
- package/src/lib/date/date.timezone.d.ts +107 -15
- package/src/lib/date/date.week.d.ts +9 -4
- package/src/lib/date/index.d.ts +0 -1
- package/src/lib/query/query.builder.mongo.d.ts +9 -3
- package/src/lib/rrule/date.recurrence.d.ts +21 -7
- package/src/lib/rrule/date.rrule.d.ts +2 -0
- package/src/lib/rrule/date.rrule.extension.d.ts +10 -0
- package/src/lib/rrule/date.rrule.parse.d.ts +41 -0
- package/src/lib/timezone/index.d.ts +0 -1
- package/src/lib/timezone/timezone.d.ts +38 -4
package/index.esm.js
CHANGED
|
@@ -8,6 +8,14 @@ import { ARKTYPE_DATE_DTO_TYPE } from '@dereekb/model';
|
|
|
8
8
|
import { interval, startWith, map, distinctUntilChanged } from 'rxjs';
|
|
9
9
|
import { RRule } from 'rrule';
|
|
10
10
|
|
|
11
|
+
function _array_like_to_array$7(arr, len) {
|
|
12
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
13
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
14
|
+
return arr2;
|
|
15
|
+
}
|
|
16
|
+
function _array_without_holes$5(arr) {
|
|
17
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
18
|
+
}
|
|
11
19
|
function _define_property$h(obj, key, value) {
|
|
12
20
|
if (key in obj) {
|
|
13
21
|
Object.defineProperty(obj, key, {
|
|
@@ -21,6 +29,12 @@ function _define_property$h(obj, key, value) {
|
|
|
21
29
|
}
|
|
22
30
|
return obj;
|
|
23
31
|
}
|
|
32
|
+
function _iterable_to_array$5(iter) {
|
|
33
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
34
|
+
}
|
|
35
|
+
function _non_iterable_spread$5() {
|
|
36
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
37
|
+
}
|
|
24
38
|
function _object_spread$e(target) {
|
|
25
39
|
for(var i = 1; i < arguments.length; i++){
|
|
26
40
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -36,6 +50,17 @@ function _object_spread$e(target) {
|
|
|
36
50
|
}
|
|
37
51
|
return target;
|
|
38
52
|
}
|
|
53
|
+
function _to_consumable_array$5(arr) {
|
|
54
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
|
|
55
|
+
}
|
|
56
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
57
|
+
if (!o) return;
|
|
58
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
59
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
60
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
61
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
62
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
63
|
+
}
|
|
39
64
|
/**
|
|
40
65
|
* Sentinel date representing the maximum future date (January 1, 9999 UTC).
|
|
41
66
|
*
|
|
@@ -133,6 +158,8 @@ function _object_spread$e(target) {
|
|
|
133
158
|
*
|
|
134
159
|
* Useful as a default for "no expiration" comparisons.
|
|
135
160
|
*
|
|
161
|
+
* @returns the MAX_FUTURE_DATE sentinel
|
|
162
|
+
*
|
|
136
163
|
* @example
|
|
137
164
|
* ```ts
|
|
138
165
|
* const futureDate = maxFutureDate();
|
|
@@ -203,8 +230,7 @@ function _object_spread$e(target) {
|
|
|
203
230
|
* // tz === 'America/New_York' (or similar)
|
|
204
231
|
* ```
|
|
205
232
|
*/ function guessCurrentTimezone() {
|
|
206
|
-
|
|
207
|
-
return (_Intl_DateTimeFormat = Intl.DateTimeFormat()) === null || _Intl_DateTimeFormat === void 0 ? void 0 : (_Intl_DateTimeFormat_resolvedOptions = _Intl_DateTimeFormat.resolvedOptions()) === null || _Intl_DateTimeFormat_resolvedOptions === void 0 ? void 0 : _Intl_DateTimeFormat_resolvedOptions.timeZone;
|
|
233
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
208
234
|
}
|
|
209
235
|
/**
|
|
210
236
|
* Returns the current system's timezone, throwing if detection fails.
|
|
@@ -294,15 +320,15 @@ function isBefore(a, b) {
|
|
|
294
320
|
}
|
|
295
321
|
function isSameDate(a, b) {
|
|
296
322
|
var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
297
|
-
return a != null && b != null ? isEqual(a, b) : defaultValue
|
|
323
|
+
return a != null && b != null ? isEqual(a, b) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
|
|
298
324
|
}
|
|
299
325
|
function isSameDateHoursAndMinutes(a, b) {
|
|
300
326
|
var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
301
|
-
return a != null && b != null ? isEqual(roundDownToMinute(a), roundDownToMinute(b)) : defaultValue
|
|
327
|
+
return a != null && b != null ? isEqual(roundDownToMinute(a), roundDownToMinute(b)) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
|
|
302
328
|
}
|
|
303
329
|
function isSameDateDay(a, b) {
|
|
304
330
|
var defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
305
|
-
return a != null && b != null ? isSameDay(a, b) : defaultValue
|
|
331
|
+
return a != null && b != null ? isSameDay(a, b) : defaultValue !== null && defaultValue !== void 0 ? defaultValue : a == b;
|
|
306
332
|
}
|
|
307
333
|
// MARK: Unix Date/Time
|
|
308
334
|
/**
|
|
@@ -346,6 +372,10 @@ function isSameDateDay(a, b) {
|
|
|
346
372
|
* Sets the hours and optionally minutes on a target date (defaults to now), with optional rounding to strip seconds/milliseconds.
|
|
347
373
|
*
|
|
348
374
|
* @param config - hours, optional minutes, and rounding options
|
|
375
|
+
* @param config.hours - the hours value to set
|
|
376
|
+
* @param config.minutes - optional minutes value to set
|
|
377
|
+
* @param config.removeSeconds - whether to zero out seconds
|
|
378
|
+
* @param config.roundDownToMinute - whether to zero out seconds and milliseconds (defaults to true)
|
|
349
379
|
* @param target - date to modify (defaults to the current date/time)
|
|
350
380
|
* @returns a new Date with the specified time values applied
|
|
351
381
|
*
|
|
@@ -410,7 +440,7 @@ function isSameDateDay(a, b) {
|
|
|
410
440
|
}
|
|
411
441
|
function roundDateTo(date, roundToUnit) {
|
|
412
442
|
var roundType = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 'floor';
|
|
413
|
-
return typeof date === 'number' ? roundDateToUnixDateTimeNumber(date, roundToUnit, roundType) :
|
|
443
|
+
return typeof date === 'number' ? roundDateToUnixDateTimeNumber(date, roundToUnit, roundType) : roundDateToDate(date, roundToUnit, roundType);
|
|
414
444
|
}
|
|
415
445
|
/**
|
|
416
446
|
* Rounds a date or unix timestamp to the nearest unit boundary, always returning a Date.
|
|
@@ -575,7 +605,7 @@ function roundDateTo(date, roundToUnit) {
|
|
|
575
605
|
* // names === ['Mon', 'Tue']
|
|
576
606
|
* ```
|
|
577
607
|
*/ function readDaysOfWeekNames(values, readDate, nameFunction) {
|
|
578
|
-
return
|
|
608
|
+
return _to_consumable_array$5(readDaysOfWeek(values, readDate)).sort(sortNumbersAscendingFunction).map(nameFunction);
|
|
579
609
|
}
|
|
580
610
|
/**
|
|
581
611
|
* Checks whether the given date falls exactly at midnight (00:00:00.000) in UTC.
|
|
@@ -844,6 +874,9 @@ function _is_native_reflect_construct$2() {
|
|
|
844
874
|
/**
|
|
845
875
|
* Type guard to check if a value conforms to the {@link DateRangeStart} interface.
|
|
846
876
|
*
|
|
877
|
+
* @param value - the value to check
|
|
878
|
+
* @returns true if the value has a valid Date `start` property
|
|
879
|
+
*
|
|
847
880
|
* @example
|
|
848
881
|
* ```ts
|
|
849
882
|
* isDateRangeStart({ start: new Date() }); // true
|
|
@@ -872,6 +905,9 @@ function _is_native_reflect_construct$2() {
|
|
|
872
905
|
* Counts the total number of calendar days spanned by the range, inclusive of both endpoints.
|
|
873
906
|
* Always returns at least 1, even for same-day ranges.
|
|
874
907
|
*
|
|
908
|
+
* @param dateRange - the date range to measure
|
|
909
|
+
* @returns the number of days in the range, inclusive
|
|
910
|
+
*
|
|
875
911
|
* @example
|
|
876
912
|
* ```ts
|
|
877
913
|
* const range = { start: new Date('2024-01-01'), end: new Date('2024-01-03') };
|
|
@@ -883,6 +919,9 @@ function _is_native_reflect_construct$2() {
|
|
|
883
919
|
/**
|
|
884
920
|
* Type guard to check if a value is a valid {@link DateRange} with both start and end as Date objects.
|
|
885
921
|
*
|
|
922
|
+
* @param input - the value to check
|
|
923
|
+
* @returns true if the value has valid Date `start` and `end` properties
|
|
924
|
+
*
|
|
886
925
|
* @example
|
|
887
926
|
* ```ts
|
|
888
927
|
* isDateRange({ start: new Date(), end: new Date() }); // true
|
|
@@ -896,6 +935,10 @@ function _is_native_reflect_construct$2() {
|
|
|
896
935
|
* Compares two date ranges for exact millisecond equality on both start and end.
|
|
897
936
|
* Returns true if both are nullish.
|
|
898
937
|
*
|
|
938
|
+
* @param a - first date range to compare
|
|
939
|
+
* @param b - second date range to compare
|
|
940
|
+
* @returns true if both ranges are equal or both are nullish
|
|
941
|
+
*
|
|
899
942
|
* @example
|
|
900
943
|
* ```ts
|
|
901
944
|
* const a = { start: new Date('2024-01-01'), end: new Date('2024-01-31') };
|
|
@@ -910,6 +953,10 @@ function _is_native_reflect_construct$2() {
|
|
|
910
953
|
* Compares two date ranges for calendar-day equality, ignoring time-of-day differences.
|
|
911
954
|
* Returns true if both are nullish.
|
|
912
955
|
*
|
|
956
|
+
* @param a - first date range to compare
|
|
957
|
+
* @param b - second date range to compare
|
|
958
|
+
* @returns true if both ranges fall on the same calendar days or both are nullish
|
|
959
|
+
*
|
|
913
960
|
* @example
|
|
914
961
|
* ```ts
|
|
915
962
|
* const a = { start: new Date('2024-01-01T08:00:00'), end: new Date('2024-01-31T10:00:00') };
|
|
@@ -922,6 +969,9 @@ function _is_native_reflect_construct$2() {
|
|
|
922
969
|
/**
|
|
923
970
|
* Checks whether the range is unbounded (neither start nor end is set), meaning it conceptually includes all dates.
|
|
924
971
|
*
|
|
972
|
+
* @param input - the partial date range to check
|
|
973
|
+
* @returns true if neither start nor end is set
|
|
974
|
+
*
|
|
925
975
|
* @example
|
|
926
976
|
* ```ts
|
|
927
977
|
* isInfiniteDateRange({}); // true
|
|
@@ -933,6 +983,9 @@ function _is_native_reflect_construct$2() {
|
|
|
933
983
|
/**
|
|
934
984
|
* Checks whether the range has only one of start or end set, but not both.
|
|
935
985
|
*
|
|
986
|
+
* @param input - the partial date range to check
|
|
987
|
+
* @returns true if exactly one of start or end is set
|
|
988
|
+
*
|
|
936
989
|
* @example
|
|
937
990
|
* ```ts
|
|
938
991
|
* isPartialDateRange({ start: new Date() }); // true
|
|
@@ -944,6 +997,9 @@ function _is_native_reflect_construct$2() {
|
|
|
944
997
|
/**
|
|
945
998
|
* Checks whether the range has both start and end set.
|
|
946
999
|
*
|
|
1000
|
+
* @param input - the partial date range to check
|
|
1001
|
+
* @returns true if both start and end are set
|
|
1002
|
+
*
|
|
947
1003
|
* @example
|
|
948
1004
|
* ```ts
|
|
949
1005
|
* isFullDateRange({ start: new Date(), end: new Date() }); // true
|
|
@@ -956,6 +1012,10 @@ function _is_native_reflect_construct$2() {
|
|
|
956
1012
|
* Normalizes a Date or {@link DateRange} into a DateRange. When given a single Date,
|
|
957
1013
|
* uses it as start and optionally uses the provided end date (defaults to the same date).
|
|
958
1014
|
*
|
|
1015
|
+
* @param startOrDateRange - a Date or existing DateRange
|
|
1016
|
+
* @param end - optional end date when the first argument is a plain Date
|
|
1017
|
+
* @returns a DateRange
|
|
1018
|
+
*
|
|
959
1019
|
* @example
|
|
960
1020
|
* ```ts
|
|
961
1021
|
* const range = dateOrDateRangeToDateRange(new Date('2024-01-01'), new Date('2024-01-31'));
|
|
@@ -965,14 +1025,16 @@ function _is_native_reflect_construct$2() {
|
|
|
965
1025
|
* dateOrDateRangeToDateRange(existing); // returns the same range
|
|
966
1026
|
* ```
|
|
967
1027
|
*/ function dateOrDateRangeToDateRange(startOrDateRange, end) {
|
|
1028
|
+
var result;
|
|
968
1029
|
if (isDate(startOrDateRange)) {
|
|
969
|
-
|
|
1030
|
+
result = {
|
|
970
1031
|
start: startOrDateRange,
|
|
971
1032
|
end: end !== null && end !== void 0 ? end : startOrDateRange
|
|
972
1033
|
};
|
|
973
1034
|
} else {
|
|
974
|
-
|
|
1035
|
+
result = startOrDateRange;
|
|
975
1036
|
}
|
|
1037
|
+
return result;
|
|
976
1038
|
}
|
|
977
1039
|
var DateRangeType;
|
|
978
1040
|
(function(DateRangeType) {
|
|
@@ -1026,6 +1088,9 @@ var DateRangeType;
|
|
|
1026
1088
|
* Creates a {@link DateRange} from the given type and optional parameters. Supports many range
|
|
1027
1089
|
* strategies including fixed periods (day, week, month), directional ranges, and radii.
|
|
1028
1090
|
*
|
|
1091
|
+
* @param input - the range type or full configuration object
|
|
1092
|
+
* @param inputRoundToMinute - optional override to round the date to the start of its minute
|
|
1093
|
+
* @returns a computed DateRange
|
|
1029
1094
|
* @throws Error if the type is not a recognized {@link DateRangeType}
|
|
1030
1095
|
*
|
|
1031
1096
|
* @example
|
|
@@ -1059,25 +1124,27 @@ var DateRangeType;
|
|
|
1059
1124
|
start = startOfFn(preStart);
|
|
1060
1125
|
end = endOfFn(preEnd);
|
|
1061
1126
|
}
|
|
1062
|
-
function calculateStartAndEndForBetween(
|
|
1063
|
-
var
|
|
1127
|
+
function calculateStartAndEndForBetween(config) {
|
|
1128
|
+
var addFn = config.addFn, tmp = config.distance, betweenDistance = tmp === void 0 ? 0 : tmp, startOfFn = config.startOfFn, endOfFn = config.endOfFn;
|
|
1064
1129
|
var preStart;
|
|
1065
1130
|
var preEnd;
|
|
1066
|
-
switch(
|
|
1131
|
+
switch(betweenDistance){
|
|
1067
1132
|
case 0:
|
|
1068
1133
|
preStart = date;
|
|
1069
1134
|
preEnd = date;
|
|
1070
1135
|
break;
|
|
1071
1136
|
default:
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1137
|
+
{
|
|
1138
|
+
var hasNegativeDistance = betweenDistance < 0;
|
|
1139
|
+
if (hasNegativeDistance) {
|
|
1140
|
+
preStart = addFn(date, betweenDistance);
|
|
1141
|
+
preEnd = date;
|
|
1142
|
+
} else {
|
|
1143
|
+
preStart = date;
|
|
1144
|
+
preEnd = addFn(date, betweenDistance);
|
|
1145
|
+
}
|
|
1146
|
+
break;
|
|
1079
1147
|
}
|
|
1080
|
-
break;
|
|
1081
1148
|
}
|
|
1082
1149
|
start = startOfFn(preStart);
|
|
1083
1150
|
end = endOfFn(preEnd);
|
|
@@ -1099,19 +1166,44 @@ var DateRangeType;
|
|
|
1099
1166
|
calculateStartAndEndForDate(startOfMinute, endOfMinute);
|
|
1100
1167
|
break;
|
|
1101
1168
|
case DateRangeType.MINUTES_RANGE:
|
|
1102
|
-
calculateStartAndEndForBetween(
|
|
1169
|
+
calculateStartAndEndForBetween({
|
|
1170
|
+
addFn: addMinutes,
|
|
1171
|
+
distance: rawDistance,
|
|
1172
|
+
startOfFn: startOfMinute,
|
|
1173
|
+
endOfFn: endOfMinute
|
|
1174
|
+
});
|
|
1103
1175
|
break;
|
|
1104
1176
|
case DateRangeType.HOURS_RANGE:
|
|
1105
|
-
calculateStartAndEndForBetween(
|
|
1177
|
+
calculateStartAndEndForBetween({
|
|
1178
|
+
addFn: addHours,
|
|
1179
|
+
distance: rawDistance,
|
|
1180
|
+
startOfFn: startOfHour,
|
|
1181
|
+
endOfFn: endOfHour
|
|
1182
|
+
});
|
|
1106
1183
|
break;
|
|
1107
1184
|
case DateRangeType.DAYS_RANGE:
|
|
1108
|
-
calculateStartAndEndForBetween(
|
|
1185
|
+
calculateStartAndEndForBetween({
|
|
1186
|
+
addFn: addDays,
|
|
1187
|
+
distance: rawDistance,
|
|
1188
|
+
startOfFn: startOfDay,
|
|
1189
|
+
endOfFn: endOfDay
|
|
1190
|
+
});
|
|
1109
1191
|
break;
|
|
1110
1192
|
case DateRangeType.WEEKS_RANGE:
|
|
1111
|
-
calculateStartAndEndForBetween(
|
|
1193
|
+
calculateStartAndEndForBetween({
|
|
1194
|
+
addFn: addWeeks,
|
|
1195
|
+
distance: rawDistance,
|
|
1196
|
+
startOfFn: startOfWeek,
|
|
1197
|
+
endOfFn: endOfWeek
|
|
1198
|
+
});
|
|
1112
1199
|
break;
|
|
1113
1200
|
case DateRangeType.MONTHS_RANGE:
|
|
1114
|
-
calculateStartAndEndForBetween(
|
|
1201
|
+
calculateStartAndEndForBetween({
|
|
1202
|
+
addFn: addMonths,
|
|
1203
|
+
distance: rawDistance,
|
|
1204
|
+
startOfFn: startOfMonth,
|
|
1205
|
+
endOfFn: endOfMonth
|
|
1206
|
+
});
|
|
1115
1207
|
break;
|
|
1116
1208
|
case DateRangeType.MINUTES_RADIUS:
|
|
1117
1209
|
distance = Math.abs(distance);
|
|
@@ -1134,10 +1226,12 @@ var DateRangeType;
|
|
|
1134
1226
|
end = addDays(date, distance * 7);
|
|
1135
1227
|
break;
|
|
1136
1228
|
case DateRangeType.CALENDAR_MONTH:
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1229
|
+
{
|
|
1230
|
+
var monthStart = startOfMonth(endOfWeek(date));
|
|
1231
|
+
start = startOfWeek(monthStart);
|
|
1232
|
+
end = endOfWeek(endOfMonth(monthStart));
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1141
1235
|
default:
|
|
1142
1236
|
throw new Error("Unknown date range type: ".concat(type));
|
|
1143
1237
|
}
|
|
@@ -1150,6 +1244,9 @@ var DateRangeType;
|
|
|
1150
1244
|
* Returns a range spanning the full calendar day (first to last millisecond) of the given date.
|
|
1151
1245
|
* Convenience wrapper around {@link dateRange} with {@link DateRangeType.DAY}.
|
|
1152
1246
|
*
|
|
1247
|
+
* @param date - the date whose full day range to return
|
|
1248
|
+
* @returns a DateRange from start of day to end of day
|
|
1249
|
+
*
|
|
1153
1250
|
* @example
|
|
1154
1251
|
* ```ts
|
|
1155
1252
|
* const range = dateRangeFromStartAndEndOfDay(new Date('2024-06-15T14:30:00'));
|
|
@@ -1188,6 +1285,8 @@ var DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS = 4000;
|
|
|
1188
1285
|
* Creates a reusable function that iterates over dates within a range using a configurable step function.
|
|
1189
1286
|
* Supports max iteration limits and early bail-out via {@link endItreateDaysInDateRangeEarly}.
|
|
1190
1287
|
*
|
|
1288
|
+
* @param input - configuration or a step function for advancing between dates
|
|
1289
|
+
* @returns a reusable iteration function
|
|
1191
1290
|
* @throws Error if max iterations is exceeded and throwErrorOnMaxIterations is true
|
|
1192
1291
|
*
|
|
1193
1292
|
* @example
|
|
@@ -1241,6 +1340,8 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1241
1340
|
* Creates a reusable function that expands a {@link DateRange} into an array of individual day dates.
|
|
1242
1341
|
* Includes a configurable safety limit to prevent accidental memory exhaustion from large ranges.
|
|
1243
1342
|
*
|
|
1343
|
+
* @param config - optional configuration for the max expansion size
|
|
1344
|
+
* @returns a function that expands a DateRange into an array of Dates
|
|
1244
1345
|
* @throws Error if the range spans more days than the configured maxExpansionSize
|
|
1245
1346
|
*
|
|
1246
1347
|
* @example
|
|
@@ -1270,6 +1371,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1270
1371
|
* Expands a {@link DateRange} into an array of one Date per day. Uses the default max expansion size.
|
|
1271
1372
|
* Convenience wrapper around {@link expandDaysForDateRangeFunction}.
|
|
1272
1373
|
*
|
|
1374
|
+
* @param range - the date range to expand
|
|
1375
|
+
* @returns an array of Dates, one per day in the range
|
|
1376
|
+
*
|
|
1273
1377
|
* @example
|
|
1274
1378
|
* ```ts
|
|
1275
1379
|
* const days = expandDaysForDateRange({ start: new Date('2024-01-01'), end: new Date('2024-01-03') });
|
|
@@ -1281,6 +1385,12 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1281
1385
|
/**
|
|
1282
1386
|
* Determines whether the current moment (or provided `now`) falls before, within, or after the given range.
|
|
1283
1387
|
*
|
|
1388
|
+
* @param dateRange - the date range to compare against
|
|
1389
|
+
* @param dateRange.start - the start of the range
|
|
1390
|
+
* @param dateRange.end - the end of the range
|
|
1391
|
+
* @param now - the reference date, defaults to the current moment
|
|
1392
|
+
* @returns 'past', 'present', or 'future'
|
|
1393
|
+
*
|
|
1284
1394
|
* @example
|
|
1285
1395
|
* ```ts
|
|
1286
1396
|
* const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
|
|
@@ -1290,17 +1400,23 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1290
1400
|
* ```
|
|
1291
1401
|
*/ function dateRangeRelativeState(param) {
|
|
1292
1402
|
var start = param.start, end = param.end, now = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
|
|
1403
|
+
var result;
|
|
1293
1404
|
if (isAfter$1(now, end)) {
|
|
1294
|
-
|
|
1405
|
+
result = 'past';
|
|
1295
1406
|
} else if (isBefore$1(now, start)) {
|
|
1296
|
-
|
|
1407
|
+
result = 'future';
|
|
1297
1408
|
} else {
|
|
1298
|
-
|
|
1409
|
+
result = 'present';
|
|
1299
1410
|
}
|
|
1411
|
+
return result;
|
|
1300
1412
|
}
|
|
1301
1413
|
/**
|
|
1302
1414
|
* Groups an array of date ranges into past, present, and future buckets based on the current moment (or provided `now`).
|
|
1303
1415
|
*
|
|
1416
|
+
* @param dateRanges - the date ranges to group
|
|
1417
|
+
* @param _now - the reference date, defaults to the current moment
|
|
1418
|
+
* @returns an object with past, present, and future arrays
|
|
1419
|
+
*
|
|
1304
1420
|
* @example
|
|
1305
1421
|
* ```ts
|
|
1306
1422
|
* const ranges = [
|
|
@@ -1319,6 +1435,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1319
1435
|
* Checks whether a date falls within a (possibly partial) date range.
|
|
1320
1436
|
* Convenience wrapper around {@link isDateInDateRangeFunction}.
|
|
1321
1437
|
*
|
|
1438
|
+
* @param date - the date to test
|
|
1439
|
+
* @param dateRange - the range to test against
|
|
1440
|
+
* @returns true if the date falls within the range
|
|
1441
|
+
*
|
|
1322
1442
|
* @example
|
|
1323
1443
|
* ```ts
|
|
1324
1444
|
* const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
|
|
@@ -1333,6 +1453,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1333
1453
|
* Handles partial ranges: if only start is set, checks >= start; if only end, checks <= end;
|
|
1334
1454
|
* if neither, all dates are considered in range.
|
|
1335
1455
|
*
|
|
1456
|
+
* @param dateRange - the boundary range to test against
|
|
1457
|
+
* @returns a function that tests whether a date falls within the range
|
|
1458
|
+
*
|
|
1336
1459
|
* @example
|
|
1337
1460
|
* ```ts
|
|
1338
1461
|
* const isInQ1 = isDateInDateRangeFunction({
|
|
@@ -1367,7 +1490,7 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1367
1490
|
return time <= endTime1;
|
|
1368
1491
|
};
|
|
1369
1492
|
} else {
|
|
1370
|
-
fn = function fn(
|
|
1493
|
+
fn = function fn(_input) {
|
|
1371
1494
|
return true;
|
|
1372
1495
|
};
|
|
1373
1496
|
}
|
|
@@ -1378,6 +1501,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1378
1501
|
* Checks whether a date range is fully contained within another (possibly partial) date range.
|
|
1379
1502
|
* Convenience wrapper around {@link isDateRangeInDateRangeFunction}.
|
|
1380
1503
|
*
|
|
1504
|
+
* @param compareDateRange - the range to test for containment
|
|
1505
|
+
* @param dateRange - the boundary range
|
|
1506
|
+
* @returns true if compareDateRange is fully within dateRange
|
|
1507
|
+
*
|
|
1381
1508
|
* @example
|
|
1382
1509
|
* ```ts
|
|
1383
1510
|
* const outer = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
|
|
@@ -1391,6 +1518,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1391
1518
|
* Creates a reusable function that tests whether a given date range is fully contained within
|
|
1392
1519
|
* the configured boundary range. Both start and end of the input must be within bounds.
|
|
1393
1520
|
*
|
|
1521
|
+
* @param dateRange - the boundary range
|
|
1522
|
+
* @returns a function that tests containment of other ranges
|
|
1523
|
+
*
|
|
1394
1524
|
* @example
|
|
1395
1525
|
* ```ts
|
|
1396
1526
|
* const isInYear = isDateRangeInDateRangeFunction({
|
|
@@ -1412,6 +1542,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1412
1542
|
* Checks whether two date ranges overlap in any way (partial or full).
|
|
1413
1543
|
* Convenience wrapper around {@link dateRangeOverlapsDateRangeFunction}.
|
|
1414
1544
|
*
|
|
1545
|
+
* @param compareDateRange - the range to test for overlap
|
|
1546
|
+
* @param dateRange - the reference range
|
|
1547
|
+
* @returns true if the ranges overlap
|
|
1548
|
+
*
|
|
1415
1549
|
* @example
|
|
1416
1550
|
* ```ts
|
|
1417
1551
|
* const a = { start: new Date('2024-01-01'), end: new Date('2024-06-30') };
|
|
@@ -1425,6 +1559,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1425
1559
|
* Creates a reusable function that tests whether input ranges overlap the configured boundary range.
|
|
1426
1560
|
* Two ranges overlap if one starts before the other ends, and vice versa.
|
|
1427
1561
|
*
|
|
1562
|
+
* @param dateRange - the boundary range to test overlap against
|
|
1563
|
+
* @returns a function that tests overlap of other ranges
|
|
1564
|
+
*
|
|
1428
1565
|
* @example
|
|
1429
1566
|
* ```ts
|
|
1430
1567
|
* const overlapsQ1 = dateRangeOverlapsDateRangeFunction({
|
|
@@ -1456,6 +1593,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1456
1593
|
*
|
|
1457
1594
|
* Operates in UTC, so daylight savings transitions are not considered.
|
|
1458
1595
|
*
|
|
1596
|
+
* @param dateRange - the date range to fit into a single day period
|
|
1597
|
+
* @returns a new date range with the same start and an end within 24 hours of start
|
|
1598
|
+
*
|
|
1459
1599
|
* @example
|
|
1460
1600
|
* ```ts
|
|
1461
1601
|
* // 10AM to 1PM across 3 days becomes same-day 10AM to 1PM
|
|
@@ -1483,6 +1623,9 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1483
1623
|
* Dates before start are clamped to start; dates after end are clamped to end.
|
|
1484
1624
|
* Partial ranges clamp only on the side that is defined.
|
|
1485
1625
|
*
|
|
1626
|
+
* @param dateRange - the boundary range for clamping
|
|
1627
|
+
* @returns a function that clamps dates to the range
|
|
1628
|
+
*
|
|
1486
1629
|
* @example
|
|
1487
1630
|
* ```ts
|
|
1488
1631
|
* const clamp = clampDateFunction({
|
|
@@ -1498,15 +1641,16 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1498
1641
|
var hasStartDate = dateRange.start != null;
|
|
1499
1642
|
var hasEndDate = dateRange.end != null;
|
|
1500
1643
|
if (hasStartDate || hasEndDate) {
|
|
1644
|
+
var _ref, _ref1;
|
|
1501
1645
|
var _dateRange_start, _dateRange_end;
|
|
1502
1646
|
// Start Clamp
|
|
1503
|
-
var startTime = ((_dateRange_start = dateRange.start) === null || _dateRange_start === void 0 ? void 0 : _dateRange_start.getTime())
|
|
1647
|
+
var startTime = (_ref = (_dateRange_start = dateRange.start) === null || _dateRange_start === void 0 ? void 0 : _dateRange_start.getTime()) !== null && _ref !== void 0 ? _ref : 0;
|
|
1504
1648
|
var clampStart = function clampStart(input) {
|
|
1505
1649
|
var time = input.getTime();
|
|
1506
1650
|
return time >= startTime ? input : dateRange.start;
|
|
1507
1651
|
};
|
|
1508
1652
|
// End Clamp
|
|
1509
|
-
var endTime = ((_dateRange_end = dateRange.end) === null || _dateRange_end === void 0 ? void 0 : _dateRange_end.getTime())
|
|
1653
|
+
var endTime = (_ref1 = (_dateRange_end = dateRange.end) === null || _dateRange_end === void 0 ? void 0 : _dateRange_end.getTime()) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
1510
1654
|
var clampEnd = function clampEnd(input) {
|
|
1511
1655
|
var time = input.getTime();
|
|
1512
1656
|
return time <= endTime ? input : dateRange.end;
|
|
@@ -1536,6 +1680,10 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1536
1680
|
* Clamps a single date to fall within the given range boundaries.
|
|
1537
1681
|
* Convenience wrapper around {@link clampDateFunction}.
|
|
1538
1682
|
*
|
|
1683
|
+
* @param date - the date to clamp
|
|
1684
|
+
* @param dateRange - the boundary range
|
|
1685
|
+
* @returns the clamped date
|
|
1686
|
+
*
|
|
1539
1687
|
* @example
|
|
1540
1688
|
* ```ts
|
|
1541
1689
|
* const range = { start: new Date('2024-01-01'), end: new Date('2024-12-31') };
|
|
@@ -1563,6 +1711,10 @@ function clampDateRangeFunction(dateRange) {
|
|
|
1563
1711
|
* Clamps a date range to fit within a boundary range.
|
|
1564
1712
|
* Convenience wrapper around {@link clampDateRangeFunction}.
|
|
1565
1713
|
*
|
|
1714
|
+
* @param inputDateRange - the date range to clamp
|
|
1715
|
+
* @param limitToDateRange - the boundary range
|
|
1716
|
+
* @returns the clamped date range
|
|
1717
|
+
*
|
|
1566
1718
|
* @example
|
|
1567
1719
|
* ```ts
|
|
1568
1720
|
* const input = { start: new Date('2023-06-01'), end: new Date('2024-06-30') };
|
|
@@ -1576,6 +1728,9 @@ function clampDateRangeFunction(dateRange) {
|
|
|
1576
1728
|
/**
|
|
1577
1729
|
* Creates a function that applies a date transformation to both start and end of a {@link DateRange}.
|
|
1578
1730
|
*
|
|
1731
|
+
* @param transform - the transformation to apply to both dates
|
|
1732
|
+
* @returns a function that transforms both dates of a DateRange
|
|
1733
|
+
*
|
|
1579
1734
|
* @example
|
|
1580
1735
|
* ```ts
|
|
1581
1736
|
* import { startOfHour } from 'date-fns';
|
|
@@ -1599,6 +1754,9 @@ function clampDateRangeFunction(dateRange) {
|
|
|
1599
1754
|
* Returns each unique day of the week present in the range, in the order they appear starting from
|
|
1600
1755
|
* the range's start day. For ranges spanning 7+ days, returns all days of the week.
|
|
1601
1756
|
*
|
|
1757
|
+
* @param dateRange - the date range to inspect
|
|
1758
|
+
* @returns an array of unique day-of-week values present in the range
|
|
1759
|
+
*
|
|
1602
1760
|
* @example
|
|
1603
1761
|
* ```ts
|
|
1604
1762
|
* // Wednesday through Friday
|
|
@@ -1762,8 +1920,11 @@ function _type_of$6(obj) {
|
|
|
1762
1920
|
* isValidDateTimezoneConversionConfig({ timezone: 'America/Chicago' }); // true
|
|
1763
1921
|
* isValidDateTimezoneConversionConfig({}); // false
|
|
1764
1922
|
* ```
|
|
1923
|
+
*
|
|
1924
|
+
* @param input - the conversion config to validate
|
|
1925
|
+
* @returns true if the config has at least one meaningful conversion property set
|
|
1765
1926
|
*/ function isValidDateTimezoneConversionConfig(input) {
|
|
1766
|
-
return input.useSystemTimezone || input.timezone != null || input.timezoneOffset != null || input.noConversion
|
|
1927
|
+
return input.useSystemTimezone === true || input.timezone != null || input.timezoneOffset != null || input.noConversion === true;
|
|
1767
1928
|
}
|
|
1768
1929
|
/**
|
|
1769
1930
|
* Compares two configs for logical equivalence, accounting for the fact that
|
|
@@ -1774,12 +1935,16 @@ function _type_of$6(obj) {
|
|
|
1774
1935
|
* isSameDateTimezoneConversionConfig({ timezone: 'UTC' }, { timezone: undefined }); // true
|
|
1775
1936
|
* isSameDateTimezoneConversionConfig({ useSystemTimezone: true }, { timezone: 'America/Denver' }); // false
|
|
1776
1937
|
* ```
|
|
1938
|
+
*
|
|
1939
|
+
* @param a - first conversion config to compare
|
|
1940
|
+
* @param b - second conversion config to compare
|
|
1941
|
+
* @returns true if both configs are logically equivalent
|
|
1777
1942
|
*/ function isSameDateTimezoneConversionConfig(a, b) {
|
|
1778
1943
|
var isSame = false;
|
|
1779
1944
|
if (a.useSystemTimezone || b.useSystemTimezone || a.timezoneOffset || b.timezoneOffset) {
|
|
1780
1945
|
isSame = isSameNonNullValue(a.useSystemTimezone, b.useSystemTimezone) || isSameNonNullValue(a.timezoneOffset, b.timezoneOffset);
|
|
1781
1946
|
} else {
|
|
1782
|
-
isSame = isConsideredUtcTimezoneString(a.timezone) && isConsideredUtcTimezoneString(b.timezone) || a
|
|
1947
|
+
isSame = isConsideredUtcTimezoneString(a.timezone) && isConsideredUtcTimezoneString(b.timezone) || a === b;
|
|
1783
1948
|
}
|
|
1784
1949
|
return isSame;
|
|
1785
1950
|
}
|
|
@@ -1798,6 +1963,7 @@ function _type_of$6(obj) {
|
|
|
1798
1963
|
* ```
|
|
1799
1964
|
*
|
|
1800
1965
|
* @param date - required to determine the correct offset for that instant (DST-aware)
|
|
1966
|
+
* @returns the system timezone UTC offset in milliseconds
|
|
1801
1967
|
*/ function getCurrentSystemOffsetInMs(date) {
|
|
1802
1968
|
// Use native getTimezoneOffset() instead of calculateTimezoneOffset() to avoid
|
|
1803
1969
|
// a DST edge case where toZonedTime() creates an epoch that lands on the system's
|
|
@@ -1814,6 +1980,7 @@ function _type_of$6(obj) {
|
|
|
1814
1980
|
* ```
|
|
1815
1981
|
*
|
|
1816
1982
|
* @param date - required to determine the correct offset for that instant (DST-aware)
|
|
1983
|
+
* @returns the system timezone UTC offset truncated to whole hours
|
|
1817
1984
|
*/ function getCurrentSystemOffsetInHours(date) {
|
|
1818
1985
|
return millisecondsToHours(getCurrentSystemOffsetInMs(date));
|
|
1819
1986
|
}
|
|
@@ -1830,6 +1997,7 @@ function _type_of$6(obj) {
|
|
|
1830
1997
|
* ```
|
|
1831
1998
|
*
|
|
1832
1999
|
* @param date - required to determine the correct offset for that instant (DST-aware)
|
|
2000
|
+
* @returns the system timezone UTC offset in minutes
|
|
1833
2001
|
*/ function getCurrentSystemOffsetInMinutes(date) {
|
|
1834
2002
|
return millisecondsToMinutes(getCurrentSystemOffsetInMs(date));
|
|
1835
2003
|
}
|
|
@@ -1850,6 +2018,7 @@ function _type_of$6(obj) {
|
|
|
1850
2018
|
*
|
|
1851
2019
|
* @param timezone - IANA timezone string (e.g. 'America/New_York')
|
|
1852
2020
|
* @param date - the instant to evaluate, since DST may shift the offset
|
|
2021
|
+
* @returns the UTC offset for the given timezone at the given instant, in milliseconds
|
|
1853
2022
|
*/ function calculateTimezoneOffset(timezone, date) {
|
|
1854
2023
|
var tzOffset;
|
|
1855
2024
|
// UTC always has zero offset; skip toZonedTime which can produce wrong results
|
|
@@ -1876,7 +2045,15 @@ function _type_of$6(obj) {
|
|
|
1876
2045
|
}
|
|
1877
2046
|
return tzOffset;
|
|
1878
2047
|
}
|
|
1879
|
-
|
|
2048
|
+
/**
|
|
2049
|
+
* Calculates offset values for every pair of conversion targets (target, base, system)
|
|
2050
|
+
* and returns them as a keyed map (e.g. `'target-base'`, `'base-system'`).
|
|
2051
|
+
*
|
|
2052
|
+
* @param date - the reference date used to compute offsets
|
|
2053
|
+
* @param converter - the converter instance providing offset calculations
|
|
2054
|
+
* @param map - optional mapping function applied to each raw millisecond offset
|
|
2055
|
+
* @returns a map of conversion-pair keys to their computed offset values
|
|
2056
|
+
*/ function calculateAllConversions(date, converter) {
|
|
1880
2057
|
var map = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(x) {
|
|
1881
2058
|
return x;
|
|
1882
2059
|
};
|
|
@@ -1903,6 +2080,9 @@ function calculateAllConversions(date, converter) {
|
|
|
1903
2080
|
* inverseDateTimezoneUtcNormalInstanceTransformType('targetDateToBaseDate'); // 'baseDateToTargetDate'
|
|
1904
2081
|
* inverseDateTimezoneUtcNormalInstanceTransformType('systemDateToTargetDate'); // 'targetDateToSystemDate'
|
|
1905
2082
|
* ```
|
|
2083
|
+
*
|
|
2084
|
+
* @param input - the transform type to invert
|
|
2085
|
+
* @returns the inverse transform type for round-trip conversion
|
|
1906
2086
|
*/ function inverseDateTimezoneUtcNormalInstanceTransformType(input) {
|
|
1907
2087
|
var result;
|
|
1908
2088
|
switch(input){
|
|
@@ -1924,6 +2104,8 @@ function calculateAllConversions(date, converter) {
|
|
|
1924
2104
|
case 'targetDateToSystemDate':
|
|
1925
2105
|
result = 'systemDateToTargetDate';
|
|
1926
2106
|
break;
|
|
2107
|
+
default:
|
|
2108
|
+
throw new Error("Unexpected transform type: ".concat(input));
|
|
1927
2109
|
}
|
|
1928
2110
|
return result;
|
|
1929
2111
|
}
|
|
@@ -1955,8 +2137,7 @@ function calculateAllConversions(date, converter) {
|
|
|
1955
2137
|
};
|
|
1956
2138
|
};
|
|
1957
2139
|
var calculateOffset = function calculateOffset(date) {
|
|
1958
|
-
|
|
1959
|
-
return offset;
|
|
2140
|
+
return getOffsetInMsFn(date);
|
|
1960
2141
|
};
|
|
1961
2142
|
var calculateSystemNormalDifference = function calculateSystemNormalDifference(date) {
|
|
1962
2143
|
var normalOffset = calculateOffset(date);
|
|
@@ -2065,12 +2246,11 @@ function calculateAllConversions(date, converter) {
|
|
|
2065
2246
|
* 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.
|
|
2066
2247
|
* This is where some contextual data was not being used. This function uses that contextual data to make sure the reverse will be consistent.
|
|
2067
2248
|
*
|
|
2068
|
-
* @param
|
|
2069
|
-
* @
|
|
2070
|
-
* @param fromOrTo the "type" of date the originalContextDate is
|
|
2249
|
+
* @param config - configuration for the safe mirrored conversion
|
|
2250
|
+
* @returns the converted date and the DST offset adjustment applied
|
|
2071
2251
|
*/ key: "safeMirroredConvertDate",
|
|
2072
|
-
value: function safeMirroredConvertDate(
|
|
2073
|
-
var
|
|
2252
|
+
value: function safeMirroredConvertDate(config) {
|
|
2253
|
+
var baseDate = config.baseDate, originalContextDate = config.originalContextDate, contextType = config.contextType, _config_safeConvert = config.safeConvert, safeConvert = _config_safeConvert === void 0 ? true : _config_safeConvert;
|
|
2074
2254
|
if (contextType === 'base') {
|
|
2075
2255
|
return {
|
|
2076
2256
|
date: baseDate,
|
|
@@ -2233,7 +2413,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2233
2413
|
/**
|
|
2234
2414
|
* Returns true if the input is midnight in the target timezone.
|
|
2235
2415
|
*
|
|
2236
|
-
* @param date
|
|
2416
|
+
* @param date - the date to check
|
|
2417
|
+
* @returns true if the date is at the start of the day in the target timezone
|
|
2237
2418
|
*/ key: "isStartOfDayInTargetTimezone",
|
|
2238
2419
|
value: function isStartOfDayInTargetTimezone(date) {
|
|
2239
2420
|
var utcNormal = this.baseDateToTargetDate(date);
|
|
@@ -2244,7 +2425,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2244
2425
|
/**
|
|
2245
2426
|
* Start of the given day in the target timezone.
|
|
2246
2427
|
*
|
|
2247
|
-
* @param date
|
|
2428
|
+
* @param date - the input is treated as an instant in time
|
|
2429
|
+
* @returns the start-of-day date in the target timezone
|
|
2248
2430
|
*/ key: "startOfDayInTargetTimezone",
|
|
2249
2431
|
value: function startOfDayInTargetTimezone(date) {
|
|
2250
2432
|
var baseDay = this.startOfDayInBaseDate(date);
|
|
@@ -2255,7 +2437,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2255
2437
|
/**
|
|
2256
2438
|
* Start of the given day in UTC.
|
|
2257
2439
|
*
|
|
2258
|
-
* @param date
|
|
2440
|
+
* @param date - the date or ISO8601 day string to get the start of day for
|
|
2441
|
+
* @returns the start of the day as a BaseDateAsUTC
|
|
2259
2442
|
*/ key: "startOfDayInBaseDate",
|
|
2260
2443
|
value: function startOfDayInBaseDate(date) {
|
|
2261
2444
|
if (typeof date === 'string') {
|
|
@@ -2270,8 +2453,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2270
2453
|
/**
|
|
2271
2454
|
* End of the given day in UTC.
|
|
2272
2455
|
*
|
|
2273
|
-
* @param date
|
|
2274
|
-
* @returns
|
|
2456
|
+
* @param date - the date or ISO8601 day string to get the end of day for
|
|
2457
|
+
* @returns the end of the day as a BaseDateAsUTC (23:59:59.999)
|
|
2275
2458
|
*/ key: "endOfDayInBaseDate",
|
|
2276
2459
|
value: function endOfDayInBaseDate(date) {
|
|
2277
2460
|
var result = this.startOfDayInBaseDate(date);
|
|
@@ -2283,8 +2466,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2283
2466
|
/**
|
|
2284
2467
|
* Start of the given day for the system.
|
|
2285
2468
|
*
|
|
2286
|
-
* @param date
|
|
2287
|
-
* @returns
|
|
2469
|
+
* @param date - the date or ISO8601 day string to get the start of day for
|
|
2470
|
+
* @returns the start of the day in the system timezone
|
|
2288
2471
|
*/ key: "startOfDayInSystemDate",
|
|
2289
2472
|
value: function startOfDayInSystemDate(date) {
|
|
2290
2473
|
if (typeof date === 'string') {
|
|
@@ -2299,8 +2482,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2299
2482
|
/**
|
|
2300
2483
|
* End of the given day for the system.
|
|
2301
2484
|
*
|
|
2302
|
-
* @param date
|
|
2303
|
-
* @returns
|
|
2485
|
+
* @param date - the date or ISO8601 day string to get the end of day for
|
|
2486
|
+
* @returns the end of the day in the system timezone
|
|
2304
2487
|
*/ key: "endOfDayInSystemDate",
|
|
2305
2488
|
value: function endOfDayInSystemDate(date) {
|
|
2306
2489
|
return endOfDay(this.startOfDayInSystemDate(date));
|
|
@@ -2308,9 +2491,10 @@ function calculateAllConversions(date, converter) {
|
|
|
2308
2491
|
},
|
|
2309
2492
|
{
|
|
2310
2493
|
/**
|
|
2311
|
-
* Whether or not the
|
|
2494
|
+
* Whether or not the target timezone experiences daylight savings for the given year.
|
|
2312
2495
|
*
|
|
2313
|
-
* @param year
|
|
2496
|
+
* @param year - the year to check, as a Date or number; defaults to the current year
|
|
2497
|
+
* @returns true if the target timezone has different offsets in January and July
|
|
2314
2498
|
*/ key: "targetTimezoneExperiencesDaylightSavings",
|
|
2315
2499
|
value: function targetTimezoneExperiencesDaylightSavings() {
|
|
2316
2500
|
var year = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
@@ -2367,6 +2551,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2367
2551
|
* const same = dateTimezoneUtcNormal(denver); // same reference
|
|
2368
2552
|
* ```
|
|
2369
2553
|
*
|
|
2554
|
+
* @param config - timezone input: an existing instance, timezone string, millisecond offset, or config object
|
|
2555
|
+
* @returns a DateTimezoneUtcNormalInstance for the given input
|
|
2370
2556
|
* @throws Error if the input type is not recognized
|
|
2371
2557
|
*/ function dateTimezoneUtcNormal(config) {
|
|
2372
2558
|
var instance;
|
|
@@ -2374,6 +2560,7 @@ function calculateAllConversions(date, converter) {
|
|
|
2374
2560
|
instance = config;
|
|
2375
2561
|
} else {
|
|
2376
2562
|
var type = typeof config === "undefined" ? "undefined" : _type_of$6(config);
|
|
2563
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
2377
2564
|
switch(type){
|
|
2378
2565
|
case 'object':
|
|
2379
2566
|
instance = new DateTimezoneUtcNormalInstance(config);
|
|
@@ -2389,7 +2576,7 @@ function calculateAllConversions(date, converter) {
|
|
|
2389
2576
|
});
|
|
2390
2577
|
break;
|
|
2391
2578
|
default:
|
|
2392
|
-
throw new Error('Invalid input passed to dateTimezoneUtcNormal()');
|
|
2579
|
+
throw new Error('Invalid input type "'.concat(type, '" passed to dateTimezoneUtcNormal()'));
|
|
2393
2580
|
}
|
|
2394
2581
|
}
|
|
2395
2582
|
return instance;
|
|
@@ -2412,6 +2599,8 @@ function calculateAllConversions(date, converter) {
|
|
|
2412
2599
|
*
|
|
2413
2600
|
* Prefer this over constructing a new instance when you need system-timezone conversions,
|
|
2414
2601
|
* as the singleton avoids unnecessary allocations.
|
|
2602
|
+
*
|
|
2603
|
+
* @returns the shared system-timezone DateTimezoneUtcNormalInstance singleton
|
|
2415
2604
|
*/ function systemDateTimezoneUtcNormal() {
|
|
2416
2605
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
|
|
2417
2606
|
}
|
|
@@ -2428,10 +2617,13 @@ function calculateAllConversions(date, converter) {
|
|
|
2428
2617
|
* const target = baseDateToTargetDate(base, 'America/Denver');
|
|
2429
2618
|
* // target is 2024-06-15T14:00:00.000-06:00 (2PM MDT)
|
|
2430
2619
|
* ```
|
|
2620
|
+
*
|
|
2621
|
+
* @param date - the BaseDateAsUTC to convert
|
|
2622
|
+
* @param timezone - the target IANA timezone string
|
|
2623
|
+
* @returns a real instant in the specified timezone
|
|
2431
2624
|
*/ function baseDateToTargetDate(date, timezone) {
|
|
2432
2625
|
var instance = new DateTimezoneUtcNormalInstance(timezone);
|
|
2433
|
-
|
|
2434
|
-
return result;
|
|
2626
|
+
return instance.baseDateToTargetDate(date);
|
|
2435
2627
|
}
|
|
2436
2628
|
/**
|
|
2437
2629
|
* Convenience function that strips the timezone offset from a target-timezone date,
|
|
@@ -2446,30 +2638,46 @@ function calculateAllConversions(date, converter) {
|
|
|
2446
2638
|
* const base = targetDateToBaseDate(target, 'America/Denver');
|
|
2447
2639
|
* // base is 2024-06-15T14:00:00.000Z — wall-clock 2PM preserved as UTC
|
|
2448
2640
|
* ```
|
|
2641
|
+
*
|
|
2642
|
+
* @param date - the target-timezone date to convert
|
|
2643
|
+
* @param timezone - the IANA timezone the date is expressed in
|
|
2644
|
+
* @returns a BaseDateAsUTC with wall-clock time preserved as UTC
|
|
2449
2645
|
*/ function targetDateToBaseDate(date, timezone) {
|
|
2450
2646
|
return new DateTimezoneUtcNormalInstance(timezone).targetDateToBaseDate(date);
|
|
2451
2647
|
}
|
|
2452
2648
|
/**
|
|
2453
2649
|
* Converts a {@link BaseDateAsUTC} to a target date in the system's local timezone
|
|
2454
2650
|
* using the shared system-timezone instance.
|
|
2651
|
+
*
|
|
2652
|
+
* @param date - the BaseDateAsUTC to convert
|
|
2653
|
+
* @returns the date converted to the system's local timezone
|
|
2455
2654
|
*/ function systemBaseDateToNormalDate(date) {
|
|
2456
2655
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDate(date);
|
|
2457
2656
|
}
|
|
2458
2657
|
/**
|
|
2459
2658
|
* Converts a target date in the system's local timezone back to a {@link BaseDateAsUTC}
|
|
2460
2659
|
* using the shared system-timezone instance.
|
|
2660
|
+
*
|
|
2661
|
+
* @param date - the system-timezone target date to convert back to base
|
|
2662
|
+
* @returns the corresponding BaseDateAsUTC
|
|
2461
2663
|
*/ function systemNormalDateToBaseDate(date) {
|
|
2462
2664
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDate(date);
|
|
2463
2665
|
}
|
|
2464
2666
|
/**
|
|
2465
2667
|
* Returns the millisecond offset needed to convert a {@link BaseDateAsUTC} to a target date
|
|
2466
2668
|
* in the system's local timezone.
|
|
2669
|
+
*
|
|
2670
|
+
* @param date - the date to compute the offset for
|
|
2671
|
+
* @returns the offset in milliseconds
|
|
2467
2672
|
*/ function systemBaseDateToNormalDateOffset(date) {
|
|
2468
2673
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.baseDateToTargetDateOffset(date);
|
|
2469
2674
|
}
|
|
2470
2675
|
/**
|
|
2471
2676
|
* Returns the millisecond offset needed to convert a target date in the system's
|
|
2472
2677
|
* local timezone back to a {@link BaseDateAsUTC}.
|
|
2678
|
+
*
|
|
2679
|
+
* @param date - the date to compute the offset for
|
|
2680
|
+
* @returns the offset in milliseconds
|
|
2473
2681
|
*/ function systemNormalDateToBaseDateOffset(date) {
|
|
2474
2682
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetDateToBaseDateOffset(date);
|
|
2475
2683
|
}
|
|
@@ -2477,6 +2685,9 @@ function calculateAllConversions(date, converter) {
|
|
|
2477
2685
|
* Returns whether the system's local timezone observes daylight saving time in the given year.
|
|
2478
2686
|
*
|
|
2479
2687
|
* Compares the offset on January 1 and July 1; if they differ, DST is in effect for part of the year.
|
|
2688
|
+
*
|
|
2689
|
+
* @param year - the year to check, as a Date
|
|
2690
|
+
* @returns true if the system timezone observes DST in the given year
|
|
2480
2691
|
*/ function systemExperiencesDaylightSavings(year) {
|
|
2481
2692
|
return SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE.targetTimezoneExperiencesDaylightSavings(year);
|
|
2482
2693
|
}
|
|
@@ -2492,7 +2703,9 @@ function calculateAllConversions(date, converter) {
|
|
|
2492
2703
|
* const result = fn(someDate, (d) => startOfDay(d));
|
|
2493
2704
|
* ```
|
|
2494
2705
|
*
|
|
2706
|
+
* @param timezoneInput - timezone configuration for the conversion
|
|
2495
2707
|
* @param transformType - defaults to `'systemDateToTargetDate'`
|
|
2708
|
+
* @returns a function that transforms dates within the specified timezone normalization
|
|
2496
2709
|
*/ function transformDateInTimezoneNormalFunction(timezoneInput) {
|
|
2497
2710
|
var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
|
|
2498
2711
|
var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
|
|
@@ -2511,7 +2724,9 @@ function calculateAllConversions(date, converter) {
|
|
|
2511
2724
|
* Creates a {@link TransformDateRangeToTimezoneFunction} that converts both dates in
|
|
2512
2725
|
* a {@link DateRange} using the specified transform type.
|
|
2513
2726
|
*
|
|
2727
|
+
* @param timezoneInput - timezone configuration for the conversion
|
|
2514
2728
|
* @param transformType - defaults to `'systemDateToTargetDate'`
|
|
2729
|
+
* @returns a function that converts DateRange dates using the specified transform
|
|
2515
2730
|
*/ function transformDateRangeToTimezoneFunction(timezoneInput) {
|
|
2516
2731
|
var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
|
|
2517
2732
|
var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
|
|
@@ -2524,7 +2739,9 @@ function calculateAllConversions(date, converter) {
|
|
|
2524
2739
|
* Creates a {@link TransformDateRangeInTimezoneNormalFunction} that converts a date range
|
|
2525
2740
|
* into the specified date space, applies a user-provided range transformation, then converts back.
|
|
2526
2741
|
*
|
|
2742
|
+
* @param timezoneInput - timezone configuration for the conversion
|
|
2527
2743
|
* @param transformType - defaults to `'systemDateToTargetDate'`
|
|
2744
|
+
* @returns a function that transforms date ranges within the specified timezone normalization
|
|
2528
2745
|
*/ function transformDateRangeInTimezoneNormalFunction(timezoneInput) {
|
|
2529
2746
|
var transformType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'systemDateToTargetDate';
|
|
2530
2747
|
var timezoneInstance = dateTimezoneUtcNormal(timezoneInput);
|
|
@@ -2548,6 +2765,9 @@ function calculateAllConversions(date, converter) {
|
|
|
2548
2765
|
* const midnight = startOfDayInDenver('2024-06-15');
|
|
2549
2766
|
* // midnight is 2024-06-15T06:00:00.000Z (midnight MDT = 6AM UTC)
|
|
2550
2767
|
* ```
|
|
2768
|
+
*
|
|
2769
|
+
* @param timezone - timezone configuration to bind the factory to
|
|
2770
|
+
* @returns a factory that converts ISO8601 day strings to start-of-day dates
|
|
2551
2771
|
*/ function startOfDayInTimezoneDayStringFactory(timezone) {
|
|
2552
2772
|
var timezoneInstance = dateTimezoneUtcNormal(timezone);
|
|
2553
2773
|
return function(day) {
|
|
@@ -2563,6 +2783,10 @@ function calculateAllConversions(date, converter) {
|
|
|
2563
2783
|
* ```ts
|
|
2564
2784
|
* const midnight = startOfDayInTimezoneFromISO8601DayString('2024-06-15', 'America/Denver');
|
|
2565
2785
|
* ```
|
|
2786
|
+
*
|
|
2787
|
+
* @param day - the ISO8601 day string to parse
|
|
2788
|
+
* @param timezone - timezone configuration for the start-of-day calculation
|
|
2789
|
+
* @returns the start-of-day instant in the given timezone
|
|
2566
2790
|
*/ function startOfDayInTimezoneFromISO8601DayString(day, timezone) {
|
|
2567
2791
|
return startOfDayInTimezoneDayStringFactory(timezone)(day);
|
|
2568
2792
|
}
|
|
@@ -2579,8 +2803,12 @@ function calculateAllConversions(date, converter) {
|
|
|
2579
2803
|
* const result = setOnDate({ date: someDate, hours: 14, minutes: 30, inputType: 'target' });
|
|
2580
2804
|
* // result is someDate with hours set to 14:30 in Denver time
|
|
2581
2805
|
* ```
|
|
2806
|
+
*
|
|
2807
|
+
* @param timezone - the timezone configuration to bind to
|
|
2808
|
+
* @returns a function that sets hours/minutes on dates in the given timezone
|
|
2582
2809
|
*/ function setOnDateWithTimezoneNormalFunction(timezone) {
|
|
2583
2810
|
var timezoneInstance = dateTimezoneUtcNormal(timezone);
|
|
2811
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
2584
2812
|
var fn = function fn(input) {
|
|
2585
2813
|
var inputDate = input.date, copyFromInput = input.copyFrom, copyHours = input.copyHours, copyMinutes = input.copyMinutes, inputInputType = input.inputType, outputType = input.outputType, inputHours = input.hours, inputMinutes = input.minutes, roundDownToMinute = input.roundDownToMinute;
|
|
2586
2814
|
var DEFAULT_TYPE = 'target';
|
|
@@ -2596,7 +2824,7 @@ function calculateAllConversions(date, converter) {
|
|
|
2596
2824
|
return roundDownToMinute ? roundDateDownTo(inputDate, 'minute') : inputDate;
|
|
2597
2825
|
}
|
|
2598
2826
|
if (inputType !== 'base') {
|
|
2599
|
-
copyFrom =
|
|
2827
|
+
copyFrom = timezoneInstance.convertDate(copyFrom, 'base', inputType);
|
|
2600
2828
|
}
|
|
2601
2829
|
}
|
|
2602
2830
|
// set baseDate
|
|
@@ -2645,6 +2873,7 @@ function calculateAllConversions(date, converter) {
|
|
|
2645
2873
|
*
|
|
2646
2874
|
* @param input - the date whose day is preserved
|
|
2647
2875
|
* @param timezone - the timezone context for the hour/minute interpretation
|
|
2876
|
+
* @returns the input date with hours and minutes set to the current time in the given timezone
|
|
2648
2877
|
*/ function copyHoursAndMinutesFromNowWithTimezoneNormal(input, timezone) {
|
|
2649
2878
|
return copyHoursAndMinutesFromDateWithTimezoneNormal(input, 'now', timezone);
|
|
2650
2879
|
}
|
|
@@ -2665,16 +2894,16 @@ function calculateAllConversions(date, converter) {
|
|
|
2665
2894
|
* @param input - the date whose day is preserved
|
|
2666
2895
|
* @param copyFrom - the date (or `'now'`) whose hours/minutes are copied
|
|
2667
2896
|
* @param timezone - the timezone context for interpreting both dates
|
|
2897
|
+
* @returns the input date with hours and minutes copied from the source
|
|
2668
2898
|
*/ function copyHoursAndMinutesFromDateWithTimezoneNormal(input, copyFrom, timezone) {
|
|
2669
2899
|
var timezoneInstance = dateTimezoneUtcNormal(timezone);
|
|
2670
|
-
|
|
2900
|
+
return timezoneInstance.setOnDate({
|
|
2671
2901
|
date: input,
|
|
2672
2902
|
copyFrom: copyFrom,
|
|
2673
2903
|
inputType: 'target',
|
|
2674
2904
|
copyHours: true,
|
|
2675
2905
|
copyMinutes: true
|
|
2676
2906
|
});
|
|
2677
|
-
return result;
|
|
2678
2907
|
}
|
|
2679
2908
|
|
|
2680
2909
|
function _define_property$e(obj, key, value) {
|
|
@@ -2735,6 +2964,7 @@ function _object_spread$c(target) {
|
|
|
2735
2964
|
*
|
|
2736
2965
|
* @param dateRange - the range to fit
|
|
2737
2966
|
* @param timezone - the timezone for day boundary calculation
|
|
2967
|
+
* @returns the date range fitted to a single day period
|
|
2738
2968
|
*/ function fitDateRangeToDayPeriod(dateRange, timezone) {
|
|
2739
2969
|
return fitDateRangeToDayPeriodFunction(timezone)(dateRange);
|
|
2740
2970
|
}
|
|
@@ -2745,6 +2975,7 @@ function _object_spread$c(target) {
|
|
|
2745
2975
|
* Useful when the same range formatting logic needs to be applied repeatedly with consistent settings.
|
|
2746
2976
|
*
|
|
2747
2977
|
* @param inputConfig - format function or full configuration
|
|
2978
|
+
* @returns a reusable function that formats date ranges into strings
|
|
2748
2979
|
*
|
|
2749
2980
|
* @example
|
|
2750
2981
|
* ```ts
|
|
@@ -2781,6 +3012,7 @@ function _object_spread$c(target) {
|
|
|
2781
3012
|
* @param range - date range to format
|
|
2782
3013
|
* @param inputConfig - format function or full configuration
|
|
2783
3014
|
* @param separator - optional separator override when inputConfig is a function
|
|
3015
|
+
* @returns the formatted date range string
|
|
2784
3016
|
*
|
|
2785
3017
|
* @example
|
|
2786
3018
|
* ```ts
|
|
@@ -2804,6 +3036,7 @@ function _object_spread$c(target) {
|
|
|
2804
3036
|
* (e.g., "3 hours", "about 2 days"). Delegates to date-fns `formatDistance` or `formatDistanceStrict`.
|
|
2805
3037
|
*
|
|
2806
3038
|
* @param inputConfig - controls distance formatting, optional transforms, and same-day handling
|
|
3039
|
+
* @returns a reusable function that computes and formats date range distances
|
|
2807
3040
|
*
|
|
2808
3041
|
* @example
|
|
2809
3042
|
* ```ts
|
|
@@ -2857,6 +3090,7 @@ function _object_spread$c(target) {
|
|
|
2857
3090
|
*
|
|
2858
3091
|
* @param range - date range to compute distance for
|
|
2859
3092
|
* @param inputConfig - optional distance formatting configuration
|
|
3093
|
+
* @returns the human-readable distance string
|
|
2860
3094
|
*
|
|
2861
3095
|
* @example
|
|
2862
3096
|
* ```ts
|
|
@@ -2897,7 +3131,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2897
3131
|
end = endOrFormat;
|
|
2898
3132
|
}
|
|
2899
3133
|
}
|
|
2900
|
-
var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat :
|
|
3134
|
+
var format = inputFormat !== null && inputFormat !== void 0 ? inputFormat : formatToMonthDaySlashDate;
|
|
2901
3135
|
return formatDateRange(dateOrDateRangeToDateRange(startOrDateRange, end), {
|
|
2902
3136
|
format: format,
|
|
2903
3137
|
simplifySameDate: true
|
|
@@ -2908,6 +3142,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2908
3142
|
* instead of throwing.
|
|
2909
3143
|
*
|
|
2910
3144
|
* @param input - date, date string, or nullish value
|
|
3145
|
+
* @returns the ISO 8601 date string, or `undefined` if the input is invalid or nullish
|
|
2911
3146
|
*
|
|
2912
3147
|
* @example
|
|
2913
3148
|
* ```ts
|
|
@@ -2930,6 +3165,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2930
3165
|
* Formats a Date to a full ISO 8601 date-time string via `Date.toISOString()`. Defaults to the current date/time.
|
|
2931
3166
|
*
|
|
2932
3167
|
* @param date - date to format; defaults to `new Date()`
|
|
3168
|
+
* @returns the full ISO 8601 date-time string
|
|
2933
3169
|
*
|
|
2934
3170
|
* @example
|
|
2935
3171
|
* ```ts
|
|
@@ -2949,6 +3185,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2949
3185
|
* Use {@link toISO8601DayStringForUTC} when the UTC date is needed instead.
|
|
2950
3186
|
*
|
|
2951
3187
|
* @param dateOrString - date or existing day string
|
|
3188
|
+
* @returns the ISO 8601 day string in system timezone
|
|
2952
3189
|
*
|
|
2953
3190
|
* @example
|
|
2954
3191
|
* ```ts
|
|
@@ -2968,6 +3205,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2968
3205
|
* Defaults to the current date.
|
|
2969
3206
|
*
|
|
2970
3207
|
* @param date - date to format; defaults to `new Date()`
|
|
3208
|
+
* @returns the ISO 8601 day string in system timezone
|
|
2971
3209
|
*
|
|
2972
3210
|
* @example
|
|
2973
3211
|
* ```ts
|
|
@@ -2987,6 +3225,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
2987
3225
|
* Use {@link toISO8601DayStringForSystem} when the system-local date is needed instead.
|
|
2988
3226
|
*
|
|
2989
3227
|
* @param dateOrString - date or existing day string
|
|
3228
|
+
* @returns the ISO 8601 day string in UTC
|
|
2990
3229
|
*
|
|
2991
3230
|
* @example
|
|
2992
3231
|
* ```ts
|
|
@@ -3007,6 +3246,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3007
3246
|
* Defaults to the current date.
|
|
3008
3247
|
*
|
|
3009
3248
|
* @param date - date to format; defaults to `new Date()`
|
|
3249
|
+
* @returns the ISO 8601 day string using UTC date components
|
|
3010
3250
|
*
|
|
3011
3251
|
* @example
|
|
3012
3252
|
* ```ts
|
|
@@ -3019,11 +3259,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3019
3259
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
3020
3260
|
return "".concat(date.getUTCFullYear(), "-").concat((date.getUTCMonth() + 1).toString().padStart(2, '0'), "-").concat(date.getUTCDate().toString().padStart(2, '0'));
|
|
3021
3261
|
}
|
|
3022
|
-
/**
|
|
3262
|
+
/**
|
|
3263
|
+
* date-fns format string for `MM/dd/yyyy` (e.g., `"01/15/2024"`).
|
|
3264
|
+
*/ var MONTH_DAY_SLASH_DATE_STRING_FORMAT = 'MM/dd/yyyy';
|
|
3265
|
+
/**
|
|
3266
|
+
* @deprecated Use MONTH_DAY_SLASH_DATE_STRING_FORMAT instead.
|
|
3267
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3268
|
+
var monthDaySlashDateStringFormat = MONTH_DAY_SLASH_DATE_STRING_FORMAT;
|
|
3023
3269
|
/**
|
|
3024
3270
|
* Formats a Date as a month/day/year slash-separated string (`MM/dd/yyyy`). Defaults to the current date.
|
|
3025
3271
|
*
|
|
3026
3272
|
* @param date - date to format; defaults to `new Date()`
|
|
3273
|
+
* @returns the formatted `MM/dd/yyyy` string
|
|
3027
3274
|
*
|
|
3028
3275
|
* @example
|
|
3029
3276
|
* ```ts
|
|
@@ -3034,16 +3281,23 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3034
3281
|
* ```
|
|
3035
3282
|
*/ function formatToMonthDaySlashDate() {
|
|
3036
3283
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
3037
|
-
return format$1(date,
|
|
3284
|
+
return format$1(date, MONTH_DAY_SLASH_DATE_STRING_FORMAT);
|
|
3038
3285
|
}
|
|
3039
3286
|
/**
|
|
3040
3287
|
* @deprecated use formatToMonthDaySlashDate instead.
|
|
3041
3288
|
*/ var formatToShortDateString = formatToMonthDaySlashDate;
|
|
3042
|
-
/**
|
|
3289
|
+
/**
|
|
3290
|
+
* date-fns format string for `MM/dd` (e.g., `"01/15"`).
|
|
3291
|
+
*/ var DATE_MONTH_DAY_STRING_FORMAT = 'MM/dd';
|
|
3292
|
+
/**
|
|
3293
|
+
* @deprecated Use DATE_MONTH_DAY_STRING_FORMAT instead.
|
|
3294
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3295
|
+
var dateMonthDayStringFormat = DATE_MONTH_DAY_STRING_FORMAT;
|
|
3043
3296
|
/**
|
|
3044
3297
|
* Formats a Date as a month/day string (`MM/dd`) without the year. Defaults to the current date.
|
|
3045
3298
|
*
|
|
3046
3299
|
* @param date - date to format; defaults to `new Date()`
|
|
3300
|
+
* @returns the formatted `MM/dd` string
|
|
3047
3301
|
*
|
|
3048
3302
|
* @example
|
|
3049
3303
|
* ```ts
|
|
@@ -3054,12 +3308,13 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3054
3308
|
* ```
|
|
3055
3309
|
*/ function formatToMonthDayString() {
|
|
3056
3310
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
3057
|
-
return format$1(date,
|
|
3311
|
+
return format$1(date, DATE_MONTH_DAY_STRING_FORMAT);
|
|
3058
3312
|
}
|
|
3059
3313
|
/**
|
|
3060
3314
|
* Formats a Date as a human-friendly weekday and month/day string (e.g., `"Mon, Jan 15th"`).
|
|
3061
3315
|
*
|
|
3062
3316
|
* @param date - date to format
|
|
3317
|
+
* @returns the formatted weekday and month/day string
|
|
3063
3318
|
*
|
|
3064
3319
|
* @example
|
|
3065
3320
|
* ```ts
|
|
@@ -3071,11 +3326,18 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3071
3326
|
*/ function formatToDateString(date) {
|
|
3072
3327
|
return format$1(date, 'EEE, MMM do');
|
|
3073
3328
|
}
|
|
3074
|
-
/**
|
|
3329
|
+
/**
|
|
3330
|
+
* date-fns format string for 12-hour time with AM/PM (e.g., `"9:00 AM"`).
|
|
3331
|
+
*/ var DATE_TIME_STRING_FORMAT = 'h:mm a';
|
|
3332
|
+
/**
|
|
3333
|
+
* @deprecated Use DATE_TIME_STRING_FORMAT instead.
|
|
3334
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3335
|
+
var dateTimeStringFormat = DATE_TIME_STRING_FORMAT;
|
|
3075
3336
|
/**
|
|
3076
3337
|
* Formats a Date as a 12-hour time string with AM/PM (e.g., `"9:00 AM"`).
|
|
3077
3338
|
*
|
|
3078
3339
|
* @param date - date to format
|
|
3340
|
+
* @returns the formatted 12-hour time string with AM/PM
|
|
3079
3341
|
*
|
|
3080
3342
|
* @example
|
|
3081
3343
|
* ```ts
|
|
@@ -3085,13 +3347,20 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3085
3347
|
* // "2:30 PM"
|
|
3086
3348
|
* ```
|
|
3087
3349
|
*/ function formatToTimeString(date) {
|
|
3088
|
-
return format$1(date,
|
|
3350
|
+
return format$1(date, DATE_TIME_STRING_FORMAT);
|
|
3089
3351
|
}
|
|
3090
|
-
/**
|
|
3352
|
+
/**
|
|
3353
|
+
* Combined date-fns format string for `MM/dd/yyyy h:mm a` (e.g., `"01/15/2024 9:00 AM"`).
|
|
3354
|
+
*/ var DATE_SHORT_DATE_AND_TIME_STRING_FORMAT = "".concat(MONTH_DAY_SLASH_DATE_STRING_FORMAT, " ").concat(DATE_TIME_STRING_FORMAT);
|
|
3355
|
+
/**
|
|
3356
|
+
* @deprecated Use DATE_SHORT_DATE_AND_TIME_STRING_FORMAT instead.
|
|
3357
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3358
|
+
var dateShortDateAndTimeStringFormat = DATE_SHORT_DATE_AND_TIME_STRING_FORMAT;
|
|
3091
3359
|
/**
|
|
3092
3360
|
* Formats a Date as a short date and time string (e.g., `"01/15/2024 9:00 AM"`).
|
|
3093
3361
|
*
|
|
3094
3362
|
* @param date - date to format
|
|
3363
|
+
* @returns the formatted short date and time string
|
|
3095
3364
|
*
|
|
3096
3365
|
* @example
|
|
3097
3366
|
* ```ts
|
|
@@ -3101,7 +3370,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3101
3370
|
* // "01/15/2024 2:30 PM"
|
|
3102
3371
|
* ```
|
|
3103
3372
|
*/ function formatToShortDateAndTimeString(date) {
|
|
3104
|
-
return format$1(date,
|
|
3373
|
+
return format$1(date, DATE_SHORT_DATE_AND_TIME_STRING_FORMAT);
|
|
3105
3374
|
}
|
|
3106
3375
|
/**
|
|
3107
3376
|
* Formats a start time with an appended duration indicator. For durations over 2 hours, uses
|
|
@@ -3109,6 +3378,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3109
3378
|
*
|
|
3110
3379
|
* @param start - start date/time
|
|
3111
3380
|
* @param end - end date/time
|
|
3381
|
+
* @returns the formatted time string with an appended duration indicator
|
|
3112
3382
|
*
|
|
3113
3383
|
* @example
|
|
3114
3384
|
* ```ts
|
|
@@ -3130,7 +3400,8 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3130
3400
|
includeSeconds: false
|
|
3131
3401
|
}), ")");
|
|
3132
3402
|
} else {
|
|
3133
|
-
|
|
3403
|
+
var minutesLabel = minutes ? "(".concat(minutes, " Minutes)") : '';
|
|
3404
|
+
subtitle = minutesLabel;
|
|
3134
3405
|
}
|
|
3135
3406
|
return "".concat(formatToTimeString(start), " ").concat(subtitle);
|
|
3136
3407
|
}
|
|
@@ -3153,6 +3424,11 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3153
3424
|
* formatStartedEndedDistanceString(activeRange);
|
|
3154
3425
|
* // "started about 1 hour ago"
|
|
3155
3426
|
* ```
|
|
3427
|
+
*
|
|
3428
|
+
* @param dateRange - date range with start and end dates
|
|
3429
|
+
* @param dateRange.start - the start date of the range
|
|
3430
|
+
* @param dateRange.end - the end date of the range
|
|
3431
|
+
* @returns the relative-time label describing the date range state
|
|
3156
3432
|
*/ function formatStartedEndedDistanceString(param) {
|
|
3157
3433
|
var start = param.start, end = param.end;
|
|
3158
3434
|
var state = dateRangeRelativeState({
|
|
@@ -3184,6 +3460,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3184
3460
|
* Useful for converting heterogeneous date inputs into a consistent midnight-aligned Date.
|
|
3185
3461
|
*
|
|
3186
3462
|
* @param input - date or day string to normalize
|
|
3463
|
+
* @returns a Date set to midnight of the corresponding day in the system timezone
|
|
3187
3464
|
*
|
|
3188
3465
|
* @example
|
|
3189
3466
|
* ```ts
|
|
@@ -3203,6 +3480,7 @@ function formatToDayRangeString(startOrDateRange, endOrFormat, inputFormat) {
|
|
|
3203
3480
|
* in the system timezone. Supports year formats with more than 4 digits but does not support negative years.
|
|
3204
3481
|
*
|
|
3205
3482
|
* @param dayString - ISO 8601 day or date string to parse
|
|
3483
|
+
* @returns a Date at the start of the parsed day in the system timezone
|
|
3206
3484
|
*
|
|
3207
3485
|
* @example
|
|
3208
3486
|
* ```ts
|
|
@@ -3419,6 +3697,11 @@ function _type_of$5(obj) {
|
|
|
3419
3697
|
* The end date is used just to determine the number of days, but a minimum of 1 day is always enforced as a DateCellTiming must contain atleast 1 day.
|
|
3420
3698
|
*
|
|
3421
3699
|
* The start date from the inputDate is considered to to have the offset noted in DateCell, and will be retained.
|
|
3700
|
+
*
|
|
3701
|
+
* @param durationInput - the duration span containing the startsAt time and event duration in minutes
|
|
3702
|
+
* @param rangeInput - specifies the date range: a number of days, a DateRange, or a DateRangeDayDistanceInput
|
|
3703
|
+
* @param timezoneInput - optional timezone configuration; defaults to the system timezone if omitted
|
|
3704
|
+
* @returns a fully computed FullDateCellTiming with start, startsAt, end, duration, and timezone
|
|
3422
3705
|
*/ function dateCellTiming(durationInput, rangeInput, timezoneInput) {
|
|
3423
3706
|
var duration = durationInput.duration;
|
|
3424
3707
|
if (duration > MINUTES_IN_DAY) {
|
|
@@ -3473,7 +3756,12 @@ function _type_of$5(obj) {
|
|
|
3473
3756
|
var utcDay = formatToISO8601DayStringForUTC(startsAtInUtc);
|
|
3474
3757
|
var start = normalInstance.startOfDayInTargetTimezone(utcDay);
|
|
3475
3758
|
var safeMirror = isEqualDate(startsAtInUtc, startsAtInUtcInitial);
|
|
3476
|
-
var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate(
|
|
3759
|
+
var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
|
|
3760
|
+
baseDate: startsAtInUtc,
|
|
3761
|
+
originalContextDate: inputStartsAt,
|
|
3762
|
+
contextType: 'target',
|
|
3763
|
+
safeConvert: safeMirror
|
|
3764
|
+
}), startsAt = _normalInstance_safeMirroredConvertDate.date, daylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
|
|
3477
3765
|
// calculate end to be the ending date/time of the final duration span
|
|
3478
3766
|
var lastStartsAtInBaseTimezone = addHours(startsAtInUtc, numberOfDayBlocks * 24 + daylightSavingsOffset); // use addHours instead of addDays, since addDays will take into account a daylight savings change if the system time changes
|
|
3479
3767
|
var lastStartInTarget = normalInstance.targetDateToBaseDate(lastStartsAtInBaseTimezone);
|
|
@@ -3551,11 +3839,12 @@ function _type_of$5(obj) {
|
|
|
3551
3839
|
* @param input - value to check
|
|
3552
3840
|
* @returns whether the input matches the DateCellTiming shape
|
|
3553
3841
|
*/ function isDateCellTiming(input) {
|
|
3842
|
+
var result = false;
|
|
3554
3843
|
if ((typeof input === "undefined" ? "undefined" : _type_of$5(input)) === 'object') {
|
|
3555
3844
|
var asTiming = input;
|
|
3556
|
-
|
|
3845
|
+
result = isDate(asTiming.startsAt) && isDate(asTiming.end) && typeof asTiming.timezone === 'string' && typeof asTiming.duration === 'number';
|
|
3557
3846
|
}
|
|
3558
|
-
return
|
|
3847
|
+
return result;
|
|
3559
3848
|
}
|
|
3560
3849
|
/**
|
|
3561
3850
|
* Type guard that checks whether the input has the shape of a {@link FullDateCellTiming} (includes `start` field plus all DateCellTiming fields).
|
|
@@ -3565,11 +3854,12 @@ function _type_of$5(obj) {
|
|
|
3565
3854
|
* @param input - value to check
|
|
3566
3855
|
* @returns whether the input matches the FullDateCellTiming shape
|
|
3567
3856
|
*/ function isFullDateCellTiming(input) {
|
|
3857
|
+
var result = false;
|
|
3568
3858
|
if ((typeof input === "undefined" ? "undefined" : _type_of$5(input)) === 'object') {
|
|
3569
3859
|
var asTiming = input;
|
|
3570
|
-
|
|
3860
|
+
result = isDate(asTiming.start) && isDateCellTiming(asTiming);
|
|
3571
3861
|
}
|
|
3572
|
-
return
|
|
3862
|
+
return result;
|
|
3573
3863
|
}
|
|
3574
3864
|
/**
|
|
3575
3865
|
* Derives a {@link DateCellTimingDateRange} from a timing, using midnight in the timing's timezone as the start and the event's end time as the end.
|
|
@@ -3731,8 +4021,16 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
3731
4021
|
var normalInstance = dateTimezoneUtcNormal(timezone);
|
|
3732
4022
|
var startsAtInUtcNormal = normalInstance.baseDateToTargetDate(startsAt); // convert to UTC normal
|
|
3733
4023
|
var endInUtcNormal = normalInstance.baseDateToTargetDate(end);
|
|
3734
|
-
var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate(
|
|
3735
|
-
|
|
4024
|
+
var _normalInstance_safeMirroredConvertDate = normalInstance.safeMirroredConvertDate({
|
|
4025
|
+
baseDate: startsAtInUtcNormal,
|
|
4026
|
+
originalContextDate: startsAt,
|
|
4027
|
+
contextType: 'target'
|
|
4028
|
+
}), startDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate.daylightSavingsOffset;
|
|
4029
|
+
var _normalInstance_safeMirroredConvertDate1 = normalInstance.safeMirroredConvertDate({
|
|
4030
|
+
baseDate: endInUtcNormal,
|
|
4031
|
+
originalContextDate: end,
|
|
4032
|
+
contextType: 'target'
|
|
4033
|
+
}), endDaylightSavingsOffset = _normalInstance_safeMirroredConvertDate1.daylightSavingsOffset;
|
|
3736
4034
|
if (startDaylightSavingsOffset) {
|
|
3737
4035
|
startsAtInUtcNormal = addHours(startsAtInUtcNormal, startDaylightSavingsOffset);
|
|
3738
4036
|
}
|
|
@@ -3818,7 +4116,7 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
3818
4116
|
isExpectedValidEnd = expectedDuration === duration; // should be the expected duration
|
|
3819
4117
|
isValid = isExpectedValidEnd;
|
|
3820
4118
|
}
|
|
3821
|
-
|
|
4119
|
+
return {
|
|
3822
4120
|
isValid: isValid,
|
|
3823
4121
|
endIsAfterTheStartsAtTime: endIsAfterTheStartsAtTime,
|
|
3824
4122
|
durationGreaterThanZero: durationGreaterThanZero,
|
|
@@ -3827,7 +4125,6 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
3827
4125
|
isExpectedValidEnd: isExpectedValidEnd,
|
|
3828
4126
|
normalInstance: normalInstance
|
|
3829
4127
|
};
|
|
3830
|
-
return result;
|
|
3831
4128
|
}
|
|
3832
4129
|
/**
|
|
3833
4130
|
* Returns true if the {@link DateCellTiming} passes all validation checks.
|
|
@@ -3892,13 +4189,13 @@ function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
3892
4189
|
return isValid;
|
|
3893
4190
|
}
|
|
3894
4191
|
|
|
3895
|
-
function _array_like_to_array$
|
|
4192
|
+
function _array_like_to_array$6(arr, len) {
|
|
3896
4193
|
if (len == null || len > arr.length) len = arr.length;
|
|
3897
4194
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3898
4195
|
return arr2;
|
|
3899
4196
|
}
|
|
3900
|
-
function _array_without_holes$
|
|
3901
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
4197
|
+
function _array_without_holes$4(arr) {
|
|
4198
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
3902
4199
|
}
|
|
3903
4200
|
function _define_property$c(obj, key, value) {
|
|
3904
4201
|
if (key in obj) {
|
|
@@ -3913,10 +4210,10 @@ function _define_property$c(obj, key, value) {
|
|
|
3913
4210
|
}
|
|
3914
4211
|
return obj;
|
|
3915
4212
|
}
|
|
3916
|
-
function _iterable_to_array$
|
|
4213
|
+
function _iterable_to_array$4(iter) {
|
|
3917
4214
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3918
4215
|
}
|
|
3919
|
-
function _non_iterable_spread$
|
|
4216
|
+
function _non_iterable_spread$4() {
|
|
3920
4217
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3921
4218
|
}
|
|
3922
4219
|
function _object_spread$a(target) {
|
|
@@ -3953,20 +4250,20 @@ function _object_spread_props$8(target, source) {
|
|
|
3953
4250
|
}
|
|
3954
4251
|
return target;
|
|
3955
4252
|
}
|
|
3956
|
-
function _to_consumable_array$
|
|
3957
|
-
return _array_without_holes$
|
|
4253
|
+
function _to_consumable_array$4(arr) {
|
|
4254
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
|
|
3958
4255
|
}
|
|
3959
4256
|
function _type_of$4(obj) {
|
|
3960
4257
|
"@swc/helpers - typeof";
|
|
3961
4258
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
3962
4259
|
}
|
|
3963
|
-
function _unsupported_iterable_to_array$
|
|
4260
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
3964
4261
|
if (!o) return;
|
|
3965
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4262
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
3966
4263
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3967
4264
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3968
4265
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3969
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4266
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
3970
4267
|
}
|
|
3971
4268
|
/**
|
|
3972
4269
|
* Returns true if the input is a DateCellRange.
|
|
@@ -3974,6 +4271,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
3974
4271
|
* Does not check validity. Use {@link isValidDateCellRange} for that.
|
|
3975
4272
|
*
|
|
3976
4273
|
* @param input - value to check
|
|
4274
|
+
* @returns true if the input is a DateCellRange
|
|
3977
4275
|
*/ function isDateCellRange(input) {
|
|
3978
4276
|
return (typeof input === "undefined" ? "undefined" : _type_of$4(input)) === 'object' ? Number.isInteger(input.i) && input.to === undefined || Number.isInteger(input.to) : false;
|
|
3979
4277
|
}
|
|
@@ -3984,6 +4282,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
3984
4282
|
* that is greater than or equal to `i`.
|
|
3985
4283
|
*
|
|
3986
4284
|
* @param input - range to validate
|
|
4285
|
+
* @returns true if the range has valid non-negative indexes and `to` (when defined) is greater than or equal to `i`
|
|
3987
4286
|
*/ function isValidDateCellRange(input) {
|
|
3988
4287
|
var i = input.i, to = input.to;
|
|
3989
4288
|
if (!isValidDateCellIndex(i)) {
|
|
@@ -3999,6 +4298,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
3999
4298
|
* Validates that each range is individually valid and that no ranges overlap or appear out of order.
|
|
4000
4299
|
*
|
|
4001
4300
|
* @param input - array of ranges to validate as a non-overlapping ascending series
|
|
4301
|
+
* @returns true if the array is sorted in ascending order with no overlapping or duplicate indexes
|
|
4002
4302
|
*/ function isValidDateCellRangeSeries(input) {
|
|
4003
4303
|
if (!Array.isArray(input)) {
|
|
4004
4304
|
return false;
|
|
@@ -4010,13 +4310,30 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4010
4310
|
return false;
|
|
4011
4311
|
}
|
|
4012
4312
|
var greatestIndex = -1;
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4313
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4314
|
+
try {
|
|
4315
|
+
for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4316
|
+
var range = _step.value;
|
|
4317
|
+
if (range.i <= greatestIndex) {
|
|
4318
|
+
return false;
|
|
4319
|
+
} else {
|
|
4320
|
+
var _range_to;
|
|
4321
|
+
var nextGreatestIndex = (_range_to = range.to) !== null && _range_to !== void 0 ? _range_to : range.i; // to is greater than or equal to i in a valid date block range.
|
|
4322
|
+
greatestIndex = nextGreatestIndex;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
} catch (err) {
|
|
4326
|
+
_didIteratorError = true;
|
|
4327
|
+
_iteratorError = err;
|
|
4328
|
+
} finally{
|
|
4329
|
+
try {
|
|
4330
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4331
|
+
_iterator.return();
|
|
4332
|
+
}
|
|
4333
|
+
} finally{
|
|
4334
|
+
if (_didIteratorError) {
|
|
4335
|
+
throw _iteratorError;
|
|
4336
|
+
}
|
|
4020
4337
|
}
|
|
4021
4338
|
}
|
|
4022
4339
|
return true;
|
|
@@ -4027,6 +4344,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4027
4344
|
* The input range is not expected to be sorted.
|
|
4028
4345
|
*
|
|
4029
4346
|
* @param input - unsorted array of date cell ranges to scan
|
|
4347
|
+
* @returns the smallest starting index found, or 0 if the input is empty
|
|
4030
4348
|
*/ function getLeastDateCellIndexInDateCellRanges(input) {
|
|
4031
4349
|
var _ref;
|
|
4032
4350
|
var _getLeastAndGreatestDateCellIndexInDateCellRanges;
|
|
@@ -4038,6 +4356,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4038
4356
|
* The input range is not expected to be sorted.
|
|
4039
4357
|
*
|
|
4040
4358
|
* @param input - unsorted array of date cell ranges to scan
|
|
4359
|
+
* @returns the largest ending index found, or 0 if the input is empty
|
|
4041
4360
|
*/ function getGreatestDateCellIndexInDateCellRanges(input) {
|
|
4042
4361
|
var _ref;
|
|
4043
4362
|
var _getLeastAndGreatestDateCellIndexInDateCellRanges;
|
|
@@ -4049,6 +4368,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4049
4368
|
* The input range is not expected to be sorted.
|
|
4050
4369
|
*
|
|
4051
4370
|
* @param input - unsorted array of date cell ranges to scan
|
|
4371
|
+
* @returns an object with the least and greatest indexes and their source items, or null if the input is empty
|
|
4052
4372
|
*/ function getLeastAndGreatestDateCellIndexInDateCellRanges(input) {
|
|
4053
4373
|
if (!input.length) {
|
|
4054
4374
|
return null;
|
|
@@ -4057,17 +4377,34 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4057
4377
|
var greatestIndex = 0;
|
|
4058
4378
|
var leastIndexItem = input[0];
|
|
4059
4379
|
var greatestIndexItem = input[0];
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
var
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4380
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4381
|
+
try {
|
|
4382
|
+
for(var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4383
|
+
var range = _step.value;
|
|
4384
|
+
var _range_to;
|
|
4385
|
+
var leastRangeIndex = range.i;
|
|
4386
|
+
var greatestRangeIndex = (_range_to = range.to) !== null && _range_to !== void 0 ? _range_to : range.i;
|
|
4387
|
+
if (leastRangeIndex < leastIndex) {
|
|
4388
|
+
leastIndex = leastRangeIndex;
|
|
4389
|
+
leastIndexItem = range;
|
|
4390
|
+
}
|
|
4391
|
+
if (greatestRangeIndex > greatestIndex) {
|
|
4392
|
+
greatestIndex = greatestRangeIndex;
|
|
4393
|
+
greatestIndexItem = range;
|
|
4394
|
+
}
|
|
4067
4395
|
}
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4396
|
+
} catch (err) {
|
|
4397
|
+
_didIteratorError = true;
|
|
4398
|
+
_iteratorError = err;
|
|
4399
|
+
} finally{
|
|
4400
|
+
try {
|
|
4401
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4402
|
+
_iterator.return();
|
|
4403
|
+
}
|
|
4404
|
+
} finally{
|
|
4405
|
+
if (_didIteratorError) {
|
|
4406
|
+
throw _iteratorError;
|
|
4407
|
+
}
|
|
4071
4408
|
}
|
|
4072
4409
|
}
|
|
4073
4410
|
return {
|
|
@@ -4083,6 +4420,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4083
4420
|
*
|
|
4084
4421
|
* @param i - starting cell index
|
|
4085
4422
|
* @param to - ending cell index (inclusive); defaults to `i`
|
|
4423
|
+
* @returns a DateCellRangeWithRange spanning from `i` to `to`
|
|
4086
4424
|
*/ function dateCellRange(i, to) {
|
|
4087
4425
|
return {
|
|
4088
4426
|
i: i,
|
|
@@ -4093,6 +4431,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4093
4431
|
* Creates a single-cell {@link DateCellRangeWithRange} where both `i` and `to` equal the given index.
|
|
4094
4432
|
*
|
|
4095
4433
|
* @param dateCellIndex - the index for both start and end of the range
|
|
4434
|
+
* @returns a DateCellRangeWithRange where `i` and `to` both equal the given index
|
|
4096
4435
|
*/ function dateCellRangeWithRangeFromIndex(dateCellIndex) {
|
|
4097
4436
|
return dateCellRange(dateCellIndex, dateCellIndex);
|
|
4098
4437
|
}
|
|
@@ -4101,6 +4440,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4101
4440
|
* ensuring the result always has an explicit `to` value.
|
|
4102
4441
|
*
|
|
4103
4442
|
* @param input - index, cell, or range to normalize
|
|
4443
|
+
* @returns a DateCellRangeWithRange with an explicit `to` value
|
|
4104
4444
|
*/ function dateCellRangeWithRange(input) {
|
|
4105
4445
|
if (typeof input === 'number') {
|
|
4106
4446
|
return dateCellRangeWithRangeFromIndex(input);
|
|
@@ -4113,12 +4453,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4113
4453
|
* fully contains the configured `inputRange`.
|
|
4114
4454
|
*
|
|
4115
4455
|
* @param inputRange - the range that must be fully included
|
|
4456
|
+
* @returns a function that returns true when its argument fully contains `inputRange`
|
|
4116
4457
|
*/ function dateCellRangeIncludedByRangeFunction(inputRange) {
|
|
4117
4458
|
var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
|
|
4118
4459
|
return function(input) {
|
|
4119
|
-
var _ref;
|
|
4120
4460
|
var range = dateCellRangeWithRange(input);
|
|
4121
|
-
return range.i <= i &&
|
|
4461
|
+
return range.i <= i && range.to >= to;
|
|
4122
4462
|
};
|
|
4123
4463
|
}
|
|
4124
4464
|
/**
|
|
@@ -4126,12 +4466,12 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4126
4466
|
* has any overlap with the configured `inputRange`.
|
|
4127
4467
|
*
|
|
4128
4468
|
* @param inputRange - the range to test for overlap against
|
|
4469
|
+
* @returns a function that returns true when its argument overlaps with `inputRange`
|
|
4129
4470
|
*/ function dateCellRangeOverlapsRangeFunction(inputRange) {
|
|
4130
4471
|
var _dateCellRangeWithRange = dateCellRangeWithRange(inputRange), i = _dateCellRangeWithRange.i, to = _dateCellRangeWithRange.to;
|
|
4131
4472
|
return function(input) {
|
|
4132
|
-
var _ref;
|
|
4133
4473
|
var range = dateCellRangeWithRange(input);
|
|
4134
|
-
return range.i <= to &&
|
|
4474
|
+
return range.i <= to && range.to >= i;
|
|
4135
4475
|
};
|
|
4136
4476
|
}
|
|
4137
4477
|
/**
|
|
@@ -4139,6 +4479,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4139
4479
|
*
|
|
4140
4480
|
* @param rangeA - first range to compare
|
|
4141
4481
|
* @param rangeB - second range to compare
|
|
4482
|
+
* @returns true if the two ranges share at least one common index
|
|
4142
4483
|
*/ function dateCellRangeOverlapsRange(rangeA, rangeB) {
|
|
4143
4484
|
return dateCellRangeOverlapsRangeFunction(rangeA)(rangeB);
|
|
4144
4485
|
}
|
|
@@ -4146,6 +4487,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4146
4487
|
* Returns a sort comparator that orders ranges first by starting index (`i`), then by ending index (`to`).
|
|
4147
4488
|
*
|
|
4148
4489
|
* In many cases {@link sortAscendingIndexNumberRefFunction} may be preferential when `to` ordering is not needed.
|
|
4490
|
+
*
|
|
4491
|
+
* @returns a comparator function that sorts ranges by `i` then by `to`
|
|
4149
4492
|
*/ function sortDateCellRangeAndSizeFunction() {
|
|
4150
4493
|
return function(a, b) {
|
|
4151
4494
|
var _a_to, _b_to;
|
|
@@ -4156,6 +4499,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4156
4499
|
* Sorts the input date ranges in-place by ascending index using {@link sortAscendingIndexNumberRefFunction}.
|
|
4157
4500
|
*
|
|
4158
4501
|
* @param input - array of ranges to sort (mutated in place)
|
|
4502
|
+
* @returns the same array, sorted in ascending index order
|
|
4159
4503
|
*/ function sortDateCellRanges(input) {
|
|
4160
4504
|
return input.sort(sortAscendingIndexNumberRefFunction());
|
|
4161
4505
|
}
|
|
@@ -4166,6 +4510,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4166
4510
|
* The input is sorted internally before grouping.
|
|
4167
4511
|
*
|
|
4168
4512
|
* @param input - cells or ranges to merge into contiguous groups
|
|
4513
|
+
* @returns an array of non-overlapping contiguous DateCellRangeWithRange values
|
|
4169
4514
|
*
|
|
4170
4515
|
* @example
|
|
4171
4516
|
* ```ts
|
|
@@ -4213,6 +4558,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4213
4558
|
* Returns an array containing every individual index in the given date cell range (inclusive of both `i` and `to`).
|
|
4214
4559
|
*
|
|
4215
4560
|
* @param input - range to expand into individual indexes
|
|
4561
|
+
* @returns an array of every DateCellIndex from `i` to `to` inclusive
|
|
4216
4562
|
*/ function allIndexesInDateCellRange(input) {
|
|
4217
4563
|
return input.to != null ? range(input.i, input.to + 1) : [
|
|
4218
4564
|
input.i
|
|
@@ -4222,6 +4568,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4222
4568
|
* Flattens an array of indexes and/or ranges into a single array of individual {@link DateCellIndex} values.
|
|
4223
4569
|
*
|
|
4224
4570
|
* @param input - mix of raw indexes and ranges to flatten
|
|
4571
|
+
* @returns a flat array of all individual DateCellIndex values
|
|
4225
4572
|
*/ function allIndexesInDateCellRangesToArray(input) {
|
|
4226
4573
|
var result = [];
|
|
4227
4574
|
input.forEach(function(x) {
|
|
@@ -4238,6 +4585,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4238
4585
|
* Returns a deduplicated {@link Set} of all indexes within the input ranges.
|
|
4239
4586
|
*
|
|
4240
4587
|
* @param input - mix of raw indexes and ranges to collect
|
|
4588
|
+
* @returns a Set containing every unique DateCellIndex from the input
|
|
4241
4589
|
*/ function allIndexesInDateCellRanges(input) {
|
|
4242
4590
|
return new Set(allIndexesInDateCellRangesToArray(input));
|
|
4243
4591
|
}
|
|
@@ -4246,6 +4594,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4246
4594
|
*
|
|
4247
4595
|
* @param blocks - cells or ranges to filter
|
|
4248
4596
|
* @param range - bounding range that blocks must fall within
|
|
4597
|
+
* @returns only the blocks that fall entirely within the given range
|
|
4249
4598
|
*/ function filterDateCellsInDateCellRange(blocks, range) {
|
|
4250
4599
|
var dateCellIsWithinDateCellRange = isDateCellWithinDateCellRangeFunction(range);
|
|
4251
4600
|
return blocks.filter(dateCellIsWithinDateCellRange);
|
|
@@ -4255,6 +4604,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4255
4604
|
* is fully contained within `inputRange`.
|
|
4256
4605
|
*
|
|
4257
4606
|
* @param inputRange - the bounding range to test containment against
|
|
4607
|
+
* @returns a function that returns true when its argument is fully contained within `inputRange`
|
|
4258
4608
|
*/ function isDateCellWithinDateCellRangeFunction(inputRange) {
|
|
4259
4609
|
var range = dateCellRangeWithRange(inputRange);
|
|
4260
4610
|
return function(input) {
|
|
@@ -4276,6 +4626,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4276
4626
|
*
|
|
4277
4627
|
* @param range - the outer bounding range
|
|
4278
4628
|
* @param contains - the cell or range to test for containment
|
|
4629
|
+
* @returns true if `contains` is fully within `range`
|
|
4279
4630
|
*/ function isDateCellWithinDateCellRange(range, contains) {
|
|
4280
4631
|
return isDateCellWithinDateCellRangeFunction(range)(dateCellRangeWithRange(contains));
|
|
4281
4632
|
}
|
|
@@ -4285,6 +4636,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4285
4636
|
* Internally groups overlapping ranges before counting so each index is counted only once.
|
|
4286
4637
|
*
|
|
4287
4638
|
* @param inputDateCellRange - one or more cells/ranges to analyze
|
|
4639
|
+
* @returns count, total, and average statistics for the given ranges
|
|
4288
4640
|
*/ function dateCellRangeBlocksCountInfo(inputDateCellRange) {
|
|
4289
4641
|
var group = groupToDateCellRanges(asArray(inputDateCellRange));
|
|
4290
4642
|
var count = 0;
|
|
@@ -4307,6 +4659,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4307
4659
|
* Shorthand for `dateCellRangeBlocksCountInfo(input).count`.
|
|
4308
4660
|
*
|
|
4309
4661
|
* @param inputDateCellRange - one or more cells/ranges to count
|
|
4662
|
+
* @returns the total number of individual cell indexes
|
|
4310
4663
|
*
|
|
4311
4664
|
* @example
|
|
4312
4665
|
* ```ts
|
|
@@ -4321,13 +4674,14 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4321
4674
|
* grouped range from `ranges` fully covers a given input range.
|
|
4322
4675
|
*
|
|
4323
4676
|
* @param ranges - the covering ranges to test against
|
|
4677
|
+
* @returns a function that returns true when any single grouped range fully covers the input range
|
|
4324
4678
|
*/ function dateCellRangesFullyCoverDateCellRangeFunction(ranges) {
|
|
4325
4679
|
var groupedRanges = Array.isArray(ranges) ? groupToDateCellRanges(ranges) : [
|
|
4326
4680
|
dateCellRangeWithRange(ranges)
|
|
4327
4681
|
];
|
|
4328
4682
|
return function(inputRange) {
|
|
4329
4683
|
var fn = dateCellRangeIncludedByRangeFunction(inputRange);
|
|
4330
|
-
return groupedRanges.
|
|
4684
|
+
return groupedRanges.some(fn);
|
|
4331
4685
|
};
|
|
4332
4686
|
}
|
|
4333
4687
|
/**
|
|
@@ -4338,6 +4692,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4338
4692
|
* nearest future range's starting index is used.
|
|
4339
4693
|
*
|
|
4340
4694
|
* @param input - the current index and ranges to evaluate
|
|
4695
|
+
* @returns classification of ranges as past/present/future and the next upcoming index
|
|
4341
4696
|
*
|
|
4342
4697
|
* @example
|
|
4343
4698
|
* ```ts
|
|
@@ -4394,6 +4749,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4394
4749
|
*
|
|
4395
4750
|
* @param range - the date cell range to classify
|
|
4396
4751
|
* @param nowIndex - the reference index representing "now"
|
|
4752
|
+
* @returns 'past', 'present', or 'future' depending on the range's position relative to `nowIndex`
|
|
4397
4753
|
*/ function dateRelativeStateForDateCellRangeComparedToIndex(range, nowIndex) {
|
|
4398
4754
|
var _dateCellRange = dateCellRange(range.i, range.to), i = _dateCellRange.i, to = _dateCellRange.to;
|
|
4399
4755
|
var state;
|
|
@@ -4411,6 +4767,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4411
4767
|
* from `i` to `to` (inclusive). Each copy retains all properties of the original block.
|
|
4412
4768
|
*
|
|
4413
4769
|
* @param block - the range to expand
|
|
4770
|
+
* @returns an array of single-cell copies, one per index from `i` to `to`
|
|
4414
4771
|
*
|
|
4415
4772
|
* @example
|
|
4416
4773
|
* ```ts
|
|
@@ -4429,6 +4786,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4429
4786
|
* Returns true if the input spans more than one cell (i.e., has a `to` value strictly greater than `i`).
|
|
4430
4787
|
*
|
|
4431
4788
|
* @param input - range or cell to check
|
|
4789
|
+
* @returns true if `to` is defined and strictly greater than `i`
|
|
4432
4790
|
*/ function dateCellRangeHasRange(input) {
|
|
4433
4791
|
return input.to != null && input.to > input.i;
|
|
4434
4792
|
}
|
|
@@ -4436,6 +4794,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4436
4794
|
* Returns the effective ending index of a range: `to` if defined, otherwise `i`.
|
|
4437
4795
|
*
|
|
4438
4796
|
* @param input - range or cell to read
|
|
4797
|
+
* @returns the `to` index if defined, otherwise `i`
|
|
4439
4798
|
*/ function dateCellEndIndex(input) {
|
|
4440
4799
|
var _input_to;
|
|
4441
4800
|
return (_input_to = input.to) !== null && _input_to !== void 0 ? _input_to : input.i;
|
|
@@ -4446,8 +4805,9 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4446
4805
|
* and `to` is the maximum ending index across all blocks.
|
|
4447
4806
|
*
|
|
4448
4807
|
* @param input - cells or ranges to group
|
|
4808
|
+
* @returns a UniqueDateCellRangeGroup containing the sorted blocks with `i` at 0
|
|
4449
4809
|
*/ function groupUniqueDateCells(input) {
|
|
4450
|
-
var blocks = sortDateCellRanges(_to_consumable_array$
|
|
4810
|
+
var blocks = sortDateCellRanges(_to_consumable_array$4(input));
|
|
4451
4811
|
var i = 0;
|
|
4452
4812
|
var to;
|
|
4453
4813
|
if (blocks.length === 0) {
|
|
@@ -4468,6 +4828,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4468
4828
|
* according to the provided configuration. Handles overlap resolution, gap filling, and boundary clamping.
|
|
4469
4829
|
*
|
|
4470
4830
|
* @param config - controls start/end bounds, fill strategy, and overlap retention behavior
|
|
4831
|
+
* @returns a function that merges, fills, and resolves overlaps in date cell range arrays
|
|
4471
4832
|
*
|
|
4472
4833
|
* @example
|
|
4473
4834
|
* ```ts
|
|
@@ -4485,9 +4846,10 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4485
4846
|
var retainOnOverlap = inputRetainOnOverlap !== null && inputRetainOnOverlap !== void 0 ? inputRetainOnOverlap : 'next';
|
|
4486
4847
|
var maxAllowedIndex = endAtIndex !== null && endAtIndex !== void 0 ? endAtIndex : Number.MAX_SAFE_INTEGER;
|
|
4487
4848
|
var fillFactory = inputFillFactory;
|
|
4488
|
-
if (!
|
|
4849
|
+
if (!inputFillFactory && fill === 'fill') {
|
|
4489
4850
|
throw new Error('fillFactory is required when fillOption is "fill".');
|
|
4490
4851
|
}
|
|
4852
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
4491
4853
|
return function(input, newBlocks) {
|
|
4492
4854
|
var addBlockWithRange = function addBlockWithRange(inputBlock, i) {
|
|
4493
4855
|
var inputTo = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : i;
|
|
@@ -4525,7 +4887,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4525
4887
|
to: to
|
|
4526
4888
|
};
|
|
4527
4889
|
var block = fillFactory(dateCellRange);
|
|
4528
|
-
addBlockWithRange(block, i, to
|
|
4890
|
+
addBlockWithRange(block, i, to);
|
|
4529
4891
|
} else if (fill === 'empty') ; else if (blocks.length > 0) {
|
|
4530
4892
|
// only extend if one or more blocks have been pushed
|
|
4531
4893
|
var blockToExtend = lastValue(blocks);
|
|
@@ -4546,6 +4908,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4546
4908
|
};
|
|
4547
4909
|
var shouldRetainCurrentOverNext = /**
|
|
4548
4910
|
* Used to determine how to handle two neighboring objects.
|
|
4911
|
+
*
|
|
4912
|
+
* @returns true if the current block should be retained over the next block
|
|
4549
4913
|
*/ function shouldRetainCurrentOverNext() {
|
|
4550
4914
|
if (current.priority === next.priority) {
|
|
4551
4915
|
return retainOnOverlap === 'current';
|
|
@@ -4586,6 +4950,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4586
4950
|
priority: priority
|
|
4587
4951
|
} : sorted[i];
|
|
4588
4952
|
next = sorted[i + 1];
|
|
4953
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- next may be undefined when sorted[i+1] is out of bounds
|
|
4589
4954
|
if (next) {
|
|
4590
4955
|
nextStartIndex = next.block.i;
|
|
4591
4956
|
// complete loop once past the max allowed index
|
|
@@ -4702,6 +5067,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4702
5067
|
}
|
|
4703
5068
|
}
|
|
4704
5069
|
}
|
|
5070
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- current may be undefined when sorted is empty
|
|
4705
5071
|
if (current != null) {
|
|
4706
5072
|
// if current != null, then atleast one block was input/remaining.
|
|
4707
5073
|
var lastStartIndex = current.block.i;
|
|
@@ -4716,12 +5082,11 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
4716
5082
|
} else if (fill === 'fill') {
|
|
4717
5083
|
completeBlocks();
|
|
4718
5084
|
}
|
|
4719
|
-
|
|
5085
|
+
return {
|
|
4720
5086
|
i: 0,
|
|
4721
5087
|
blocks: blocks,
|
|
4722
5088
|
discarded: discarded
|
|
4723
5089
|
};
|
|
4724
|
-
return result;
|
|
4725
5090
|
};
|
|
4726
5091
|
}
|
|
4727
5092
|
|
|
@@ -4784,6 +5149,9 @@ function _type_of$3(obj) {
|
|
|
4784
5149
|
* When `limitToCompletedIndexes` is true, only indexes whose timing duration has fully elapsed are included,
|
|
4785
5150
|
* with the max boundary lazily refreshed as time passes.
|
|
4786
5151
|
*
|
|
5152
|
+
* @param config - Configuration specifying the timing, range fit, and completion constraints.
|
|
5153
|
+
* @returns A factory function that produces a clamped {@link DateCellRangeWithRange} from optional start/end input.
|
|
5154
|
+
*
|
|
4787
5155
|
* @example
|
|
4788
5156
|
* ```ts
|
|
4789
5157
|
* const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
|
|
@@ -4859,6 +5227,10 @@ function _type_of$3(obj) {
|
|
|
4859
5227
|
* Computes a {@link DateCellRangeWithRange} from a timing and optional start/end input.
|
|
4860
5228
|
*
|
|
4861
5229
|
* Shorthand for creating a {@link dateCellRangeOfTimingFactory} and immediately invoking it.
|
|
5230
|
+
*
|
|
5231
|
+
* @param config - A {@link DateCellTiming} or full factory configuration.
|
|
5232
|
+
* @param input - Optional start/end boundaries for the range.
|
|
5233
|
+
* @returns A clamped {@link DateCellRangeWithRange} derived from the timing and input.
|
|
4862
5234
|
*/ function dateCellRangeOfTiming(config, input) {
|
|
4863
5235
|
return dateCellRangeOfTimingFactory(isDateCellTiming(config) ? {
|
|
4864
5236
|
timing: config
|
|
@@ -4869,6 +5241,10 @@ function _type_of$3(obj) {
|
|
|
4869
5241
|
* of the timing schedule. Useful for determining which days have already finished.
|
|
4870
5242
|
*
|
|
4871
5243
|
* By default fitToTimingRange is true.
|
|
5244
|
+
*
|
|
5245
|
+
* @param timing - The timing schedule to evaluate.
|
|
5246
|
+
* @param config - Optional configuration for the current time reference and range fitting.
|
|
5247
|
+
* @returns A {@link DateCellRangeWithRange} covering only the completed day indexes.
|
|
4872
5248
|
*/ function dateCellTimingCompletedTimeRange(timing, config) {
|
|
4873
5249
|
var _ref;
|
|
4874
5250
|
return dateCellRangeOfTiming({
|
|
@@ -4882,6 +5258,10 @@ function _type_of$3(obj) {
|
|
|
4882
5258
|
* Returns the latest completed day index for a {@link DateCellTiming}.
|
|
4883
5259
|
*
|
|
4884
5260
|
* Returns -1 if no days have been completed yet.
|
|
5261
|
+
*
|
|
5262
|
+
* @param timing - The timing schedule to evaluate.
|
|
5263
|
+
* @param now - Optional reference time; defaults to the current time.
|
|
5264
|
+
* @returns The zero-based index of the last fully completed day, or -1 if none.
|
|
4885
5265
|
*/ function dateCellTimingLatestCompletedIndex(timing, now) {
|
|
4886
5266
|
return dateCellTimingCompletedTimeRange(timing, {
|
|
4887
5267
|
now: now
|
|
@@ -4889,6 +5269,9 @@ function _type_of$3(obj) {
|
|
|
4889
5269
|
}
|
|
4890
5270
|
/**
|
|
4891
5271
|
* Converts a {@link DateCellRange} (inclusive `to`) to a {@link DateCellIndexRange} (exclusive `maxIndex`).
|
|
5272
|
+
*
|
|
5273
|
+
* @param range - The inclusive date cell range to convert.
|
|
5274
|
+
* @returns A {@link DateCellIndexRange} with exclusive `maxIndex`.
|
|
4892
5275
|
*/ function dateCellRangeToDateCellIndexRange(range) {
|
|
4893
5276
|
var _range_to;
|
|
4894
5277
|
return {
|
|
@@ -4898,6 +5281,9 @@ function _type_of$3(obj) {
|
|
|
4898
5281
|
}
|
|
4899
5282
|
/**
|
|
4900
5283
|
* Converts a {@link DateCellIndexRange} (exclusive `maxIndex`) back to a {@link DateCellRangeWithRange} (inclusive `to`).
|
|
5284
|
+
*
|
|
5285
|
+
* @param range - The exclusive date cell index range to convert.
|
|
5286
|
+
* @returns A {@link DateCellRangeWithRange} with inclusive `to`.
|
|
4901
5287
|
*/ function dateCellIndexRangeToDateCellRange(range) {
|
|
4902
5288
|
return {
|
|
4903
5289
|
i: range.minIndex,
|
|
@@ -4909,6 +5295,11 @@ function _type_of$3(obj) {
|
|
|
4909
5295
|
*
|
|
4910
5296
|
* An arbitrary limit can also be applied. When `fitToTimingRange` is true (default),
|
|
4911
5297
|
* the limit is intersected with the timing's own range; otherwise the limit is used as-is.
|
|
5298
|
+
*
|
|
5299
|
+
* @param timing - The timing schedule to derive the range from.
|
|
5300
|
+
* @param limit - Optional range input to constrain the output.
|
|
5301
|
+
* @param fitToTimingRange - Whether to intersect the limit with the timing's own range. Defaults to true.
|
|
5302
|
+
* @returns A {@link DateCellIndexRange} representing the computed index bounds.
|
|
4912
5303
|
*/ function dateCellIndexRange(timing, limit) {
|
|
4913
5304
|
var fitToTimingRange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
4914
5305
|
var indexFactory = dateCellTimingRelativeIndexFactory(timing);
|
|
@@ -4937,6 +5328,9 @@ function _type_of$3(obj) {
|
|
|
4937
5328
|
* by combining its timing and blocks.
|
|
4938
5329
|
*
|
|
4939
5330
|
* Shorthand for calling {@link expandDateCellTiming} with `collection.timing` and `collection.blocks`.
|
|
5331
|
+
*
|
|
5332
|
+
* @param collection - The date cell collection containing timing and blocks to expand.
|
|
5333
|
+
* @returns An array of {@link DateCellDurationSpan} values with concrete start times and durations.
|
|
4940
5334
|
*/ function expandDateCellCollection(collection) {
|
|
4941
5335
|
return expandDateCellTiming(collection.timing, collection.blocks);
|
|
4942
5336
|
}
|
|
@@ -4944,6 +5338,10 @@ function _type_of$3(obj) {
|
|
|
4944
5338
|
* Expands the given blocks into {@link DateCellDurationSpan} values using the provided timing.
|
|
4945
5339
|
*
|
|
4946
5340
|
* Shorthand for creating a {@link dateCellTimingExpansionFactory} and immediately invoking it.
|
|
5341
|
+
*
|
|
5342
|
+
* @param timing - The timing schedule providing start times and duration.
|
|
5343
|
+
* @param blocks - The date cell blocks to expand into duration spans.
|
|
5344
|
+
* @returns An array of {@link DateCellDurationSpan} values with concrete start times.
|
|
4947
5345
|
*/ function expandDateCellTiming(timing, blocks) {
|
|
4948
5346
|
return dateCellTimingExpansionFactory({
|
|
4949
5347
|
timing: timing
|
|
@@ -4957,6 +5355,9 @@ function _type_of$3(obj) {
|
|
|
4957
5355
|
* Filtering is applied both at the block level and at the computed duration span level,
|
|
4958
5356
|
* and evaluation can be capped for performance with large datasets.
|
|
4959
5357
|
*
|
|
5358
|
+
* @param config - Configuration specifying the timing, range limits, filters, and output caps.
|
|
5359
|
+
* @returns A factory function that expands date cell blocks into {@link DateCellDurationSpan} arrays.
|
|
5360
|
+
*
|
|
4960
5361
|
* @example
|
|
4961
5362
|
* ```ts
|
|
4962
5363
|
* const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
|
|
@@ -5054,6 +5455,9 @@ function _type_of$3(obj) {
|
|
|
5054
5455
|
* const dateInfo = infoFactory(someDate);
|
|
5055
5456
|
* console.log(dateInfo.dayIndex); // which day index this date falls on
|
|
5056
5457
|
* ```
|
|
5458
|
+
*
|
|
5459
|
+
* @param config - Configuration providing the timing and optional range limit.
|
|
5460
|
+
* @returns A factory that computes {@link DateCellDayTimingInfo} for any date or day index.
|
|
5057
5461
|
*/ function dateCellDayTimingInfoFactory(config) {
|
|
5058
5462
|
var timing = config.timing, rangeLimit = config.rangeLimit;
|
|
5059
5463
|
var duration = timing.duration;
|
|
@@ -5118,8 +5522,11 @@ function _type_of$3(obj) {
|
|
|
5118
5522
|
* Type guard that returns true if the input is a {@link DateCellTimingRelativeIndexFactory}.
|
|
5119
5523
|
*
|
|
5120
5524
|
* Checks for the presence of `_timing` and `_normalInstance` properties on a function.
|
|
5525
|
+
*
|
|
5526
|
+
* @param input - The value to check.
|
|
5527
|
+
* @returns True if the input is a {@link DateCellTimingRelativeIndexFactory}.
|
|
5121
5528
|
*/ function isDateCellTimingRelativeIndexFactory(input) {
|
|
5122
|
-
return typeof input === 'function' &&
|
|
5529
|
+
return typeof input === 'function' && '_timing' in input && '_normalInstance' in input;
|
|
5123
5530
|
}
|
|
5124
5531
|
/**
|
|
5125
5532
|
* Creates a {@link DateCellTimingRelativeIndexFactory} that converts dates, ISO8601 day strings,
|
|
@@ -5147,6 +5554,9 @@ function _type_of$3(obj) {
|
|
|
5147
5554
|
* indexFactory._timing; // the original timing
|
|
5148
5555
|
* indexFactory._normalInstance; // timezone normalizer
|
|
5149
5556
|
* ```
|
|
5557
|
+
*
|
|
5558
|
+
* @param input - A timing configuration or an existing factory (returned as-is).
|
|
5559
|
+
* @returns A factory that converts dates, ISO8601 day strings, or indexes to zero-based day offsets.
|
|
5150
5560
|
*/ function dateCellTimingRelativeIndexFactory(input) {
|
|
5151
5561
|
if (isDateCellTimingRelativeIndexFactory(input)) {
|
|
5152
5562
|
return input;
|
|
@@ -5185,6 +5595,9 @@ function _type_of$3(obj) {
|
|
|
5185
5595
|
* dates, date ranges, and cell ranges into a flat array of day indexes.
|
|
5186
5596
|
*
|
|
5187
5597
|
* Date ranges and cell ranges are expanded to include every index within the range.
|
|
5598
|
+
*
|
|
5599
|
+
* @param indexFactory - The relative index factory used for date-to-index conversion.
|
|
5600
|
+
* @returns A factory that flattens mixed date/range arrays into day index arrays.
|
|
5188
5601
|
*/ function dateCellTimingRelativeIndexArrayFactory(indexFactory) {
|
|
5189
5602
|
var factory = function factory(input) {
|
|
5190
5603
|
var inputAsArray = asArray(input);
|
|
@@ -5226,6 +5639,10 @@ function _type_of$3(obj) {
|
|
|
5226
5639
|
* // Get the index for a specific date
|
|
5227
5640
|
* const index = getRelativeIndexForDateCellTiming(timing, someDate);
|
|
5228
5641
|
* ```
|
|
5642
|
+
*
|
|
5643
|
+
* @param timing - The timing providing the start date and timezone context.
|
|
5644
|
+
* @param date - A date or index to convert; defaults to the current date/time.
|
|
5645
|
+
* @returns The zero-based day index relative to the timing's start.
|
|
5229
5646
|
*/ function getRelativeIndexForDateCellTiming(timing) {
|
|
5230
5647
|
var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
|
|
5231
5648
|
return dateCellTimingRelativeIndexFactory(timing)(date);
|
|
@@ -5252,6 +5669,9 @@ function _type_of$3(obj) {
|
|
|
5252
5669
|
* // Convert index 3 to a date with a specific reference time
|
|
5253
5670
|
* const dateForDay3AtNoon = dateFactory(3, noonDate);
|
|
5254
5671
|
* ```
|
|
5672
|
+
*
|
|
5673
|
+
* @param timing - The timing providing the start date and timezone context.
|
|
5674
|
+
* @returns A factory that maps day indexes to calendar dates preserving the current time-of-day.
|
|
5255
5675
|
*/ function dateCellTimingDateFactory(timing) {
|
|
5256
5676
|
var _dateCellTimingStartPair = dateCellTimingStartPair(timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
|
|
5257
5677
|
var utcStartDate = normalInstance.baseDateToTargetDate(start);
|
|
@@ -5267,8 +5687,8 @@ function _type_of$3(obj) {
|
|
|
5267
5687
|
if (startUtcHours > nowHours) {
|
|
5268
5688
|
input += 1;
|
|
5269
5689
|
}
|
|
5270
|
-
|
|
5271
|
-
return
|
|
5690
|
+
// add days to apply the correct offset to the target index
|
|
5691
|
+
return addHours(utcStartDateWithNowTime, input * HOURS_IN_DAY);
|
|
5272
5692
|
}
|
|
5273
5693
|
};
|
|
5274
5694
|
factory._timing = timing;
|
|
@@ -5285,6 +5705,9 @@ function _type_of$3(obj) {
|
|
|
5285
5705
|
* const timing = dateCellTiming({ startsAt, duration: 60 }, 5);
|
|
5286
5706
|
* const lastIndex = dateCellTimingEndIndex(timing); // 4 (zero-based, 5 days)
|
|
5287
5707
|
* ```
|
|
5708
|
+
*
|
|
5709
|
+
* @param input - A timing or an existing relative index factory.
|
|
5710
|
+
* @returns The zero-based index of the last day in the schedule.
|
|
5288
5711
|
*/ function dateCellTimingEndIndex(input) {
|
|
5289
5712
|
var factory = dateCellTimingRelativeIndexFactory(input);
|
|
5290
5713
|
return factory(factory._timing.end);
|
|
@@ -5294,6 +5717,9 @@ function _type_of$3(obj) {
|
|
|
5294
5717
|
* for any day index relative to the timing's start.
|
|
5295
5718
|
*
|
|
5296
5719
|
* The returned date represents the beginning of the day in the timing's timezone context.
|
|
5720
|
+
*
|
|
5721
|
+
* @param input - A timing or an existing relative index factory.
|
|
5722
|
+
* @returns A factory that maps day indexes to the start-of-day date in the timing's timezone.
|
|
5297
5723
|
*/ function dateCellTimingStartDateFactory(input) {
|
|
5298
5724
|
var indexFactory = dateCellTimingRelativeIndexFactory(input);
|
|
5299
5725
|
var _dateCellTimingStartPair = dateCellTimingStartPair(indexFactory._timing), start = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
|
|
@@ -5331,6 +5757,10 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
5331
5757
|
/**
|
|
5332
5758
|
* Convenience function that returns the calendar date for a given day index or date
|
|
5333
5759
|
* relative to the timing. Shorthand for creating a {@link dateCellTimingDateFactory} and invoking it.
|
|
5760
|
+
*
|
|
5761
|
+
* @param timing - The timing providing the start date and timezone context.
|
|
5762
|
+
* @param input - A date or day index to convert.
|
|
5763
|
+
* @returns The calendar date corresponding to the input, preserving current time-of-day.
|
|
5334
5764
|
*/ function getRelativeDateForDateCellTiming(timing, input) {
|
|
5335
5765
|
return dateCellTimingDateFactory(timing)(input);
|
|
5336
5766
|
}
|
|
@@ -5356,6 +5786,9 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
5356
5786
|
* });
|
|
5357
5787
|
* // result has the same start day and end day, but new time-of-day and 90-minute duration
|
|
5358
5788
|
* ```
|
|
5789
|
+
*
|
|
5790
|
+
* @param input - Configuration specifying the timing to update, the event source, and which aspects to replace.
|
|
5791
|
+
* @returns A new {@link FullDateCellTiming} with the requested aspects replaced.
|
|
5359
5792
|
*/ function updateDateCellTimingWithDateCellTimingEvent(input) {
|
|
5360
5793
|
var timing = input.timing, event = input.event, replaceStartDay = input.replaceStartDay, replaceStartsAt = input.replaceStartsAt, startDateDay = input.startDayDate, endOnEvent = input.endOnEvent, replaceDuration = input.replaceDuration;
|
|
5361
5794
|
var timezone = timing.timezone;
|
|
@@ -5372,7 +5805,8 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
5372
5805
|
var _dateCellTimingStartPair = dateCellTimingStartPair({
|
|
5373
5806
|
startsAt: event.startsAt,
|
|
5374
5807
|
timezone: timezone
|
|
5375
|
-
}),
|
|
5808
|
+
}), initialEventStartDate = _dateCellTimingStartPair.start, normalInstance = _dateCellTimingStartPair.normalInstance;
|
|
5809
|
+
var eventStartDate = initialEventStartDate;
|
|
5376
5810
|
if (startDateDay != null) {
|
|
5377
5811
|
var startDateFactory = dateCellTimingStartDateFactory(timing);
|
|
5378
5812
|
eventStartDate = startDateFactory(startDateDay);
|
|
@@ -5436,6 +5870,9 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
5436
5870
|
* isInRange(6); // false - index 6 is outside [2, 5]
|
|
5437
5871
|
* isInRange(someDate); // converts date to index, then checks containment
|
|
5438
5872
|
* ```
|
|
5873
|
+
*
|
|
5874
|
+
* @param config - Configuration specifying the reference range and optional timezone context.
|
|
5875
|
+
* @returns A predicate function that checks containment within the configured range.
|
|
5439
5876
|
*/ function isDateWithinDateCellRangeFunction(config) {
|
|
5440
5877
|
var inputStartsAt = config.startsAt, inputRange = config.range;
|
|
5441
5878
|
var startsAt = inputStartsAt;
|
|
@@ -5456,13 +5893,11 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
5456
5893
|
} else {
|
|
5457
5894
|
rangeInput = inputRange;
|
|
5458
5895
|
}
|
|
5459
|
-
if (!inputStartsAt) {
|
|
5460
|
-
|
|
5461
|
-
startsAt
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
};
|
|
5465
|
-
}
|
|
5896
|
+
if (!inputStartsAt && dateRange && isDateInput) {
|
|
5897
|
+
startsAt = {
|
|
5898
|
+
startsAt: inputRange,
|
|
5899
|
+
timezone: guessCurrentTimezone()
|
|
5900
|
+
};
|
|
5466
5901
|
}
|
|
5467
5902
|
if (!startsAt) {
|
|
5468
5903
|
throw new Error('Invalid isDateWithinDateCellRangeFunction() config. StartsAt date info could not be determined from input.');
|
|
@@ -5615,6 +6050,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5615
6050
|
* Useful for identifying events or blocks that have already begun relative to a point in time.
|
|
5616
6051
|
*
|
|
5617
6052
|
* @param now - Reference time to compare against. Defaults to the current time.
|
|
6053
|
+
* @returns a filter function that returns true for spans whose start time is at or before the reference time
|
|
5618
6054
|
*
|
|
5619
6055
|
* @example
|
|
5620
6056
|
* ```ts
|
|
@@ -5633,6 +6069,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5633
6069
|
* The inverse of {@link dateCellDurationSpanHasStartedFilterFunction}. Useful for finding upcoming or future events.
|
|
5634
6070
|
*
|
|
5635
6071
|
* @param now - Reference time to compare against. Defaults to the current time.
|
|
6072
|
+
* @returns a filter function that returns true for spans whose start time is strictly after the reference time
|
|
5636
6073
|
*
|
|
5637
6074
|
* @example
|
|
5638
6075
|
* ```ts
|
|
@@ -5652,6 +6089,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5652
6089
|
* Useful for identifying completed events.
|
|
5653
6090
|
*
|
|
5654
6091
|
* @param now - Reference time to compare against. Defaults to the current time.
|
|
6092
|
+
* @returns a filter function that returns true for spans whose computed end time is at or before the reference time
|
|
5655
6093
|
*
|
|
5656
6094
|
* @example
|
|
5657
6095
|
* ```ts
|
|
@@ -5672,6 +6110,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5672
6110
|
* still in progress or have not yet occurred.
|
|
5673
6111
|
*
|
|
5674
6112
|
* @param now - Reference time to compare against. Defaults to the current time.
|
|
6113
|
+
* @returns a filter function that returns true for spans whose computed end time is strictly after the reference time
|
|
5675
6114
|
*
|
|
5676
6115
|
* @example
|
|
5677
6116
|
* ```ts
|
|
@@ -5693,6 +6132,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5693
6132
|
* indices clamped to the range boundaries. Non-overlapping cells are excluded entirely.
|
|
5694
6133
|
*
|
|
5695
6134
|
* @param range - The target range to fit cells into.
|
|
6135
|
+
* @returns a reusable function that clamps or filters date cells to the configured range
|
|
5696
6136
|
*
|
|
5697
6137
|
* @example
|
|
5698
6138
|
* ```ts
|
|
@@ -5733,6 +6173,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5733
6173
|
*
|
|
5734
6174
|
* @param range - The target range to fit cells into.
|
|
5735
6175
|
* @param input - The date cells to clamp or filter.
|
|
6176
|
+
* @returns an array of date cells clamped to the range, with non-overlapping cells removed
|
|
5736
6177
|
*
|
|
5737
6178
|
* @example
|
|
5738
6179
|
* ```ts
|
|
@@ -5747,6 +6188,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5747
6188
|
*
|
|
5748
6189
|
* @param range - The target range to fit the cell into.
|
|
5749
6190
|
* @param input - The single date cell to clamp or exclude.
|
|
6191
|
+
* @returns the clamped date cell, or `undefined` if it does not overlap the range
|
|
5750
6192
|
*
|
|
5751
6193
|
* @example
|
|
5752
6194
|
* ```ts
|
|
@@ -5761,7 +6203,7 @@ function _object_spread_props$6(target, source) {
|
|
|
5761
6203
|
])[0];
|
|
5762
6204
|
}
|
|
5763
6205
|
|
|
5764
|
-
function _array_like_to_array$
|
|
6206
|
+
function _array_like_to_array$5(arr, len) {
|
|
5765
6207
|
if (len == null || len > arr.length) len = arr.length;
|
|
5766
6208
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5767
6209
|
return arr2;
|
|
@@ -5769,6 +6211,9 @@ function _array_like_to_array$4(arr, len) {
|
|
|
5769
6211
|
function _array_with_holes$2(arr) {
|
|
5770
6212
|
if (Array.isArray(arr)) return arr;
|
|
5771
6213
|
}
|
|
6214
|
+
function _array_without_holes$3(arr) {
|
|
6215
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
6216
|
+
}
|
|
5772
6217
|
function _instanceof(left, right) {
|
|
5773
6218
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
5774
6219
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -5776,6 +6221,9 @@ function _instanceof(left, right) {
|
|
|
5776
6221
|
return left instanceof right;
|
|
5777
6222
|
}
|
|
5778
6223
|
}
|
|
6224
|
+
function _iterable_to_array$3(iter) {
|
|
6225
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6226
|
+
}
|
|
5779
6227
|
function _iterable_to_array_limit$2(arr, i) {
|
|
5780
6228
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5781
6229
|
if (_i == null) return;
|
|
@@ -5803,16 +6251,22 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
5803
6251
|
function _non_iterable_rest$2() {
|
|
5804
6252
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5805
6253
|
}
|
|
6254
|
+
function _non_iterable_spread$3() {
|
|
6255
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6256
|
+
}
|
|
5806
6257
|
function _sliced_to_array$2(arr, i) {
|
|
5807
|
-
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$
|
|
6258
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
|
|
5808
6259
|
}
|
|
5809
|
-
function
|
|
6260
|
+
function _to_consumable_array$3(arr) {
|
|
6261
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
|
|
6262
|
+
}
|
|
6263
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
5810
6264
|
if (!o) return;
|
|
5811
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6265
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
5812
6266
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5813
6267
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5814
6268
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5815
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6269
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
5816
6270
|
}
|
|
5817
6271
|
/**
|
|
5818
6272
|
* Used for default YearWeekCode values
|
|
@@ -5900,15 +6354,15 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
5900
6354
|
* yearWeekCodeFromDate(new Date('2024-04-15')); // 202416
|
|
5901
6355
|
* ```
|
|
5902
6356
|
*/ function yearWeekCodeFromDate(date, timezone) {
|
|
6357
|
+
var result;
|
|
5903
6358
|
if (timezone) {
|
|
5904
|
-
|
|
5905
|
-
return yearWeekCodeFactory({
|
|
6359
|
+
result = yearWeekCodeFactory({
|
|
5906
6360
|
timezone: timezone
|
|
5907
6361
|
})(date);
|
|
5908
6362
|
} else {
|
|
5909
|
-
|
|
5910
|
-
return yearWeekCodeFromPair(yearWeekCodePairFromDate(date));
|
|
6363
|
+
result = yearWeekCodeFromPair(yearWeekCodePairFromDate(date));
|
|
5911
6364
|
}
|
|
6365
|
+
return result;
|
|
5912
6366
|
}
|
|
5913
6367
|
/**
|
|
5914
6368
|
* Resolves a timezone input into a {@link DateTimezoneUtcNormalInstance} for use with YearWeekCode calculations.
|
|
@@ -5918,8 +6372,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
|
|
|
5918
6372
|
* @param input - timezone string, config, or instance
|
|
5919
6373
|
* @returns the resolved normal instance
|
|
5920
6374
|
*/ function yearWeekCodeDateTimezoneInstance(input) {
|
|
5921
|
-
|
|
5922
|
-
return normal;
|
|
6375
|
+
return input ? _instanceof(input, DateTimezoneUtcNormalInstance) ? input : dateTimezoneUtcNormal(input) : SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE;
|
|
5923
6376
|
}
|
|
5924
6377
|
function yearWeekCode(dateOrYear, inputWeek) {
|
|
5925
6378
|
return yearWeekCodeFactory({
|
|
@@ -5971,6 +6424,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
5971
6424
|
*
|
|
5972
6425
|
* @param dateRange - the range to compute week codes for
|
|
5973
6426
|
* @param dateRangeTimezone - the timezone context for accurate week boundary calculation
|
|
6427
|
+
* @returns an array of YearWeekCode values covering the range
|
|
5974
6428
|
*/ function yearWeekCodeForDateRangeInTimezone(dateRange, dateRangeTimezone) {
|
|
5975
6429
|
return yearWeekCodeForDateRangeFactory(yearWeekCodeFactory({
|
|
5976
6430
|
timezone: dateRangeTimezone
|
|
@@ -6003,6 +6457,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6003
6457
|
* Returns all {@link YearWeekCode} values for the calendar month containing the given date, using the system timezone.
|
|
6004
6458
|
*
|
|
6005
6459
|
* @param date - a date within the target month
|
|
6460
|
+
* @returns an array of YearWeekCode values for the month
|
|
6006
6461
|
*/ function yearWeekCodeForCalendarMonth(date) {
|
|
6007
6462
|
return yearWeekCodeForCalendarMonthFactory(yearWeekCodeFactory({
|
|
6008
6463
|
timezone: SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE
|
|
@@ -6046,8 +6501,8 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6046
6501
|
var utcYearDate = new Date(Date.UTC(pair.year, 0, 1, 0, 0, 0, 0));
|
|
6047
6502
|
var systemYearDate = normal.systemDateToBaseDate(utcYearDate); // convert to system before using system date functions
|
|
6048
6503
|
var date = startOfWeek(setWeek(systemYearDate, pair.week));
|
|
6049
|
-
|
|
6050
|
-
return
|
|
6504
|
+
// back to timezone
|
|
6505
|
+
return normal.targetDateToSystemDate(date);
|
|
6051
6506
|
};
|
|
6052
6507
|
}
|
|
6053
6508
|
/**
|
|
@@ -6101,10 +6556,10 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6101
6556
|
}
|
|
6102
6557
|
return yearWeekCode;
|
|
6103
6558
|
});
|
|
6104
|
-
var groups =
|
|
6559
|
+
var groups = _to_consumable_array$3(map.entries()).map(function(param) {
|
|
6105
6560
|
var _param = _sliced_to_array$2(param, 2), week = _param[0], _$items = _param[1];
|
|
6106
6561
|
return {
|
|
6107
|
-
week: week
|
|
6562
|
+
week: week !== null && week !== void 0 ? week : 0,
|
|
6108
6563
|
items: _$items
|
|
6109
6564
|
};
|
|
6110
6565
|
});
|
|
@@ -6143,8 +6598,7 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6143
6598
|
var normalInstance = startDateFactory._indexFactory._normalInstance;
|
|
6144
6599
|
return function(indexOrDate) {
|
|
6145
6600
|
var dateInSystemTimezone = normalInstance.systemDateToTargetDate(startDateFactory(indexOrDate));
|
|
6146
|
-
|
|
6147
|
-
return yearWeekCode;
|
|
6601
|
+
return yearWeekCodeFromDate(dateInSystemTimezone);
|
|
6148
6602
|
};
|
|
6149
6603
|
}
|
|
6150
6604
|
/**
|
|
@@ -6155,21 +6609,20 @@ function yearWeekCode(dateOrYear, inputWeek) {
|
|
|
6155
6609
|
*/ function dateCellIndexYearWeekCodeGroupFactory(config) {
|
|
6156
6610
|
var dateCellIndexReader = config.dateCellIndexReader, inputDateCellIndexYearWeekCodeFactory = config.dateCellIndexYearWeekCodeFactory;
|
|
6157
6611
|
var dateCellIndexYearWeekCode = typeof inputDateCellIndexYearWeekCodeFactory === 'function' ? inputDateCellIndexYearWeekCodeFactory : dateCellIndexYearWeekCodeFactory(inputDateCellIndexYearWeekCodeFactory);
|
|
6158
|
-
|
|
6612
|
+
return yearWeekCodeGroupFactory({
|
|
6159
6613
|
yearWeekCodeFactory: dateCellIndexYearWeekCode,
|
|
6160
6614
|
yearWeekCodeReader: dateCellIndexYearWeekCode,
|
|
6161
6615
|
dateReader: dateCellIndexReader
|
|
6162
6616
|
});
|
|
6163
|
-
return factory;
|
|
6164
6617
|
}
|
|
6165
6618
|
|
|
6166
|
-
function _array_like_to_array$
|
|
6619
|
+
function _array_like_to_array$4(arr, len) {
|
|
6167
6620
|
if (len == null || len > arr.length) len = arr.length;
|
|
6168
6621
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6169
6622
|
return arr2;
|
|
6170
6623
|
}
|
|
6171
|
-
function _array_without_holes$
|
|
6172
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
6624
|
+
function _array_without_holes$2(arr) {
|
|
6625
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
6173
6626
|
}
|
|
6174
6627
|
function _define_property$9(obj, key, value) {
|
|
6175
6628
|
if (key in obj) {
|
|
@@ -6184,10 +6637,10 @@ function _define_property$9(obj, key, value) {
|
|
|
6184
6637
|
}
|
|
6185
6638
|
return obj;
|
|
6186
6639
|
}
|
|
6187
|
-
function _iterable_to_array$
|
|
6640
|
+
function _iterable_to_array$2(iter) {
|
|
6188
6641
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
6189
6642
|
}
|
|
6190
|
-
function _non_iterable_spread$
|
|
6643
|
+
function _non_iterable_spread$2() {
|
|
6191
6644
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6192
6645
|
}
|
|
6193
6646
|
function _object_spread$7(target) {
|
|
@@ -6224,20 +6677,20 @@ function _object_spread_props$5(target, source) {
|
|
|
6224
6677
|
}
|
|
6225
6678
|
return target;
|
|
6226
6679
|
}
|
|
6227
|
-
function _to_consumable_array$
|
|
6228
|
-
return _array_without_holes$
|
|
6680
|
+
function _to_consumable_array$2(arr) {
|
|
6681
|
+
return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
|
|
6229
6682
|
}
|
|
6230
6683
|
function _type_of$2(obj) {
|
|
6231
6684
|
"@swc/helpers - typeof";
|
|
6232
6685
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
6233
6686
|
}
|
|
6234
|
-
function _unsupported_iterable_to_array$
|
|
6687
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
6235
6688
|
if (!o) return;
|
|
6236
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
6689
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
6237
6690
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6238
6691
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6239
6692
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6240
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
6693
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
6241
6694
|
}
|
|
6242
6695
|
/**
|
|
6243
6696
|
* Encodes days of the week as numeric codes for use in schedule filtering.
|
|
@@ -6302,7 +6755,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
|
|
|
6302
6755
|
* @param input - schedule day codes to convert (WEEKDAY/WEEKEND shorthand codes are expanded)
|
|
6303
6756
|
* @returns an EnabledDays object with boolean flags for each day
|
|
6304
6757
|
*/ function enabledDaysFromDateCellScheduleDayCodes(input) {
|
|
6305
|
-
var days = expandDateCellScheduleDayCodesToDayOfWeekSet(
|
|
6758
|
+
var days = expandDateCellScheduleDayCodesToDayOfWeekSet(_to_consumable_array$2(new Set(input)));
|
|
6306
6759
|
return enabledDaysFromDaysOfWeek(days);
|
|
6307
6760
|
}
|
|
6308
6761
|
/**
|
|
@@ -6379,7 +6832,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6379
6832
|
* simplifyDateCellScheduleDayCodes([2, 4]);
|
|
6380
6833
|
* // Returns [DateCellScheduleDayCode.MONDAY, DateCellScheduleDayCode.WEDNESDAY] // [2, 4]
|
|
6381
6834
|
* ```
|
|
6382
|
-
*/
|
|
6835
|
+
*/ // eslint-disable-next-line sonarjs/cognitive-complexity
|
|
6836
|
+
function simplifyDateCellScheduleDayCodes(codes) {
|
|
6383
6837
|
var codesSet = new Set(codes);
|
|
6384
6838
|
var result = [];
|
|
6385
6839
|
if (codesSet.size >= 2) {
|
|
@@ -6450,7 +6904,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6450
6904
|
* @param input - day codes to expand
|
|
6451
6905
|
* @returns sorted array of individual day codes (1-7 only, no shorthand)
|
|
6452
6906
|
*/ function expandDateCellScheduleDayCodes(input) {
|
|
6453
|
-
return
|
|
6907
|
+
return _to_consumable_array$2(expandDateCellScheduleDayCodesToDayCodesSet(input)).sort(sortNumbersAscendingFunction);
|
|
6454
6908
|
}
|
|
6455
6909
|
/**
|
|
6456
6910
|
* Expands the input DateCellScheduleDayCodesInput to a Set of individual DateCellScheduleDayCode values (1-7), expanding shorthand codes like WEEKDAY and WEEKEND.
|
|
@@ -6461,6 +6915,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6461
6915
|
var codes = rawDateCellScheduleDayCodes(input);
|
|
6462
6916
|
var days = new Set();
|
|
6463
6917
|
codes.forEach(function(code) {
|
|
6918
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
6464
6919
|
switch(code){
|
|
6465
6920
|
case 0:
|
|
6466
6921
|
break;
|
|
@@ -6486,9 +6941,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6486
6941
|
* @returns raw array of day codes with NONE values removed
|
|
6487
6942
|
*/ function rawDateCellScheduleDayCodes(input) {
|
|
6488
6943
|
var dayCodes;
|
|
6944
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
6489
6945
|
switch(typeof input === "undefined" ? "undefined" : _type_of$2(input)){
|
|
6490
6946
|
case 'string':
|
|
6491
|
-
dayCodes =
|
|
6947
|
+
dayCodes = _to_consumable_array$2(new Set(input)).map(function(x) {
|
|
6492
6948
|
return Number(x);
|
|
6493
6949
|
});
|
|
6494
6950
|
break;
|
|
@@ -6498,7 +6954,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6498
6954
|
];
|
|
6499
6955
|
break;
|
|
6500
6956
|
default:
|
|
6501
|
-
dayCodes =
|
|
6957
|
+
dayCodes = _to_consumable_array$2(input);
|
|
6502
6958
|
break;
|
|
6503
6959
|
}
|
|
6504
6960
|
return dayCodes.filter(function(x) {
|
|
@@ -6607,7 +7063,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6607
7063
|
var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // treat input as the current timezone
|
|
6608
7064
|
var normalInstance = dateTimezoneUtcNormal(timezone);
|
|
6609
7065
|
var start;
|
|
6610
|
-
var end;
|
|
6611
7066
|
// either start or startsAt is provided
|
|
6612
7067
|
if (inputStart != null) {
|
|
6613
7068
|
var startInSystemTimezone = normalInstance.systemDateToTargetDate(inputStart); // start needs to be in the system timezone normal before processing.
|
|
@@ -6624,7 +7079,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6624
7079
|
}
|
|
6625
7080
|
}
|
|
6626
7081
|
// set the end value
|
|
6627
|
-
end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
|
|
7082
|
+
var end = inputEnd !== null && inputEnd !== void 0 ? inputEnd : addMinutes(start, 1); // default the end to one minute after the start
|
|
6628
7083
|
return {
|
|
6629
7084
|
w: w,
|
|
6630
7085
|
ex: ex,
|
|
@@ -6826,11 +7281,12 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6826
7281
|
* filter(5); // false (Saturday Jan 11)
|
|
6827
7282
|
* ```
|
|
6828
7283
|
*/ function dateCellScheduleDateFilter(config) {
|
|
7284
|
+
var _ref;
|
|
6829
7285
|
var w = config.w, inputStart = config.start, inputStartsAt = config.startsAt, inputEnd = config.end, inputTimezone = config.timezone, _config_setStartAsMinDate = config.setStartAsMinDate, setStartAsMinDate = _config_setStartAsMinDate === void 0 ? true : _config_setStartAsMinDate, minMaxDateRange = config.minMaxDateRange;
|
|
6830
7286
|
var timezone = inputTimezone !== null && inputTimezone !== void 0 ? inputTimezone : requireCurrentTimezone(); // if the timezone is not provided, assume the startsAt is a system timezone normal.
|
|
6831
7287
|
var normalInstance = dateTimezoneUtcNormal(timezone);
|
|
6832
7288
|
// derive the startsAt time for the range. If not provided, defaults to inputStart, or midnight today in the target timezone.
|
|
6833
|
-
var startsAt = inputStartsAt
|
|
7289
|
+
var startsAt = (_ref = inputStartsAt !== null && inputStartsAt !== void 0 ? inputStartsAt : inputStart) !== null && _ref !== void 0 ? _ref : normalInstance.startOfDayInTargetTimezone();
|
|
6834
7290
|
var allowedDays = expandDateCellScheduleDayCodesToDayOfWeekSet(w);
|
|
6835
7291
|
var startsAtInSystem = normalInstance.systemDateToTargetDate(startsAt); // convert to the system date
|
|
6836
7292
|
var firstDateDay = getDay(startsAtInSystem);
|
|
@@ -6856,15 +7312,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6856
7312
|
var excludedIndexes = new Set(config.ex);
|
|
6857
7313
|
var fn = function fn(input) {
|
|
6858
7314
|
var i;
|
|
6859
|
-
var day;
|
|
6860
7315
|
if (typeof input === 'number') {
|
|
6861
7316
|
i = input;
|
|
6862
7317
|
} else {
|
|
6863
7318
|
i = _dateCellTimingRelativeIndexFactory(input);
|
|
6864
7319
|
}
|
|
6865
|
-
day = dayForIndex(i);
|
|
6866
|
-
|
|
6867
|
-
return result;
|
|
7320
|
+
var day = dayForIndex(i);
|
|
7321
|
+
return i >= minAllowedIndex && i <= maxAllowedIndex && allowedDays.has(day) && !excludedIndexes.has(i) || includedIndexes.has(i);
|
|
6868
7322
|
};
|
|
6869
7323
|
fn._dateCellTimingRelativeIndexFactory = _dateCellTimingRelativeIndexFactory;
|
|
6870
7324
|
return fn;
|
|
@@ -6918,6 +7372,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6918
7372
|
* Creates a DateCellScheduleDateCellTimingFilter that tests whether a DateCell block's index is allowed by the schedule within the given timing.
|
|
6919
7373
|
*
|
|
6920
7374
|
* @param config - timing and schedule to build the filter from
|
|
7375
|
+
* @param config.timing - the DateCellTiming that defines the date range and event times for the filter
|
|
7376
|
+
* @param config.schedule - the DateCellSchedule that controls which day codes and indices are included or excluded
|
|
6921
7377
|
* @returns a decision function returning true for allowed blocks
|
|
6922
7378
|
*/ function dateCellScheduleDateCellTimingFilter(param) {
|
|
6923
7379
|
var timing = param.timing, schedule = param.schedule;
|
|
@@ -6941,7 +7397,6 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6941
7397
|
* @returns an expansion factory that converts DateCellRange arrays into filtered DateCellDurationSpan arrays
|
|
6942
7398
|
*/ function expandDateCellScheduleFactory(config) {
|
|
6943
7399
|
var _config_invertSchedule = config.invertSchedule, invertSchedule = _config_invertSchedule === void 0 ? false : _config_invertSchedule, now = config.now, onlyBlocksThatHaveEnded = config.onlyBlocksThatHaveEnded, onlyBlocksThatHaveStarted = config.onlyBlocksThatHaveStarted, onlyBlocksNotYetEnded = config.onlyBlocksNotYetEnded, onlyBlocksNotYetStarted = config.onlyBlocksNotYetStarted, maxDateCellsToReturn = config.maxDateCellsToReturn, inputDurationSpanFilter = config.durationSpanFilter;
|
|
6944
|
-
var durationSpanFilter;
|
|
6945
7400
|
var durationSpanFilters = [];
|
|
6946
7401
|
if (inputDurationSpanFilter) {
|
|
6947
7402
|
durationSpanFilters.push(inputDurationSpanFilter);
|
|
@@ -6958,14 +7413,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
6958
7413
|
durationSpanFilters.push(dateCellDurationSpanHasNotEndedFilterFunction(now));
|
|
6959
7414
|
}
|
|
6960
7415
|
}
|
|
6961
|
-
durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$
|
|
6962
|
-
|
|
7416
|
+
var durationSpanFilter = mergeFilterFunctions.apply(void 0, _to_consumable_array$2(durationSpanFilters));
|
|
7417
|
+
return dateCellTimingExpansionFactory({
|
|
6963
7418
|
timing: config.timing,
|
|
6964
7419
|
filter: invertFilter(dateCellScheduleDateCellTimingFilter(config), invertSchedule),
|
|
6965
7420
|
durationSpanFilter: durationSpanFilter,
|
|
6966
7421
|
maxDateCellsToReturn: maxDateCellsToReturn
|
|
6967
7422
|
});
|
|
6968
|
-
return expansionFactory;
|
|
6969
7423
|
}
|
|
6970
7424
|
/**
|
|
6971
7425
|
* Expands a DateCellTiming and DateCellSchedule into concrete DateCellDurationSpan values representing each active block in the event.
|
|
@@ -7051,26 +7505,165 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7051
7505
|
});
|
|
7052
7506
|
}
|
|
7053
7507
|
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7508
|
+
function _define_property$8(obj, key, value) {
|
|
7509
|
+
if (key in obj) {
|
|
7510
|
+
Object.defineProperty(obj, key, {
|
|
7511
|
+
value: value,
|
|
7512
|
+
enumerable: true,
|
|
7513
|
+
configurable: true,
|
|
7514
|
+
writable: true
|
|
7515
|
+
});
|
|
7516
|
+
} else {
|
|
7517
|
+
obj[key] = value;
|
|
7518
|
+
}
|
|
7519
|
+
return obj;
|
|
7520
|
+
}
|
|
7521
|
+
function _object_spread$6(target) {
|
|
7522
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7523
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7524
|
+
var ownKeys = Object.keys(source);
|
|
7525
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7526
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7527
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7528
|
+
}));
|
|
7529
|
+
}
|
|
7530
|
+
ownKeys.forEach(function(key) {
|
|
7531
|
+
_define_property$8(target, key, source[key]);
|
|
7532
|
+
});
|
|
7533
|
+
}
|
|
7534
|
+
return target;
|
|
7064
7535
|
}
|
|
7065
7536
|
/**
|
|
7066
|
-
*
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7537
|
+
* Distinguishes between time-based calendar events and all-day/multi-day events.
|
|
7538
|
+
*/ var CalendarDateType;
|
|
7539
|
+
(function(CalendarDateType) {
|
|
7540
|
+
/**
|
|
7541
|
+
* Event starts at a specific time and lasts for a certain duration.
|
|
7542
|
+
*/ CalendarDateType["TIME"] = "time";
|
|
7543
|
+
/**
|
|
7544
|
+
* Event is specifically for a number of days. Duration is still tracked in minutes.
|
|
7545
|
+
*/ CalendarDateType["DAYS"] = "days";
|
|
7546
|
+
})(CalendarDateType || (CalendarDateType = {}));
|
|
7547
|
+
/**
|
|
7548
|
+
* Creates a {@link CalendarDateFactory} that produces all-day calendar events with timezone-aware start times.
|
|
7549
|
+
*
|
|
7550
|
+
* The factory converts an ISO 8601 day string to a UTC date, then applies timezone normalization
|
|
7551
|
+
* so the resulting `startsAt` represents the correct moment for the target timezone.
|
|
7552
|
+
*
|
|
7553
|
+
* @param config - optional timezone configuration
|
|
7554
|
+
* @returns a factory function that creates CalendarDate objects
|
|
7555
|
+
*
|
|
7556
|
+
* @example
|
|
7557
|
+
* ```ts
|
|
7558
|
+
* const factory = calendarDateFactory({ timezone: 'America/Denver' });
|
|
7559
|
+
* const event = factory('2024-01-15', 3);
|
|
7560
|
+
* // event.type === CalendarDateType.DAYS
|
|
7561
|
+
* // event.duration === daysToMinutes(3)
|
|
7562
|
+
* ```
|
|
7563
|
+
*/ function calendarDateFactory(config) {
|
|
7564
|
+
var normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? {
|
|
7565
|
+
useSystemTimezone: true
|
|
7566
|
+
} : {
|
|
7567
|
+
timezone: config.timezone ? config.timezone : undefined
|
|
7568
|
+
};
|
|
7569
|
+
var normal = dateTimezoneUtcNormal(normalConfig);
|
|
7570
|
+
return function(day, days) {
|
|
7571
|
+
var date = parseISO8601DayStringToUTCDate(day);
|
|
7572
|
+
var startsAt = normal.targetDateToBaseDate(date);
|
|
7573
|
+
return {
|
|
7574
|
+
type: CalendarDateType.DAYS,
|
|
7575
|
+
startsAt: startsAt,
|
|
7576
|
+
duration: daysToMinutes(days)
|
|
7577
|
+
};
|
|
7578
|
+
};
|
|
7579
|
+
}
|
|
7580
|
+
/**
|
|
7581
|
+
* Convenience function that creates a single all-day {@link CalendarDate} with optional timezone.
|
|
7582
|
+
*
|
|
7583
|
+
* Shorthand for creating a factory and immediately invoking it.
|
|
7584
|
+
*
|
|
7585
|
+
* @param day - ISO 8601 day string (e.g. '2024-01-15')
|
|
7586
|
+
* @param days - number of days the event spans
|
|
7587
|
+
* @param timezone - IANA timezone string, false for UTC, or undefined for system timezone
|
|
7588
|
+
* @returns a CalendarDate with type DAYS
|
|
7589
|
+
*
|
|
7590
|
+
* @example
|
|
7591
|
+
* ```ts
|
|
7592
|
+
* const event = calendarDate('2024-01-15', 1, 'America/Denver');
|
|
7593
|
+
* // event.type === CalendarDateType.DAYS
|
|
7594
|
+
* ```
|
|
7595
|
+
*/ function calendarDate(day, days, timezone) {
|
|
7596
|
+
return calendarDateFactory({
|
|
7597
|
+
timezone: timezone
|
|
7598
|
+
})(day, days);
|
|
7599
|
+
}
|
|
7600
|
+
/**
|
|
7601
|
+
* Wraps an existing {@link DateDurationSpan} as a time-based {@link CalendarDate}.
|
|
7602
|
+
*
|
|
7603
|
+
* @param dateDurationSpan - the duration span to wrap
|
|
7604
|
+
* @returns a CalendarDate with type TIME
|
|
7605
|
+
*
|
|
7606
|
+
* @example
|
|
7607
|
+
* ```ts
|
|
7608
|
+
* const span: DateDurationSpan = { startsAt: new Date(), duration: 60 };
|
|
7609
|
+
* const event = calendarDateForDateDurationSpan(span);
|
|
7610
|
+
* // event.type === CalendarDateType.TIME
|
|
7611
|
+
* ```
|
|
7612
|
+
*/ function calendarDateForDateDurationSpan(dateDurationSpan) {
|
|
7613
|
+
return _object_spread$6({
|
|
7614
|
+
type: CalendarDateType.TIME
|
|
7615
|
+
}, dateDurationSpan);
|
|
7616
|
+
}
|
|
7617
|
+
|
|
7618
|
+
function _array_like_to_array$3(arr, len) {
|
|
7619
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7620
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
7621
|
+
return arr2;
|
|
7622
|
+
}
|
|
7623
|
+
function _array_without_holes$1(arr) {
|
|
7624
|
+
if (Array.isArray(arr)) return _array_like_to_array$3(arr);
|
|
7625
|
+
}
|
|
7626
|
+
function _iterable_to_array$1(iter) {
|
|
7627
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
7628
|
+
}
|
|
7629
|
+
function _non_iterable_spread$1() {
|
|
7630
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7631
|
+
}
|
|
7632
|
+
function _to_consumable_array$1(arr) {
|
|
7633
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
|
|
7634
|
+
}
|
|
7635
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
7636
|
+
if (!o) return;
|
|
7637
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
7638
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7639
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7640
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7641
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
7642
|
+
}
|
|
7643
|
+
/**
|
|
7644
|
+
* Returns all recognized IANA timezone strings, including the explicit UTC entry.
|
|
7645
|
+
*
|
|
7646
|
+
* @returns all known IANA timezone strings plus UTC
|
|
7647
|
+
*
|
|
7648
|
+
* @example
|
|
7649
|
+
* ```ts
|
|
7650
|
+
* const zones = allTimezoneStrings();
|
|
7651
|
+
* // ['Africa/Abidjan', ..., 'UTC']
|
|
7652
|
+
* ```
|
|
7653
|
+
*/ function allTimezoneStrings() {
|
|
7654
|
+
return _to_consumable_array$1(timeZonesNames).concat([
|
|
7655
|
+
UTC_TIMEZONE_STRING
|
|
7656
|
+
]);
|
|
7657
|
+
}
|
|
7658
|
+
/**
|
|
7659
|
+
* Lazily-computed set of all known timezone strings for O(1) membership checks.
|
|
7660
|
+
*
|
|
7661
|
+
* @example
|
|
7662
|
+
* ```ts
|
|
7663
|
+
* allKnownTimezoneStrings().has('America/New_York'); // true
|
|
7664
|
+
* ```
|
|
7665
|
+
*/ var allKnownTimezoneStrings = cachedGetter(function() {
|
|
7666
|
+
return new Set(allTimezoneStrings());
|
|
7074
7667
|
});
|
|
7075
7668
|
/**
|
|
7076
7669
|
* Lazily-computed array of {@link TimezoneInfo} for every known timezone.
|
|
@@ -7086,6 +7679,8 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7086
7679
|
/**
|
|
7087
7680
|
* Returns the {@link TimezoneInfo} for the current system timezone, falling back to UTC.
|
|
7088
7681
|
*
|
|
7682
|
+
* @returns timezone info for the current system timezone
|
|
7683
|
+
*
|
|
7089
7684
|
* @example
|
|
7090
7685
|
* ```ts
|
|
7091
7686
|
* const info = timezoneInfoForSystem();
|
|
@@ -7101,6 +7696,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7101
7696
|
* The date matters because abbreviations change with DST transitions.
|
|
7102
7697
|
* Returns `"UKNOWN"` if no timezone is provided.
|
|
7103
7698
|
*
|
|
7699
|
+
* @param timezone - the IANA timezone string (or UTC abbreviation) to get the abbreviation for
|
|
7700
|
+
* @param date - the date at which to evaluate the abbreviation (defaults to now)
|
|
7701
|
+
* @returns the short timezone abbreviation
|
|
7702
|
+
*
|
|
7104
7703
|
* @example
|
|
7105
7704
|
* ```ts
|
|
7106
7705
|
* getTimezoneAbbreviation('America/New_York'); // 'EST' or 'EDT'
|
|
@@ -7114,6 +7713,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7114
7713
|
*
|
|
7115
7714
|
* Returns `"Unknown Timezone"` if no timezone is provided.
|
|
7116
7715
|
*
|
|
7716
|
+
* @param timezone - the IANA timezone string to get the long name for
|
|
7717
|
+
* @param date - the date at which to evaluate the name (defaults to now)
|
|
7718
|
+
* @returns the full timezone display name
|
|
7719
|
+
*
|
|
7117
7720
|
* @example
|
|
7118
7721
|
* ```ts
|
|
7119
7722
|
* getTimezoneLongName('America/New_York'); // 'Eastern Standard Time'
|
|
@@ -7125,6 +7728,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7125
7728
|
/**
|
|
7126
7729
|
* Builds a {@link TimezoneInfo} for the given timezone, computing abbreviation and search variants.
|
|
7127
7730
|
*
|
|
7731
|
+
* @param timezone - the IANA timezone string to build info for
|
|
7732
|
+
* @param date - the date at which to evaluate the abbreviation (defaults to now)
|
|
7733
|
+
* @returns the computed TimezoneInfo
|
|
7734
|
+
*
|
|
7128
7735
|
* @example
|
|
7129
7736
|
* ```ts
|
|
7130
7737
|
* const info = timezoneStringToTimezoneInfo('America/Chicago');
|
|
@@ -7134,14 +7741,13 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7134
7741
|
*/ function timezoneStringToTimezoneInfo(timezone) {
|
|
7135
7742
|
var date = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Date();
|
|
7136
7743
|
var abbreviation = getTimezoneAbbreviation(timezone, date);
|
|
7137
|
-
|
|
7744
|
+
return {
|
|
7138
7745
|
timezone: timezone,
|
|
7139
7746
|
search: timezoneStringToSearchableString(timezone),
|
|
7140
7747
|
lowercase: timezone.toLowerCase(),
|
|
7141
7748
|
abbreviation: abbreviation,
|
|
7142
7749
|
lowercaseAbbreviation: abbreviation.toLowerCase()
|
|
7143
7750
|
};
|
|
7144
|
-
return result;
|
|
7145
7751
|
}
|
|
7146
7752
|
/**
|
|
7147
7753
|
* Filters timezone infos by a search string, matching against the searchable name,
|
|
@@ -7149,6 +7755,10 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7149
7755
|
*
|
|
7150
7756
|
* For queries longer than 2 characters, substring matching on the searchable name is also used.
|
|
7151
7757
|
*
|
|
7758
|
+
* @param search - the search query string
|
|
7759
|
+
* @param infos - the array of TimezoneInfo objects to filter
|
|
7760
|
+
* @returns the matching TimezoneInfo entries
|
|
7761
|
+
*
|
|
7152
7762
|
* @example
|
|
7153
7763
|
* ```ts
|
|
7154
7764
|
* const results = searchTimezoneInfos('eastern', allTimezoneInfos());
|
|
@@ -7171,6 +7781,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
|
|
|
7171
7781
|
*
|
|
7172
7782
|
* Replaces `/` and `_` with spaces (e.g., `"America/New_York"` becomes `"america new york"`).
|
|
7173
7783
|
*
|
|
7784
|
+
* @param timezone - the IANA timezone string to convert
|
|
7785
|
+
* @returns the searchable lowercase string
|
|
7786
|
+
*
|
|
7174
7787
|
* @example
|
|
7175
7788
|
* ```ts
|
|
7176
7789
|
* timezoneStringToSearchableString('America/New_York'); // 'america new york'
|
|
@@ -7183,6 +7796,9 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
|
|
|
7183
7796
|
*
|
|
7184
7797
|
* Uses the cached set from {@link allKnownTimezoneStrings} for O(1) lookup.
|
|
7185
7798
|
*
|
|
7799
|
+
* @param input - the string to check
|
|
7800
|
+
* @returns whether the input is a known timezone
|
|
7801
|
+
*
|
|
7186
7802
|
* @example
|
|
7187
7803
|
* ```ts
|
|
7188
7804
|
* isKnownTimezone('America/New_York'); // true
|
|
@@ -7192,116 +7808,6 @@ var timezoneStringToSearchableStringReplace = replaceStringsFunction({
|
|
|
7192
7808
|
return allKnownTimezoneStrings().has(input);
|
|
7193
7809
|
}
|
|
7194
7810
|
|
|
7195
|
-
function _define_property$8(obj, key, value) {
|
|
7196
|
-
if (key in obj) {
|
|
7197
|
-
Object.defineProperty(obj, key, {
|
|
7198
|
-
value: value,
|
|
7199
|
-
enumerable: true,
|
|
7200
|
-
configurable: true,
|
|
7201
|
-
writable: true
|
|
7202
|
-
});
|
|
7203
|
-
} else {
|
|
7204
|
-
obj[key] = value;
|
|
7205
|
-
}
|
|
7206
|
-
return obj;
|
|
7207
|
-
}
|
|
7208
|
-
function _object_spread$6(target) {
|
|
7209
|
-
for(var i = 1; i < arguments.length; i++){
|
|
7210
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
7211
|
-
var ownKeys = Object.keys(source);
|
|
7212
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7213
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7214
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7215
|
-
}));
|
|
7216
|
-
}
|
|
7217
|
-
ownKeys.forEach(function(key) {
|
|
7218
|
-
_define_property$8(target, key, source[key]);
|
|
7219
|
-
});
|
|
7220
|
-
}
|
|
7221
|
-
return target;
|
|
7222
|
-
}
|
|
7223
|
-
/**
|
|
7224
|
-
* Distinguishes between time-based calendar events and all-day/multi-day events.
|
|
7225
|
-
*/ var CalendarDateType;
|
|
7226
|
-
(function(CalendarDateType) {
|
|
7227
|
-
/**
|
|
7228
|
-
* Event starts at a specific time and lasts for a certain duration.
|
|
7229
|
-
*/ CalendarDateType["TIME"] = "time";
|
|
7230
|
-
/**
|
|
7231
|
-
* Event is specifically for a number of days. Duration is still tracked in minutes.
|
|
7232
|
-
*/ CalendarDateType["DAYS"] = "days";
|
|
7233
|
-
})(CalendarDateType || (CalendarDateType = {}));
|
|
7234
|
-
/**
|
|
7235
|
-
* Creates a {@link CalendarDateFactory} that produces all-day calendar events with timezone-aware start times.
|
|
7236
|
-
*
|
|
7237
|
-
* The factory converts an ISO 8601 day string to a UTC date, then applies timezone normalization
|
|
7238
|
-
* so the resulting `startsAt` represents the correct moment for the target timezone.
|
|
7239
|
-
*
|
|
7240
|
-
* @param config - optional timezone configuration
|
|
7241
|
-
* @returns a factory function that creates CalendarDate objects
|
|
7242
|
-
*
|
|
7243
|
-
* @example
|
|
7244
|
-
* ```ts
|
|
7245
|
-
* const factory = calendarDateFactory({ timezone: 'America/Denver' });
|
|
7246
|
-
* const event = factory('2024-01-15', 3);
|
|
7247
|
-
* // event.type === CalendarDateType.DAYS
|
|
7248
|
-
* // event.duration === daysToMinutes(3)
|
|
7249
|
-
* ```
|
|
7250
|
-
*/ function calendarDateFactory(config) {
|
|
7251
|
-
var normalConfig = (config === null || config === void 0 ? void 0 : config.timezone) === undefined ? {
|
|
7252
|
-
useSystemTimezone: true
|
|
7253
|
-
} : {
|
|
7254
|
-
timezone: config.timezone ? config.timezone : undefined
|
|
7255
|
-
};
|
|
7256
|
-
var normal = dateTimezoneUtcNormal(normalConfig);
|
|
7257
|
-
return function(day, days) {
|
|
7258
|
-
var date = parseISO8601DayStringToUTCDate(day);
|
|
7259
|
-
var startsAt = normal.targetDateToBaseDate(date);
|
|
7260
|
-
return {
|
|
7261
|
-
type: CalendarDateType.DAYS,
|
|
7262
|
-
startsAt: startsAt,
|
|
7263
|
-
duration: daysToMinutes(days)
|
|
7264
|
-
};
|
|
7265
|
-
};
|
|
7266
|
-
}
|
|
7267
|
-
/**
|
|
7268
|
-
* Convenience function that creates a single all-day {@link CalendarDate} with optional timezone.
|
|
7269
|
-
*
|
|
7270
|
-
* Shorthand for creating a factory and immediately invoking it.
|
|
7271
|
-
*
|
|
7272
|
-
* @param day - ISO 8601 day string (e.g. '2024-01-15')
|
|
7273
|
-
* @param days - number of days the event spans
|
|
7274
|
-
* @param timezone - IANA timezone string, false for UTC, or undefined for system timezone
|
|
7275
|
-
* @returns a CalendarDate with type DAYS
|
|
7276
|
-
*
|
|
7277
|
-
* @example
|
|
7278
|
-
* ```ts
|
|
7279
|
-
* const event = calendarDate('2024-01-15', 1, 'America/Denver');
|
|
7280
|
-
* // event.type === CalendarDateType.DAYS
|
|
7281
|
-
* ```
|
|
7282
|
-
*/ function calendarDate(day, days, timezone) {
|
|
7283
|
-
return calendarDateFactory({
|
|
7284
|
-
timezone: timezone
|
|
7285
|
-
})(day, days);
|
|
7286
|
-
}
|
|
7287
|
-
/**
|
|
7288
|
-
* Wraps an existing {@link DateDurationSpan} as a time-based {@link CalendarDate}.
|
|
7289
|
-
*
|
|
7290
|
-
* @param dateDurationSpan - the duration span to wrap
|
|
7291
|
-
* @returns a CalendarDate with type TIME
|
|
7292
|
-
*
|
|
7293
|
-
* @example
|
|
7294
|
-
* ```ts
|
|
7295
|
-
* const span: DateDurationSpan = { startsAt: new Date(), duration: 60 };
|
|
7296
|
-
* const event = calendarDateForDateDurationSpan(span);
|
|
7297
|
-
* // event.type === CalendarDateType.TIME
|
|
7298
|
-
* ```
|
|
7299
|
-
*/ function calendarDateForDateDurationSpan(dateDurationSpan) {
|
|
7300
|
-
return _object_spread$6({
|
|
7301
|
-
type: CalendarDateType.TIME
|
|
7302
|
-
}, dateDurationSpan);
|
|
7303
|
-
}
|
|
7304
|
-
|
|
7305
7811
|
function _array_like_to_array$2(arr, len) {
|
|
7306
7812
|
if (len == null || len > arr.length) len = arr.length;
|
|
7307
7813
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -7341,7 +7847,7 @@ var _type, _type1;
|
|
|
7341
7847
|
* const result = knownTimezoneType('America/Denver');
|
|
7342
7848
|
* ```
|
|
7343
7849
|
*/ var knownTimezoneType = type('string > 0').narrow(function(val, ctx) {
|
|
7344
|
-
return
|
|
7850
|
+
return isKnownTimezone(val) || ctx.mustBe('a known timezone');
|
|
7345
7851
|
});
|
|
7346
7852
|
// MARK: DateDurationSpan
|
|
7347
7853
|
/**
|
|
@@ -7455,21 +7961,21 @@ var _type, _type1;
|
|
|
7455
7961
|
* Accepts both Date objects and date strings (parsed via `string.date.parse`), then validates the resulting timing
|
|
7456
7962
|
* using {@link isValidDateCellTiming}.
|
|
7457
7963
|
*/ var validDateCellTimingType = dateCellTimingType.narrow(function(val, ctx) {
|
|
7458
|
-
return
|
|
7964
|
+
return isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming');
|
|
7459
7965
|
});
|
|
7460
7966
|
/**
|
|
7461
7967
|
* ArkType DTO schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
|
|
7462
7968
|
*
|
|
7463
7969
|
* Validates cell range data from JSON/DTO input.
|
|
7464
7970
|
*/ var validDateCellRangeType = dateCellRangeType.narrow(function(val, ctx) {
|
|
7465
|
-
return
|
|
7971
|
+
return isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange');
|
|
7466
7972
|
});
|
|
7467
7973
|
/**
|
|
7468
7974
|
* ArkType DTO schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
|
|
7469
7975
|
*
|
|
7470
7976
|
* Validates cell range series data from JSON/DTO input.
|
|
7471
7977
|
*/ var validDateCellRangeSeriesType = type(dateCellRangeType.array()).narrow(function(val, ctx) {
|
|
7472
|
-
return
|
|
7978
|
+
return isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes');
|
|
7473
7979
|
});
|
|
7474
7980
|
|
|
7475
7981
|
function _assert_this_initialized$1(self) {
|
|
@@ -7749,7 +8255,7 @@ function _object_spread_props$4(target, source) {
|
|
|
7749
8255
|
logicalDate = 'now';
|
|
7750
8256
|
}
|
|
7751
8257
|
var intervalPeriod = period !== null && period !== void 0 ? period : MS_IN_SECOND;
|
|
7752
|
-
var factory = inputFactory ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
|
|
8258
|
+
var factory = inputFactory !== null && inputFactory !== void 0 ? inputFactory : protectedFactory(logicalDateStringCodeDateFactory(logicalDate));
|
|
7753
8259
|
var obs = interval(intervalPeriod, scheduler).pipe(startWith(-1), map(factory));
|
|
7754
8260
|
if (emitAll !== true) {
|
|
7755
8261
|
obs = obs.pipe(distinctUntilChanged(isSameDate));
|
|
@@ -7841,7 +8347,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7841
8347
|
{
|
|
7842
8348
|
key: "instant",
|
|
7843
8349
|
get: function get() {
|
|
7844
|
-
|
|
8350
|
+
var _this__config_instant;
|
|
8351
|
+
return (_this__config_instant = this._config.instant) !== null && _this__config_instant !== void 0 ? _this__config_instant : 'now';
|
|
7845
8352
|
}
|
|
7846
8353
|
},
|
|
7847
8354
|
{
|
|
@@ -7886,10 +8393,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7886
8393
|
var _this__config = this._config, _this__config_instant = _this__config.instant, instant = _this__config_instant === void 0 ? new Date() : _this__config_instant, _this__config_limits = _this__config.limits, limits = _this__config_limits === void 0 ? {} : _this__config_limits;
|
|
7887
8394
|
var isPast = limits.isPast, max = limits.max;
|
|
7888
8395
|
var limit = max;
|
|
7889
|
-
if (typeof max !== 'string' && isPast) {
|
|
7890
|
-
|
|
7891
|
-
limit = DATE_NOW_VALUE;
|
|
7892
|
-
}
|
|
8396
|
+
if (typeof max !== 'string' && isPast && (!max || isBefore$1(max, instant))) {
|
|
8397
|
+
limit = DATE_NOW_VALUE;
|
|
7893
8398
|
}
|
|
7894
8399
|
return limit;
|
|
7895
8400
|
}
|
|
@@ -7904,6 +8409,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7904
8409
|
* const limiter = new LimitDateTimeInstance({ limits: { isFuture: true } });
|
|
7905
8410
|
* const range = limiter.dateRange(); // { start: <now>, end: undefined }
|
|
7906
8411
|
* ```
|
|
8412
|
+
*
|
|
8413
|
+
* @returns A partial {@link DateRange} with `start` and/or `end` derived from the limits.
|
|
7907
8414
|
*/ key: "dateRange",
|
|
7908
8415
|
value: function dateRange() {
|
|
7909
8416
|
var _this__config = this._config, _this__config_instant = _this__config.instant, instant = _this__config_instant === void 0 ? new Date() : _this__config_instant;
|
|
@@ -7916,6 +8423,7 @@ function _define_property$6(obj, key, value) {
|
|
|
7916
8423
|
* like "now" or relative future offsets to resolve against the given moment.
|
|
7917
8424
|
*
|
|
7918
8425
|
* @param instant - The reference point in time for resolving dynamic limits.
|
|
8426
|
+
* @returns A partial {@link DateRange} resolved against the given instant.
|
|
7919
8427
|
*/ key: "dateRangeForInstant",
|
|
7920
8428
|
value: function dateRangeForInstant(instant) {
|
|
7921
8429
|
var _this = this, min = _this.min, max = _this.max;
|
|
@@ -7939,6 +8447,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7939
8447
|
* });
|
|
7940
8448
|
* const safe = limiter.clamp(new Date()); // at least 30 minutes from now
|
|
7941
8449
|
* ```
|
|
8450
|
+
*
|
|
8451
|
+
* @returns The clamped date within the allowed range.
|
|
7942
8452
|
*/ key: "clamp",
|
|
7943
8453
|
value: function clamp(date) {
|
|
7944
8454
|
var result = date;
|
|
@@ -7976,6 +8486,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7976
8486
|
* const clamped = limiter.clampDateRange({ start: pastDate, end: futureDate });
|
|
7977
8487
|
* // clamped.start will be at least now
|
|
7978
8488
|
* ```
|
|
8489
|
+
*
|
|
8490
|
+
* @returns The date range clamped to the allowed limits.
|
|
7979
8491
|
*/ key: "clampDateRange",
|
|
7980
8492
|
value: function clampDateRange(dateRange) {
|
|
7981
8493
|
return clampDateRangeToDateRange(dateRange, this.dateRange());
|
|
@@ -7997,6 +8509,8 @@ function _define_property$6(obj, key, value) {
|
|
|
7997
8509
|
* });
|
|
7998
8510
|
* const clamped = limiter.clamp(someDate);
|
|
7999
8511
|
* ```
|
|
8512
|
+
*
|
|
8513
|
+
* @returns A new {@link LimitDateTimeInstance}.
|
|
8000
8514
|
*/ function limitDateTimeInstance(config) {
|
|
8001
8515
|
return new LimitDateTimeInstance(config);
|
|
8002
8516
|
}
|
|
@@ -8088,14 +8602,14 @@ function _object_spread_props$3(target, source) {
|
|
|
8088
8602
|
function DateTimeMinuteInstance() {
|
|
8089
8603
|
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, dateOverride = arguments.length > 1 ? arguments[1] : void 0;
|
|
8090
8604
|
_class_call_check$5(this, DateTimeMinuteInstance);
|
|
8091
|
-
var _config_step;
|
|
8605
|
+
var _ref, _config_step;
|
|
8092
8606
|
_define_property$5(this, "_config", void 0);
|
|
8093
8607
|
_define_property$5(this, "_date", void 0);
|
|
8094
8608
|
_define_property$5(this, "_step", void 0);
|
|
8095
8609
|
_define_property$5(this, "_limit", void 0);
|
|
8096
8610
|
_define_property$5(this, "_dateFilter", void 0);
|
|
8097
8611
|
this._config = config;
|
|
8098
|
-
this._date = (dateOverride
|
|
8612
|
+
this._date = (_ref = dateOverride !== null && dateOverride !== void 0 ? dateOverride : config.date) !== null && _ref !== void 0 ? _ref : new Date();
|
|
8099
8613
|
this._step = (_config_step = config.step) !== null && _config_step !== void 0 ? _config_step : 1;
|
|
8100
8614
|
this._limit = new LimitDateTimeInstance(config);
|
|
8101
8615
|
this._dateFilter = config.schedule ? dateCellScheduleDateFilter(config.schedule) : undefined;
|
|
@@ -8129,6 +8643,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8129
8643
|
key: "limitInstance",
|
|
8130
8644
|
get: /**
|
|
8131
8645
|
* Returns the LimitDateTimeInstance. This does not take the schedule into consideration.
|
|
8646
|
+
*
|
|
8647
|
+
* @returns The underlying {@link LimitDateTimeInstance}.
|
|
8132
8648
|
*/ function get() {
|
|
8133
8649
|
return this._limit;
|
|
8134
8650
|
}
|
|
@@ -8151,6 +8667,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8151
8667
|
* // true if June 15 is a weekday and overlaps the limit range
|
|
8152
8668
|
* instance.dateDayContainsValidDateValue(new Date('2024-06-15'));
|
|
8153
8669
|
* ```
|
|
8670
|
+
*
|
|
8671
|
+
* @returns `true` if the day contains at least one valid date/time value.
|
|
8154
8672
|
*/ key: "dateDayContainsValidDateValue",
|
|
8155
8673
|
value: function dateDayContainsValidDateValue(date) {
|
|
8156
8674
|
var isInSchedule = this.dateIsInSchedule(date);
|
|
@@ -8189,6 +8707,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8189
8707
|
*
|
|
8190
8708
|
* instance.isInValidRange(new Date('2024-06-15T10:00:00')); // true if a weekday
|
|
8191
8709
|
* ```
|
|
8710
|
+
*
|
|
8711
|
+
* @returns `true` if the date is within the min/max limits and on a scheduled day.
|
|
8192
8712
|
*/ key: "isInValidRange",
|
|
8193
8713
|
value: function isInValidRange(date) {
|
|
8194
8714
|
var result = this.getStatus(date);
|
|
@@ -8211,6 +8731,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8211
8731
|
*
|
|
8212
8732
|
* instance.isValid(new Date('2099-03-15T10:00:00')); // true if all constraints pass
|
|
8213
8733
|
* ```
|
|
8734
|
+
*
|
|
8735
|
+
* @returns `true` if the date passes all configured constraints.
|
|
8214
8736
|
*/ key: "isValid",
|
|
8215
8737
|
value: function isValid(date) {
|
|
8216
8738
|
var result = this.getStatus(date);
|
|
@@ -8234,6 +8756,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8234
8756
|
* // status.isAfterMinimum === false (before min)
|
|
8235
8757
|
* // status.inFuture === false (if date is in the past)
|
|
8236
8758
|
* ```
|
|
8759
|
+
*
|
|
8760
|
+
* @returns A {@link DateTimeMinuteDateStatus} snapshot for the given date.
|
|
8237
8761
|
*/ key: "getStatus",
|
|
8238
8762
|
value: function getStatus() {
|
|
8239
8763
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
|
|
@@ -8292,6 +8816,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8292
8816
|
*
|
|
8293
8817
|
* instance.dateIsInSchedule(new Date('2024-06-15')); // true (Saturday = false)
|
|
8294
8818
|
* ```
|
|
8819
|
+
*
|
|
8820
|
+
* @returns `true` if the date is on a scheduled day or no schedule is configured.
|
|
8295
8821
|
*/ key: "dateIsInSchedule",
|
|
8296
8822
|
value: function dateIsInSchedule() {
|
|
8297
8823
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
|
|
@@ -8316,6 +8842,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8316
8842
|
* instance.round({ roundToSteps: true }); // 2024-06-15T09:00:00
|
|
8317
8843
|
* instance.round({ roundToSteps: true, roundToBound: true }); // clamped to min if below
|
|
8318
8844
|
* ```
|
|
8845
|
+
*
|
|
8846
|
+
* @returns The rounded (and optionally clamped) date.
|
|
8319
8847
|
*/ key: "round",
|
|
8320
8848
|
value: function round(round) {
|
|
8321
8849
|
var _round_step;
|
|
@@ -8345,6 +8873,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8345
8873
|
*
|
|
8346
8874
|
* instance.clamp(new Date('2024-05-25')); // clamped to min, then nearest weekday
|
|
8347
8875
|
* ```
|
|
8876
|
+
*
|
|
8877
|
+
* @returns The date clamped to both the limits and the schedule.
|
|
8348
8878
|
*/ key: "clamp",
|
|
8349
8879
|
value: function clamp() {
|
|
8350
8880
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 ? arguments[1] : void 0;
|
|
@@ -8365,6 +8895,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8365
8895
|
*
|
|
8366
8896
|
* instance.clampToLimit(new Date('2025-03-01')); // returns max (2024-12-31)
|
|
8367
8897
|
* ```
|
|
8898
|
+
*
|
|
8899
|
+
* @returns The date clamped to the configured min/max limits.
|
|
8368
8900
|
*/ key: "clampToLimit",
|
|
8369
8901
|
value: function clampToLimit() {
|
|
8370
8902
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date;
|
|
@@ -8389,7 +8921,10 @@ function _object_spread_props$3(target, source) {
|
|
|
8389
8921
|
* // If June 15, 2024 is a Saturday, returns the next Monday
|
|
8390
8922
|
* instance.clampToSchedule(new Date('2024-06-15'));
|
|
8391
8923
|
* ```
|
|
8392
|
-
|
|
8924
|
+
*
|
|
8925
|
+
* @returns The nearest valid scheduled date, or the input date if already valid or no schedule is configured.
|
|
8926
|
+
*/ // eslint-disable-next-line sonarjs/cognitive-complexity
|
|
8927
|
+
key: "clampToSchedule",
|
|
8393
8928
|
value: function clampToSchedule() {
|
|
8394
8929
|
var date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.date, maxClampDistance = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 370;
|
|
8395
8930
|
var nextAvailableDate;
|
|
@@ -8423,9 +8958,7 @@ function _object_spread_props$3(target, source) {
|
|
|
8423
8958
|
}
|
|
8424
8959
|
}
|
|
8425
8960
|
// set a default from the given input if applicable
|
|
8426
|
-
|
|
8427
|
-
nextAvailableDate = this.clampToLimit(date);
|
|
8428
|
-
}
|
|
8961
|
+
nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : nextAvailableDate = this.clampToLimit(date);
|
|
8429
8962
|
}
|
|
8430
8963
|
}
|
|
8431
8964
|
return nextAvailableDate !== null && nextAvailableDate !== void 0 ? nextAvailableDate : date;
|
|
@@ -8450,6 +8983,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8450
8983
|
* // Find the next weekday after a Saturday
|
|
8451
8984
|
* instance.findNextAvailableDayInSchedule(new Date('2024-06-15'), 'future');
|
|
8452
8985
|
* ```
|
|
8986
|
+
*
|
|
8987
|
+
* @returns The next valid schedule date, or `undefined` if none found within the max distance.
|
|
8453
8988
|
*/ key: "findNextAvailableDayInSchedule",
|
|
8454
8989
|
value: function findNextAvailableDayInSchedule(date, direction) {
|
|
8455
8990
|
var maxDistance = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 370;
|
|
@@ -8485,6 +9020,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8485
9020
|
* instance.isInSchedule(new Date('2024-06-17')); // true (Monday)
|
|
8486
9021
|
* instance.isInSchedule(new Date('2024-06-16')); // false (Sunday)
|
|
8487
9022
|
* ```
|
|
9023
|
+
*
|
|
9024
|
+
* @returns `true` if the date is on a scheduled day or no schedule is configured.
|
|
8488
9025
|
*/ key: "isInSchedule",
|
|
8489
9026
|
value: function isInSchedule(date) {
|
|
8490
9027
|
return this._dateFilter ? this._dateFilter(date) : true;
|
|
@@ -8544,6 +9081,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8544
9081
|
*
|
|
8545
9082
|
* isValid(new Date('2024-06-17T10:00:00')); // true if future weekday after min
|
|
8546
9083
|
* ```
|
|
9084
|
+
*
|
|
9085
|
+
* @returns A decision function that returns `true` for valid dates.
|
|
8547
9086
|
*/ function dateTimeMinuteDecisionFunction(config) {
|
|
8548
9087
|
var instance = new DateTimeMinuteInstance(config, null);
|
|
8549
9088
|
return function(date) {
|
|
@@ -8576,6 +9115,8 @@ function _object_spread_props$3(target, source) {
|
|
|
8576
9115
|
* // true only if both 00:00 and 23:59 on June 15 pass all constraints
|
|
8577
9116
|
* isFullDayValid(new Date('2024-06-15'));
|
|
8578
9117
|
* ```
|
|
9118
|
+
*
|
|
9119
|
+
* @returns A decision function that returns `true` for valid days.
|
|
8579
9120
|
*/ function dateTimeMinuteWholeDayDecisionFunction(config) {
|
|
8580
9121
|
var startAndEndOfDayMustBeValid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
8581
9122
|
var instance = new DateTimeMinuteInstance(config, null);
|
|
@@ -8660,6 +9201,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8660
9201
|
* guaranteeing that `raw` and `result` are defined.
|
|
8661
9202
|
*
|
|
8662
9203
|
* @param result - The parse result to check.
|
|
9204
|
+
* @returns `true` if the result is valid, narrowing the type to {@link ValidDateFromTimestringResult}.
|
|
8663
9205
|
*
|
|
8664
9206
|
* @example
|
|
8665
9207
|
* ```ts
|
|
@@ -8703,6 +9245,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8703
9245
|
*
|
|
8704
9246
|
* @param date - The date to check. Defaults to now.
|
|
8705
9247
|
* @param timezone - Overrides the instance's configured timezone for this call.
|
|
9248
|
+
* @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
|
|
8706
9249
|
*
|
|
8707
9250
|
* @example
|
|
8708
9251
|
* ```ts
|
|
@@ -8722,6 +9265,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8722
9265
|
*
|
|
8723
9266
|
* @param date - The date to format.
|
|
8724
9267
|
* @param timezone - Overrides the instance's configured timezone for this call.
|
|
9268
|
+
* @returns The formatted time string (e.g., "1:30PM").
|
|
8725
9269
|
*
|
|
8726
9270
|
* @example
|
|
8727
9271
|
* ```ts
|
|
@@ -8754,20 +9298,20 @@ function _object_spread_props$2(target, source) {
|
|
|
8754
9298
|
*/ key: "parseTimeString",
|
|
8755
9299
|
value: function parseTimeString(input, config) {
|
|
8756
9300
|
var timestringResult = this._timeStringToDate(input, config);
|
|
9301
|
+
var result;
|
|
8757
9302
|
if (isValidDateFromTimestringResult(timestringResult)) {
|
|
8758
|
-
var
|
|
9303
|
+
var dateResult = timestringResult.result, raw = timestringResult.raw;
|
|
8759
9304
|
// Use minutes since start of day. Since differenceInMinutes uses system time, we convert the raw to system time first.
|
|
8760
9305
|
var inSystemTime = systemNormalDateToBaseDate(raw);
|
|
8761
9306
|
var minutesSinceStartOfDay = differenceInMinutes(inSystemTime, startOfDay(inSystemTime));
|
|
8762
|
-
|
|
9307
|
+
result = {
|
|
8763
9308
|
utc: raw,
|
|
8764
|
-
date:
|
|
9309
|
+
date: dateResult,
|
|
8765
9310
|
minutesSinceStartOfDay: minutesSinceStartOfDay,
|
|
8766
9311
|
am: minutesSinceStartOfDay < 720 ? TimeAM.AM : TimeAM.PM
|
|
8767
9312
|
};
|
|
8768
|
-
} else {
|
|
8769
|
-
return undefined;
|
|
8770
9313
|
}
|
|
9314
|
+
return result;
|
|
8771
9315
|
}
|
|
8772
9316
|
},
|
|
8773
9317
|
{
|
|
@@ -8790,11 +9334,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8790
9334
|
*/ key: "timeStringToDate",
|
|
8791
9335
|
value: function timeStringToDate(input, config) {
|
|
8792
9336
|
var _this__timeStringToDate = this._timeStringToDate(input, config), result = _this__timeStringToDate.result, valid = _this__timeStringToDate.valid;
|
|
8793
|
-
|
|
8794
|
-
return result;
|
|
8795
|
-
} else {
|
|
8796
|
-
return undefined;
|
|
8797
|
-
}
|
|
9337
|
+
return valid ? result : undefined;
|
|
8798
9338
|
}
|
|
8799
9339
|
},
|
|
8800
9340
|
{
|
|
@@ -8820,18 +9360,35 @@ function _object_spread_props$2(target, source) {
|
|
|
8820
9360
|
'h:mm',
|
|
8821
9361
|
'HH:mm' // 01:20
|
|
8822
9362
|
];
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
9363
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
9364
|
+
try {
|
|
9365
|
+
// tslint:disable-next-line: prefer-for-of
|
|
9366
|
+
for(var _iterator = formats[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
9367
|
+
var format = _step.value;
|
|
9368
|
+
systemParsedDateTime = parse(input, format, relativeDate);
|
|
9369
|
+
if (isValid(systemParsedDateTime)) {
|
|
9370
|
+
valid = true;
|
|
9371
|
+
break; // Use time.
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
} catch (err) {
|
|
9375
|
+
_didIteratorError = true;
|
|
9376
|
+
_iteratorError = err;
|
|
9377
|
+
} finally{
|
|
9378
|
+
try {
|
|
9379
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
9380
|
+
_iterator.return();
|
|
9381
|
+
}
|
|
9382
|
+
} finally{
|
|
9383
|
+
if (_didIteratorError) {
|
|
9384
|
+
throw _iteratorError;
|
|
9385
|
+
}
|
|
8829
9386
|
}
|
|
8830
9387
|
}
|
|
8831
9388
|
var removedPm = false;
|
|
8832
9389
|
function removeAmPm(inputString) {
|
|
8833
9390
|
inputString = inputString.toLowerCase();
|
|
8834
|
-
removedPm = inputString.
|
|
9391
|
+
removedPm = inputString.includes('pm');
|
|
8835
9392
|
inputString = inputString.replace(/am|pm/g, '');
|
|
8836
9393
|
return inputString;
|
|
8837
9394
|
}
|
|
@@ -8863,6 +9420,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8863
9420
|
case 6:
|
|
8864
9421
|
// 1212AM
|
|
8865
9422
|
removeAmPm(input);
|
|
9423
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- removedPm is set via closure side effect in removeAmPm()
|
|
8866
9424
|
if (removedPm) {
|
|
8867
9425
|
removedPm = input[0] !== '2'; // If 2, ignore the PM part.
|
|
8868
9426
|
}
|
|
@@ -8931,6 +9489,8 @@ function _object_spread_props$2(target, source) {
|
|
|
8931
9489
|
/**
|
|
8932
9490
|
* Creates a {@link DateTimeUtilityInstance} configured for UTC.
|
|
8933
9491
|
*
|
|
9492
|
+
* @returns A new {@link DateTimeUtilityInstance} using the UTC timezone.
|
|
9493
|
+
*
|
|
8934
9494
|
* @example
|
|
8935
9495
|
* ```ts
|
|
8936
9496
|
* const utcInstance = dateTimeInstanceUtc();
|
|
@@ -8944,6 +9504,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8944
9504
|
* Defaults to UTC when no timezone is provided.
|
|
8945
9505
|
*
|
|
8946
9506
|
* @param timezone - The IANA timezone identifier (e.g., 'America/New_York').
|
|
9507
|
+
* @returns A new {@link DateTimeUtilityInstance} for the specified timezone.
|
|
8947
9508
|
*
|
|
8948
9509
|
* @example
|
|
8949
9510
|
* ```ts
|
|
@@ -8958,6 +9519,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8958
9519
|
*
|
|
8959
9520
|
* @param date - The date to check. Defaults to now.
|
|
8960
9521
|
* @param timezone - The IANA timezone to evaluate in. Defaults to UTC.
|
|
9522
|
+
* @returns {@link TimeAM.AM} or {@link TimeAM.PM} depending on the time of day.
|
|
8961
9523
|
*
|
|
8962
9524
|
* @example
|
|
8963
9525
|
* ```ts
|
|
@@ -8975,6 +9537,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8975
9537
|
* unlike {@link toReadableTimeString} which defaults to UTC.
|
|
8976
9538
|
*
|
|
8977
9539
|
* @param date - The date to format.
|
|
9540
|
+
* @returns The formatted time string in the system's local timezone.
|
|
8978
9541
|
*
|
|
8979
9542
|
* @example
|
|
8980
9543
|
* ```ts
|
|
@@ -8988,6 +9551,7 @@ function _object_spread_props$2(target, source) {
|
|
|
8988
9551
|
*
|
|
8989
9552
|
* @param date - The date to format.
|
|
8990
9553
|
* @param timezone - The IANA timezone to format in. Defaults to UTC.
|
|
9554
|
+
* @returns The formatted time string (e.g., "10:30AM").
|
|
8991
9555
|
*
|
|
8992
9556
|
* @example
|
|
8993
9557
|
* ```ts
|
|
@@ -9003,6 +9567,7 @@ function _object_spread_props$2(target, source) {
|
|
|
9003
9567
|
*
|
|
9004
9568
|
* @param input - A time string such as "1:30PM", "13:30", or "1PM".
|
|
9005
9569
|
* @param config - Optional configuration specifying the timezone and reference date.
|
|
9570
|
+
* @returns The parsed time string result, or `undefined` if parsing failed.
|
|
9006
9571
|
*
|
|
9007
9572
|
* @example
|
|
9008
9573
|
* ```ts
|
|
@@ -9021,6 +9586,7 @@ function _object_spread_props$2(target, source) {
|
|
|
9021
9586
|
*
|
|
9022
9587
|
* @param input - A time string such as "1:30PM" or "13:30".
|
|
9023
9588
|
* @param config - Optional configuration specifying the timezone and reference date.
|
|
9589
|
+
* @returns The resolved date, or `undefined` if the input could not be parsed.
|
|
9024
9590
|
*
|
|
9025
9591
|
* @example
|
|
9026
9592
|
* ```ts
|
|
@@ -9034,6 +9600,7 @@ function _object_spread_props$2(target, source) {
|
|
|
9034
9600
|
* Creates a {@link LimitDateTimeInstance} for clamping and constraining dates to a configured range.
|
|
9035
9601
|
*
|
|
9036
9602
|
* @param config - The limit configuration specifying min/max bounds, future requirements, etc.
|
|
9603
|
+
* @returns A new {@link LimitDateTimeInstance} configured with the given bounds.
|
|
9037
9604
|
*
|
|
9038
9605
|
* @example
|
|
9039
9606
|
* ```ts
|
|
@@ -9143,6 +9710,7 @@ function _object_spread_props$1(target, source) {
|
|
|
9143
9710
|
date: toZonedTime(find.range.date, find.timezone)
|
|
9144
9711
|
}) : find.range;
|
|
9145
9712
|
var dates = dateRange(range);
|
|
9713
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
9146
9714
|
switch(range.type){
|
|
9147
9715
|
case DateRangeType.DAY:
|
|
9148
9716
|
case DateRangeType.WEEK:
|
|
@@ -9338,13 +9906,12 @@ function _object_spread$1(target) {
|
|
|
9338
9906
|
// A single field that manages start/end will start and end at the same instant (end = start)
|
|
9339
9907
|
// so we merge the gte/lte values.
|
|
9340
9908
|
var merged = mergeMongoDBLikeRangeFilters(startsAt, endsAt);
|
|
9341
|
-
startsAtFilter =
|
|
9909
|
+
startsAtFilter = _define_property$2({}, fields.start, merged);
|
|
9342
9910
|
} else {
|
|
9343
9911
|
startsAtFilter = startsAt ? _define_property$2({}, fields.start, startsAt) : undefined;
|
|
9344
9912
|
endsAtFilter = endsAt && fields.end ? _define_property$2({}, fields.end, endsAt) : undefined;
|
|
9345
9913
|
}
|
|
9346
|
-
|
|
9347
|
-
return filter;
|
|
9914
|
+
return _object_spread$1({}, startsAtFilter, endsAtFilter);
|
|
9348
9915
|
}
|
|
9349
9916
|
};
|
|
9350
9917
|
}
|
|
@@ -9467,6 +10034,8 @@ function _is_native_reflect_construct() {
|
|
|
9467
10034
|
* const rule = new DateRRule({ freq: RRule.DAILY, count: 5, dtstart: startDate });
|
|
9468
10035
|
* const lastDate = rule.last(); // fifth occurrence
|
|
9469
10036
|
* ```
|
|
10037
|
+
*
|
|
10038
|
+
* @returns The last occurrence date, or `undefined` if there are none.
|
|
9470
10039
|
*/ key: "last",
|
|
9471
10040
|
value: function last() {
|
|
9472
10041
|
return this._iter(new LastIterResult());
|
|
@@ -9481,6 +10050,9 @@ function _is_native_reflect_construct() {
|
|
|
9481
10050
|
* const rule = new DateRRule({ freq: RRule.WEEKLY, dtstart: startDate });
|
|
9482
10051
|
* const nextDate = rule.next(new Date());
|
|
9483
10052
|
* ```
|
|
10053
|
+
*
|
|
10054
|
+
* @param minDate - The earliest date to consider.
|
|
10055
|
+
* @returns The first occurrence on or after `minDate`, or `undefined` if none.
|
|
9484
10056
|
*/ key: "next",
|
|
9485
10057
|
value: function next(minDate) {
|
|
9486
10058
|
return this._iter(new NextIterResult(minDate));
|
|
@@ -9495,6 +10067,11 @@ function _is_native_reflect_construct() {
|
|
|
9495
10067
|
* const rule = new DateRRule({ freq: RRule.DAILY, dtstart: startDate });
|
|
9496
10068
|
* const exists = rule.any({ minDate: rangeStart, maxDate: rangeEnd });
|
|
9497
10069
|
* ```
|
|
10070
|
+
*
|
|
10071
|
+
* @param filter - Optional date bounds with `minDate` and `maxDate`.
|
|
10072
|
+
* @param filter.minDate - Optional minimum date bound.
|
|
10073
|
+
* @param filter.maxDate - Optional maximum date bound.
|
|
10074
|
+
* @returns `true` if at least one recurrence falls within the bounds.
|
|
9498
10075
|
*/ key: "any",
|
|
9499
10076
|
value: function any() {
|
|
9500
10077
|
var filter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -9552,13 +10129,15 @@ function _is_native_reflect_construct() {
|
|
|
9552
10129
|
value: function accept(date) {
|
|
9553
10130
|
++this.total;
|
|
9554
10131
|
var tooLate = date > this.maxDate;
|
|
10132
|
+
var result;
|
|
9555
10133
|
if (tooLate) {
|
|
9556
|
-
|
|
10134
|
+
result = false;
|
|
9557
10135
|
} else {
|
|
9558
10136
|
this.add(date);
|
|
9559
10137
|
var maxIterationReached = this.total >= this._maxIterationsAllowed;
|
|
9560
|
-
|
|
10138
|
+
result = !maxIterationReached;
|
|
9561
10139
|
}
|
|
10140
|
+
return result;
|
|
9562
10141
|
}
|
|
9563
10142
|
},
|
|
9564
10143
|
{
|
|
@@ -9598,13 +10177,15 @@ function _is_native_reflect_construct() {
|
|
|
9598
10177
|
value: function accept(date) {
|
|
9599
10178
|
this.total += 1;
|
|
9600
10179
|
var tooEarly = this.minDate > date;
|
|
10180
|
+
var result;
|
|
9601
10181
|
if (tooEarly) {
|
|
9602
10182
|
var maxIterationReached = this.total >= this.maxIterationsAllowed;
|
|
9603
|
-
|
|
10183
|
+
result = !maxIterationReached;
|
|
9604
10184
|
} else {
|
|
9605
10185
|
this.add(date);
|
|
9606
|
-
|
|
10186
|
+
result = false;
|
|
9607
10187
|
}
|
|
10188
|
+
return result;
|
|
9608
10189
|
}
|
|
9609
10190
|
},
|
|
9610
10191
|
{
|
|
@@ -9647,18 +10228,20 @@ function _is_native_reflect_construct() {
|
|
|
9647
10228
|
value: function accept(date) {
|
|
9648
10229
|
++this.total;
|
|
9649
10230
|
var tooEarly = this.minDate != null && this.minDate > date;
|
|
10231
|
+
var result;
|
|
9650
10232
|
if (tooEarly) {
|
|
9651
10233
|
var maxIterationReached = this.total >= this.maxIterationsAllowed;
|
|
9652
|
-
|
|
10234
|
+
result = !maxIterationReached;
|
|
9653
10235
|
} else {
|
|
9654
10236
|
var tooLate = this.maxDate != null && this.maxDate < date;
|
|
9655
10237
|
if (tooLate) {
|
|
9656
|
-
|
|
10238
|
+
result = true;
|
|
9657
10239
|
} else {
|
|
9658
10240
|
this.add(date);
|
|
9659
|
-
|
|
10241
|
+
result = false;
|
|
9660
10242
|
}
|
|
9661
10243
|
}
|
|
10244
|
+
return result;
|
|
9662
10245
|
}
|
|
9663
10246
|
},
|
|
9664
10247
|
{
|
|
@@ -9748,7 +10331,11 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9748
10331
|
}
|
|
9749
10332
|
/**
|
|
9750
10333
|
* Delimiter separating the property name/params from values in an RRule line.
|
|
9751
|
-
*/ var
|
|
10334
|
+
*/ var RRULE_STRING_SPLITTER = ':';
|
|
10335
|
+
/**
|
|
10336
|
+
* @deprecated use RRULE_STRING_SPLITTER instead.
|
|
10337
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10338
|
+
var RRuleStringSplitter = RRULE_STRING_SPLITTER;
|
|
9752
10339
|
/**
|
|
9753
10340
|
* Utility class for parsing and manipulating RFC 5545 RRule strings.
|
|
9754
10341
|
*
|
|
@@ -9779,6 +10366,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9779
10366
|
* // result.basic = ['RRULE:FREQ=DAILY']
|
|
9780
10367
|
* // result.exdates contains the parsed exclusion dates
|
|
9781
10368
|
* ```
|
|
10369
|
+
*
|
|
10370
|
+
* @param input - The RRule string line set to separate.
|
|
10371
|
+
* @returns The separated basic rules and parsed EXDATE exclusion dates.
|
|
9782
10372
|
*/ function separateRRuleStringSetValues(input) {
|
|
9783
10373
|
var basic = [];
|
|
9784
10374
|
var exdateRules = [];
|
|
@@ -9808,6 +10398,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9808
10398
|
/**
|
|
9809
10399
|
* Parses an EXDATE line into its timezone and date components.
|
|
9810
10400
|
*
|
|
10401
|
+
* @param line - The raw EXDATE line string to parse.
|
|
10402
|
+
* @returns The parsed EXDATE attribute with timezone and dates.
|
|
9811
10403
|
* @throws Error if the line is not an EXDATE property.
|
|
9812
10404
|
*/ function parseExdateAttributeFromLine(line) {
|
|
9813
10405
|
var property = this.parseProperty(line);
|
|
@@ -9819,6 +10411,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9819
10411
|
key: "parseExdateAttributeFromProperty",
|
|
9820
10412
|
value: /**
|
|
9821
10413
|
* Extracts timezone and UTC-normalized dates from an already-parsed EXDATE property.
|
|
10414
|
+
*
|
|
10415
|
+
* @param property - The parsed EXDATE property to extract from.
|
|
10416
|
+
* @returns The EXDATE attribute containing timezone and UTC-normalized dates.
|
|
9822
10417
|
*/ function parseExdateAttributeFromProperty(property) {
|
|
9823
10418
|
var _property_params_find;
|
|
9824
10419
|
var timezone = (_property_params_find = property.params.find(function(x) {
|
|
@@ -9842,6 +10437,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9842
10437
|
value: /**
|
|
9843
10438
|
* Convenience wrapper that creates a timezone converter and delegates to {@link parseDateTimeString}.
|
|
9844
10439
|
*
|
|
10440
|
+
* @param rfcDateString - The RFC 5545 date or date-time string to parse.
|
|
10441
|
+
* @param timezone - Optional timezone for non-UTC date strings.
|
|
10442
|
+
* @returns The parsed JavaScript Date.
|
|
9845
10443
|
* @throws Error if the date string is not UTC and no timezone is provided.
|
|
9846
10444
|
*/ function parseDateTimeStringWithTimezone(rfcDateString, timezone) {
|
|
9847
10445
|
return DateRRuleParseUtility.parseDateTimeString(rfcDateString, timezone ? new DateTimezoneUtcNormalInstance({
|
|
@@ -9857,6 +10455,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9857
10455
|
* If the string does not end in `Z` (indicating UTC), the converter is used to normalize
|
|
9858
10456
|
* the local date representation to its true UTC equivalent.
|
|
9859
10457
|
*
|
|
10458
|
+
* @param rfcDateString - The RFC 5545 date or date-time string to parse.
|
|
10459
|
+
* @param converter - Optional timezone converter for non-UTC date strings.
|
|
10460
|
+
* @returns The parsed JavaScript Date.
|
|
9860
10461
|
* @throws Error if the string cannot be parsed or a non-UTC string lacks a converter.
|
|
9861
10462
|
*/ function parseDateTimeString(rfcDateString, converter) {
|
|
9862
10463
|
var RFC5545_DATE_TIME_FORMAT = /^((\d{4})(\d{2})(\d{2}))(T(\d{2})(\d{2})(\d{2})Z?)?$/;
|
|
@@ -9900,6 +10501,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9900
10501
|
* DateRRuleParseUtility.formatDateTimeString(new Date('2021-06-11T11:00:00Z'));
|
|
9901
10502
|
* // => '20210611T110000Z'
|
|
9902
10503
|
* ```
|
|
10504
|
+
*
|
|
10505
|
+
* @param date - The date to format.
|
|
10506
|
+
* @returns The RFC 5545 UTC date-time string representation.
|
|
9903
10507
|
*/ function formatDateTimeString(date) {
|
|
9904
10508
|
return format(date, "yyyyMMdd'T'HHmmss'Z'");
|
|
9905
10509
|
}
|
|
@@ -9908,6 +10512,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9908
10512
|
key: "parseProperty",
|
|
9909
10513
|
value: /**
|
|
9910
10514
|
* Parses a full RRule line string into a structured {@link RRuleProperty}.
|
|
10515
|
+
*
|
|
10516
|
+
* @param line - The raw RRule line string to parse.
|
|
10517
|
+
* @returns The structured property with type, params, and values.
|
|
9911
10518
|
*/ function parseProperty(line) {
|
|
9912
10519
|
var rawLine = DateRRuleParseUtility.parseRawLine(line);
|
|
9913
10520
|
return DateRRuleParseUtility.propertyFromRawLine(rawLine);
|
|
@@ -9917,6 +10524,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9917
10524
|
key: "propertyFromRawLine",
|
|
9918
10525
|
value: /**
|
|
9919
10526
|
* Converts an {@link RRuleRawLine} into a structured {@link RRuleProperty} by splitting the type and params.
|
|
10527
|
+
*
|
|
10528
|
+
* @param rawLine - The raw line to convert.
|
|
10529
|
+
* @returns The structured property with separated type, params, and values.
|
|
9920
10530
|
*/ function propertyFromRawLine(rawLine) {
|
|
9921
10531
|
var typeAndParams = rawLine.params.split(';');
|
|
9922
10532
|
var type = typeAndParams[0].toUpperCase();
|
|
@@ -9932,6 +10542,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9932
10542
|
key: "parseRawParam",
|
|
9933
10543
|
value: /**
|
|
9934
10544
|
* Splits a raw param string (e.g., `"TZID=America/New_York"`) into key-value form.
|
|
10545
|
+
*
|
|
10546
|
+
* @param param - The raw param string to split.
|
|
10547
|
+
* @returns The parsed key-value param.
|
|
9935
10548
|
*/ function parseRawParam(param) {
|
|
9936
10549
|
var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(param, '=', 2), 2), key = _splitJoinRemainder[0], value = _splitJoinRemainder[1];
|
|
9937
10550
|
return {
|
|
@@ -9945,19 +10558,24 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9945
10558
|
value: /**
|
|
9946
10559
|
* Splits a raw line at the colon delimiter into params and values portions.
|
|
9947
10560
|
* Falls back to treating a single-segment line as an RRULE value.
|
|
10561
|
+
*
|
|
10562
|
+
* @param line - The raw RRule line string to split.
|
|
10563
|
+
* @returns The raw line with separated params and values.
|
|
9948
10564
|
*/ function parseRawLine(line) {
|
|
9949
|
-
var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(line,
|
|
10565
|
+
var _splitJoinRemainder = _sliced_to_array$1(splitJoinRemainder(line, RRULE_STRING_SPLITTER, 2), 2), params = _splitJoinRemainder[0], values = _splitJoinRemainder[1];
|
|
10566
|
+
var result;
|
|
9950
10567
|
if (line.length === 1) {
|
|
9951
|
-
|
|
10568
|
+
result = {
|
|
9952
10569
|
params: 'RRULE',
|
|
9953
10570
|
values: params
|
|
9954
10571
|
};
|
|
9955
10572
|
} else {
|
|
9956
|
-
|
|
10573
|
+
result = {
|
|
9957
10574
|
params: params,
|
|
9958
10575
|
values: values
|
|
9959
10576
|
};
|
|
9960
10577
|
}
|
|
10578
|
+
return result;
|
|
9961
10579
|
}
|
|
9962
10580
|
},
|
|
9963
10581
|
{
|
|
@@ -9965,6 +10583,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9965
10583
|
value: // MARK: String
|
|
9966
10584
|
/**
|
|
9967
10585
|
* Splits a newline-delimited RRule string into individual line strings.
|
|
10586
|
+
*
|
|
10587
|
+
* @param lines - The newline-delimited RRule string to split.
|
|
10588
|
+
* @returns An array of individual RRule line strings.
|
|
9968
10589
|
*/ function toRRuleStringSet(lines) {
|
|
9969
10590
|
return lines.split('\n');
|
|
9970
10591
|
}
|
|
@@ -9973,6 +10594,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9973
10594
|
key: "toRRuleLines",
|
|
9974
10595
|
value: /**
|
|
9975
10596
|
* Joins an array of RRule line strings into a single newline-delimited string.
|
|
10597
|
+
*
|
|
10598
|
+
* @param rruleStringSet - The array of RRule line strings to join.
|
|
10599
|
+
* @returns A single newline-delimited RRule string.
|
|
9976
10600
|
*/ function toRRuleLines(rruleStringSet) {
|
|
9977
10601
|
return rruleStringSet.join('\n');
|
|
9978
10602
|
}
|
|
@@ -9983,6 +10607,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
9983
10607
|
/**
|
|
9984
10608
|
* Asserts that the property has the expected type, throwing if it does not match.
|
|
9985
10609
|
*
|
|
10610
|
+
* @param type - The expected property type.
|
|
10611
|
+
* @param property - The property to check.
|
|
9986
10612
|
* @throws Error if the property type does not match the expected type.
|
|
9987
10613
|
*/ function assertPropertyType(type, property) {
|
|
9988
10614
|
if (property.type !== type) {
|
|
@@ -10123,7 +10749,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
10123
10749
|
this.options = options;
|
|
10124
10750
|
var tzid = rrule.origOptions.tzid;
|
|
10125
10751
|
var dtstart = rrule.origOptions.dtstart;
|
|
10126
|
-
var timezone = tzid
|
|
10752
|
+
var timezone = tzid !== null && tzid !== void 0 ? tzid : options.timezone;
|
|
10127
10753
|
/**
|
|
10128
10754
|
* The normal instance for DateRRuleInstance is used backwards in most cases because DateRRule always
|
|
10129
10755
|
* parses dates as UTC, so we handle all input dates as base dates, an
|
|
@@ -10174,8 +10800,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
10174
10800
|
var from = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
|
|
10175
10801
|
var baseFrom = this.normalInstance.baseDateToTargetDate(from);
|
|
10176
10802
|
var rawNext = this.rrule.next(baseFrom);
|
|
10177
|
-
|
|
10178
|
-
return next;
|
|
10803
|
+
return rawNext ? this.normalInstance.targetDateToBaseDate(rawNext) : undefined;
|
|
10179
10804
|
}
|
|
10180
10805
|
},
|
|
10181
10806
|
{
|
|
@@ -10316,11 +10941,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
10316
10941
|
/**
|
|
10317
10942
|
* Returns `true` when the underlying RRule has neither a `count` nor an
|
|
10318
10943
|
* `until` constraint, meaning it recurs indefinitely.
|
|
10944
|
+
*
|
|
10945
|
+
* @returns `true` if the rule recurs indefinitely.
|
|
10319
10946
|
*/ key: "hasForeverRange",
|
|
10320
10947
|
value: function hasForeverRange() {
|
|
10321
10948
|
var options = this.rrule.options;
|
|
10322
|
-
|
|
10323
|
-
return forever;
|
|
10949
|
+
return !options.count && !options.until;
|
|
10324
10950
|
}
|
|
10325
10951
|
}
|
|
10326
10952
|
], [
|
|
@@ -10532,4 +11158,4 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
10532
11158
|
}
|
|
10533
11159
|
();
|
|
10534
11160
|
|
|
10535
|
-
export { AnyIterResult, CalendarDateType, DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX, DATE_TODAY_END_VALUE, DATE_TODAY_START_VALUE, DATE_WEEK_END_VALUE, DATE_WEEK_START_VALUE, DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE, DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION, DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS, DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED, DateCellScheduleDayCode, DateRRule, DateRRuleInstance, DateRRuleParseUtility, DateRRuleUtility, DateRangeType, DateSet, DateTimeMinuteInstance, DateTimeUtilityInstance, DateTimezoneUtcNormalInstance, IterateDaysInDateRangeFunctionBailError, LastIterResult, LimitDateTimeInstance, MAX_FUTURE_DATE, ModelRecurrenceInfoUtility, NextIterResult, RRuleStringSplitter, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, UNKNOWN_YEAR_WEEK_CODE, UTC_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, allIndexesInDateCellRange, allIndexesInDateCellRanges, allIndexesInDateCellRangesToArray, allKnownTimezoneStrings, allTimezoneInfos, allTimezoneStrings, baseDateToTargetDate, calculateAllConversions, calculateExpectedDateCellTimingDuration, calculateExpectedDateCellTimingDurationPair, calculateTimezoneOffset, calendarDate, calendarDateFactory, calendarDateForDateDurationSpan, calendarDateType, changeDateCellScheduleDateRangeToTimezone, changeDateCellScheduleDateRangeToTimezoneFunction, clampDateFunction, clampDateRangeFunction, clampDateRangeToDateRange, clampDateToDateRange, copyDateCellScheduleDateFilterConfig, copyHoursAndMinutesFromDateWithTimezoneNormal, copyHoursAndMinutesFromNowWithTimezoneNormal, copyHoursAndMinutesFromUTCDate, copyHoursAndMinutesToDate, copyHoursAndMinutesToToday, dateCell, dateCellDayOfWeekFactory, dateCellDayTimingInfoFactory, dateCellDurationSpanHasEndedFilterFunction, dateCellDurationSpanHasNotEndedFilterFunction, dateCellDurationSpanHasNotStartedFilterFunction, dateCellDurationSpanHasStartedFilterFunction, dateCellEndIndex, dateCellIndexRange, dateCellIndexRangeToDateCellRange, dateCellIndexYearWeekCodeFactory, dateCellIndexYearWeekCodeGroupFactory, dateCellIndexsForDateCellScheduleDayCodes, dateCellRange, dateCellRangeBlocksCount, dateCellRangeBlocksCountInfo, dateCellRangeHasRange, dateCellRangeIncludedByRangeFunction, dateCellRangeOfTiming, dateCellRangeOfTimingFactory, dateCellRangeOverlapsRange, dateCellRangeOverlapsRangeFunction, dateCellRangeToDateCellIndexRange, dateCellRangeType, dateCellRangeWithRange, dateCellRangeWithRangeFromIndex, dateCellRangesFullyCoverDateCellRangeFunction, dateCellScheduleDateCellTimingFilter, dateCellScheduleDateFilter, dateCellScheduleDateRange, dateCellScheduleDayCodeFactory, dateCellScheduleDayCodesAreSetsEquivalent, dateCellScheduleDayCodesFromEnabledDays, dateCellScheduleDayCodesSetFromDaysOfWeek, dateCellScheduleEncodedWeek, dateCellScheduleType, dateCellTiming, dateCellTimingCompletedTimeRange, dateCellTimingDateFactory, dateCellTimingDateRange, dateCellTimingEndDateFactory, dateCellTimingEndIndex, dateCellTimingEventRange, dateCellTimingExpansionFactory, dateCellTimingFinalStartsAtEvent, dateCellTimingFromDateCellTimingStartsAtEndRange, dateCellTimingLatestCompletedIndex, dateCellTimingRelativeIndexArrayFactory, dateCellTimingRelativeIndexFactory, dateCellTimingStart, dateCellTimingStartDateFactory, dateCellTimingStartPair, dateCellTimingStartsAtDateFactory, dateCellTimingStartsAtForStartOfDay, dateCellTimingTimezoneNormalInstance, dateCellTimingType, dateCellType, dateDurationSpanEndDate, dateDurationSpanType, dateFromLogicalDate, dateInterval, dateMonthDayStringFormat, dateOrDateRangeToDateRange, dateOrDayStringRangeToDateRange, dateOrDayStringRangeToISO8601DayStringRange, dateRange, dateRangeDaysCount, dateRangeFromStartAndEndOfDay, dateRangeOverlapsDateRange, dateRangeOverlapsDateRangeFunction, dateRangeParamsType, dateRangeRelativeState, dateRangeType, dateRelativeStateForDateCellRangeComparedToIndex, dateShortDateAndTimeStringFormat, dateTimeInstance, dateTimeInstanceUtc, dateTimeMinuteDecisionFunction, dateTimeMinuteWholeDayDecisionFunction, dateTimeStringFormat, dateTimezoneUtcNormal, daysToMinutes, durationSpanDateRelativeState, durationSpanFromDateRange, durationSpanToDateRange, earliestDate, enabledDaysFromDateCellScheduleDayCodes, endItreateDaysInDateRangeEarly, expandDateCellCollection, expandDateCellRange, expandDateCellSchedule, expandDateCellScheduleDayCodes, expandDateCellScheduleDayCodesToDayCodesSet, expandDateCellScheduleDayCodesToDayOfWeekSet, expandDateCellScheduleFactory, expandDateCellScheduleRange, expandDateCellScheduleRangeToDateCellRanges, expandDateCellTiming, expandDaysForDateRange, expandDaysForDateRangeFunction, expandUniqueDateCellsFunction, filterDateCellsInDateCellRange, findMaxDate, findMinDate, findNextDateInDateCellScheduleFilter, fitDateRangeToDayPeriod, fitDateRangeToDayPeriodFunction, fitUTCDateRangeToDayPeriod, forEachDayInDateRange, formatDateDistance, formatDateRange, formatDateRangeDistance, formatDateRangeDistanceFunction, formatDateRangeFunction, formatStartedEndedDistanceString, formatToDateString, formatToDayRangeString, formatToDayTimeRangeString, formatToISO8601DateString, formatToISO8601DayStringForSystem, formatToISO8601DayStringForUTC, formatToMonthDaySlashDate, formatToMonthDayString, formatToShortDateAndTimeString, formatToShortDateString, formatToTimeAndDurationString, formatToTimeRangeString, formatToTimeString, fractionalHoursInDurationSpan, fullDateCellScheduleRange, fullDateCellTiming, fullDateCellTimingTimezonePair, fullWeekDateCellScheduleDayCodes, getCurrentSystemOffsetInHours, getCurrentSystemOffsetInMinutes, getCurrentSystemOffsetInMs, getDateCellTimingFirstEventDateRange, getDateCellTimingHoursInEvent, getDaysOfWeekInDateRange, getGreatestDateCellIndexInDateCellRanges, getLeastAndGreatestDateCellIndexInDateCellRanges, getLeastDateCellIndexInDateCellRanges, getNextDateCellTimingIndex, getRelativeDateForDateCellTiming, getRelativeIndexForDateCellTiming, getTimeAM, getTimezoneAbbreviation, getTimezoneLongName, groupDateRangesByDateRelativeState, groupToDateCellRanges, groupUniqueDateCells, guessCurrentTimezone, hoursToMs, inverseDateTimezoneUtcNormalInstanceTransformType, isAfter, isBefore, isDate, isDateCellRange, isDateCellSchedule, isDateCellScheduleDateRange, isDateCellScheduleEncodedWeek, isDateCellScheduleStartOfDayDateRange, isDateCellTiming, isDateCellTimingRelativeIndexFactory, isDateCellWithinDateCellRange, isDateCellWithinDateCellRangeFunction, isDateInDateRange, isDateInDateRangeFunction, isDateRange, isDateRangeInDateRange, isDateRangeInDateRangeFunction, isDateRangeStart, isDateWithinDateCellRangeFunction, isEmptyDateCellScheduleEncodedWeek, isEndOfDayInUTC, isFullDateCellScheduleDateRange, isFullDateCellTiming, isFullDateRange, isInfiniteDateRange, isKnownTimezone, isLogicalDateStringCode, isMaxFutureDate, isPartialDateRange, isSameDate, isSameDateCellSchedule, isSameDateCellScheduleDateRange, isSameDateCellScheduleEventRange, isSameDateCellTiming, isSameDateCellTimingEventStartsAtEndRange, isSameDateDay, isSameDateDayRange, isSameDateHoursAndMinutes, isSameDateRange, isSameDateTimezoneConversionConfig, isSameDurationSpan, isSameFullDateCellScheduleDateRange, isSameFullDateCellTiming, isStartOfDayForSystem, isStartOfDayInUTC, isValidDateCellIndex, isValidDateCellRange, isValidDateCellRangeSeries, isValidDateCellTiming, isValidDateCellTimingInfo, isValidDateCellTimingStartDate, isValidDateFromTimestringResult, isValidDateTimezoneConversionConfig, isValidFullDateCellTiming, isValidFullDateCellTimingInfo, iterateDaysInDateRange, iterateDaysInDateRangeFunction, knownTimezoneType, latestDate, latestMinute, limitDateTime, limitDateTimeInstance, logicalDateStringCodeDateFactory, makeDateQueryForDateItemRangeFilter, makeDateQueryForDateStartsEndsFilter, makeDateQueryForOccuringFilter, makeDaysAndTimeFiltersFunction, makeMongoDBLikeDateQueryBuilder, maxFutureDate, mergeMongoDBLikeRangeFilters, minutesToMs, modelRecurrenceInfoType, modifyDateCellToFitRange, modifyDateCellsToFitRange, modifyDateCellsToFitRangeFunction, monthDaySlashDateStringFormat, msToMinutes, msToSeconds, nowInterval, parseISO8601DayStringToDate, parseJsDateString, parseReadableTimeString, rawDateCellScheduleDayCodes, readDaysOfWeek, readDaysOfWeekNames, readableTimeStringToDate, reduceDatesFunction, requireCurrentTimezone, roundDateDownTo, roundDateTimeDown, roundDateTimeDownToSteps, roundDateTo, roundDateToDate, roundDateToUnixDateTimeNumber, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, setOnDateWithTimezoneNormalFunction, shiftDateCellTimingToSystemTimezone, shiftDateCellTimingToTimezone, shiftDateCellTimingToTimezoneFunction, shiftDateCellTimingToUTCTimezone, simplifyDateCellScheduleDayCodes, sortByDateFunction, sortByISO8601DateStringFunction, sortByISO8601DateStrings, sortDateCellRangeAndSizeFunction, sortDateCellRanges, sortDateRangeStartAscendingCompareFunction, startOfDayInTimezoneDayStringFactory, startOfDayInTimezoneFromISO8601DayString, startOfWeekForYearWeekCode, systemBaseDateToNormalDate, systemBaseDateToNormalDateOffset, systemDateTimezoneUtcNormal, systemExperiencesDaylightSavings, systemNormalDateToBaseDate, systemNormalDateToBaseDateOffset, targetDateToBaseDate, timezoneInfoForSystem, timezoneStringToSearchableString, timezoneStringToTimezoneInfo, toISO8601DayStringForSystem, toISO8601DayStringForUTC, toISODateString, toJsDate, toJsDayDate, toLocalReadableTimeString, toReadableTimeString, transformDateInTimezoneNormalFunction, transformDateRangeDatesFunction, transformDateRangeInTimezoneNormalFunction, transformDateRangeToTimezoneFunction, transformDateRangeWithStartOfDay, updateDateCellTimingToSystemTimezone, updateDateCellTimingToTimezone, updateDateCellTimingToTimezoneFunction, updateDateCellTimingToUTCTimezone, updateDateCellTimingWithDateCellTimingEvent, utcDayForDate, validDateCellRangeSeriesType, validDateCellRangeType, validDateCellTimingType, weekdayDateCellScheduleDayCodes, weekendDateCellScheduleDayCodes, yearWeekCode, yearWeekCodeDateFactory, yearWeekCodeDateTimezoneInstance, yearWeekCodeFactory, yearWeekCodeForCalendarMonth, yearWeekCodeForCalendarMonthFactory, yearWeekCodeForDateRange, yearWeekCodeForDateRangeFactory, yearWeekCodeForDateRangeInTimezone, yearWeekCodeFromDate, yearWeekCodeFromPair, yearWeekCodeGroupFactory, yearWeekCodeIndex, yearWeekCodePair, yearWeekCodePairFromDate };
|
|
11161
|
+
export { AnyIterResult, CalendarDateType, DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX, DATE_MONTH_DAY_STRING_FORMAT, DATE_SHORT_DATE_AND_TIME_STRING_FORMAT, DATE_TIME_STRING_FORMAT, DATE_TODAY_END_VALUE, DATE_TODAY_START_VALUE, DATE_WEEK_END_VALUE, DATE_WEEK_START_VALUE, DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE, DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION, DEFAULT_ITERATE_DAYS_IN_DATE_RANGE_MAX_ITERATIONS, DEFAULT_LAST_ITER_RESULT_MAX_ITERATIONS_ALLOWED, DateCellScheduleDayCode, DateRRule, DateRRuleInstance, DateRRuleParseUtility, DateRRuleUtility, DateRangeType, DateSet, DateTimeMinuteInstance, DateTimeUtilityInstance, DateTimezoneUtcNormalInstance, IterateDaysInDateRangeFunctionBailError, LastIterResult, LimitDateTimeInstance, MAX_FUTURE_DATE, MONTH_DAY_SLASH_DATE_STRING_FORMAT, ModelRecurrenceInfoUtility, NextIterResult, RRULE_STRING_SPLITTER, RRuleStringSplitter, SYSTEM_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, UNKNOWN_YEAR_WEEK_CODE, UTC_DATE_TIMEZONE_UTC_NORMAL_INSTANCE, allIndexesInDateCellRange, allIndexesInDateCellRanges, allIndexesInDateCellRangesToArray, allKnownTimezoneStrings, allTimezoneInfos, allTimezoneStrings, baseDateToTargetDate, calculateAllConversions, calculateExpectedDateCellTimingDuration, calculateExpectedDateCellTimingDurationPair, calculateTimezoneOffset, calendarDate, calendarDateFactory, calendarDateForDateDurationSpan, calendarDateType, changeDateCellScheduleDateRangeToTimezone, changeDateCellScheduleDateRangeToTimezoneFunction, clampDateFunction, clampDateRangeFunction, clampDateRangeToDateRange, clampDateToDateRange, copyDateCellScheduleDateFilterConfig, copyHoursAndMinutesFromDateWithTimezoneNormal, copyHoursAndMinutesFromNowWithTimezoneNormal, copyHoursAndMinutesFromUTCDate, copyHoursAndMinutesToDate, copyHoursAndMinutesToToday, dateCell, dateCellDayOfWeekFactory, dateCellDayTimingInfoFactory, dateCellDurationSpanHasEndedFilterFunction, dateCellDurationSpanHasNotEndedFilterFunction, dateCellDurationSpanHasNotStartedFilterFunction, dateCellDurationSpanHasStartedFilterFunction, dateCellEndIndex, dateCellIndexRange, dateCellIndexRangeToDateCellRange, dateCellIndexYearWeekCodeFactory, dateCellIndexYearWeekCodeGroupFactory, dateCellIndexsForDateCellScheduleDayCodes, dateCellRange, dateCellRangeBlocksCount, dateCellRangeBlocksCountInfo, dateCellRangeHasRange, dateCellRangeIncludedByRangeFunction, dateCellRangeOfTiming, dateCellRangeOfTimingFactory, dateCellRangeOverlapsRange, dateCellRangeOverlapsRangeFunction, dateCellRangeToDateCellIndexRange, dateCellRangeType, dateCellRangeWithRange, dateCellRangeWithRangeFromIndex, dateCellRangesFullyCoverDateCellRangeFunction, dateCellScheduleDateCellTimingFilter, dateCellScheduleDateFilter, dateCellScheduleDateRange, dateCellScheduleDayCodeFactory, dateCellScheduleDayCodesAreSetsEquivalent, dateCellScheduleDayCodesFromEnabledDays, dateCellScheduleDayCodesSetFromDaysOfWeek, dateCellScheduleEncodedWeek, dateCellScheduleType, dateCellTiming, dateCellTimingCompletedTimeRange, dateCellTimingDateFactory, dateCellTimingDateRange, dateCellTimingEndDateFactory, dateCellTimingEndIndex, dateCellTimingEventRange, dateCellTimingExpansionFactory, dateCellTimingFinalStartsAtEvent, dateCellTimingFromDateCellTimingStartsAtEndRange, dateCellTimingLatestCompletedIndex, dateCellTimingRelativeIndexArrayFactory, dateCellTimingRelativeIndexFactory, dateCellTimingStart, dateCellTimingStartDateFactory, dateCellTimingStartPair, dateCellTimingStartsAtDateFactory, dateCellTimingStartsAtForStartOfDay, dateCellTimingTimezoneNormalInstance, dateCellTimingType, dateCellType, dateDurationSpanEndDate, dateDurationSpanType, dateFromLogicalDate, dateInterval, dateMonthDayStringFormat, dateOrDateRangeToDateRange, dateOrDayStringRangeToDateRange, dateOrDayStringRangeToISO8601DayStringRange, dateRange, dateRangeDaysCount, dateRangeFromStartAndEndOfDay, dateRangeOverlapsDateRange, dateRangeOverlapsDateRangeFunction, dateRangeParamsType, dateRangeRelativeState, dateRangeType, dateRelativeStateForDateCellRangeComparedToIndex, dateShortDateAndTimeStringFormat, dateTimeInstance, dateTimeInstanceUtc, dateTimeMinuteDecisionFunction, dateTimeMinuteWholeDayDecisionFunction, dateTimeStringFormat, dateTimezoneUtcNormal, daysToMinutes, durationSpanDateRelativeState, durationSpanFromDateRange, durationSpanToDateRange, earliestDate, enabledDaysFromDateCellScheduleDayCodes, endItreateDaysInDateRangeEarly, expandDateCellCollection, expandDateCellRange, expandDateCellSchedule, expandDateCellScheduleDayCodes, expandDateCellScheduleDayCodesToDayCodesSet, expandDateCellScheduleDayCodesToDayOfWeekSet, expandDateCellScheduleFactory, expandDateCellScheduleRange, expandDateCellScheduleRangeToDateCellRanges, expandDateCellTiming, expandDaysForDateRange, expandDaysForDateRangeFunction, expandUniqueDateCellsFunction, filterDateCellsInDateCellRange, findMaxDate, findMinDate, findNextDateInDateCellScheduleFilter, fitDateRangeToDayPeriod, fitDateRangeToDayPeriodFunction, fitUTCDateRangeToDayPeriod, forEachDayInDateRange, formatDateDistance, formatDateRange, formatDateRangeDistance, formatDateRangeDistanceFunction, formatDateRangeFunction, formatStartedEndedDistanceString, formatToDateString, formatToDayRangeString, formatToDayTimeRangeString, formatToISO8601DateString, formatToISO8601DayStringForSystem, formatToISO8601DayStringForUTC, formatToMonthDaySlashDate, formatToMonthDayString, formatToShortDateAndTimeString, formatToShortDateString, formatToTimeAndDurationString, formatToTimeRangeString, formatToTimeString, fractionalHoursInDurationSpan, fullDateCellScheduleRange, fullDateCellTiming, fullDateCellTimingTimezonePair, fullWeekDateCellScheduleDayCodes, getCurrentSystemOffsetInHours, getCurrentSystemOffsetInMinutes, getCurrentSystemOffsetInMs, getDateCellTimingFirstEventDateRange, getDateCellTimingHoursInEvent, getDaysOfWeekInDateRange, getGreatestDateCellIndexInDateCellRanges, getLeastAndGreatestDateCellIndexInDateCellRanges, getLeastDateCellIndexInDateCellRanges, getNextDateCellTimingIndex, getRelativeDateForDateCellTiming, getRelativeIndexForDateCellTiming, getTimeAM, getTimezoneAbbreviation, getTimezoneLongName, groupDateRangesByDateRelativeState, groupToDateCellRanges, groupUniqueDateCells, guessCurrentTimezone, hoursToMs, inverseDateTimezoneUtcNormalInstanceTransformType, isAfter, isBefore, isDate, isDateCellRange, isDateCellSchedule, isDateCellScheduleDateRange, isDateCellScheduleEncodedWeek, isDateCellScheduleStartOfDayDateRange, isDateCellTiming, isDateCellTimingRelativeIndexFactory, isDateCellWithinDateCellRange, isDateCellWithinDateCellRangeFunction, isDateInDateRange, isDateInDateRangeFunction, isDateRange, isDateRangeInDateRange, isDateRangeInDateRangeFunction, isDateRangeStart, isDateWithinDateCellRangeFunction, isEmptyDateCellScheduleEncodedWeek, isEndOfDayInUTC, isFullDateCellScheduleDateRange, isFullDateCellTiming, isFullDateRange, isInfiniteDateRange, isKnownTimezone, isLogicalDateStringCode, isMaxFutureDate, isPartialDateRange, isSameDate, isSameDateCellSchedule, isSameDateCellScheduleDateRange, isSameDateCellScheduleEventRange, isSameDateCellTiming, isSameDateCellTimingEventStartsAtEndRange, isSameDateDay, isSameDateDayRange, isSameDateHoursAndMinutes, isSameDateRange, isSameDateTimezoneConversionConfig, isSameDurationSpan, isSameFullDateCellScheduleDateRange, isSameFullDateCellTiming, isStartOfDayForSystem, isStartOfDayInUTC, isValidDateCellIndex, isValidDateCellRange, isValidDateCellRangeSeries, isValidDateCellTiming, isValidDateCellTimingInfo, isValidDateCellTimingStartDate, isValidDateFromTimestringResult, isValidDateTimezoneConversionConfig, isValidFullDateCellTiming, isValidFullDateCellTimingInfo, iterateDaysInDateRange, iterateDaysInDateRangeFunction, knownTimezoneType, latestDate, latestMinute, limitDateTime, limitDateTimeInstance, logicalDateStringCodeDateFactory, makeDateQueryForDateItemRangeFilter, makeDateQueryForDateStartsEndsFilter, makeDateQueryForOccuringFilter, makeDaysAndTimeFiltersFunction, makeMongoDBLikeDateQueryBuilder, maxFutureDate, mergeMongoDBLikeRangeFilters, minutesToMs, modelRecurrenceInfoType, modifyDateCellToFitRange, modifyDateCellsToFitRange, modifyDateCellsToFitRangeFunction, monthDaySlashDateStringFormat, msToMinutes, msToSeconds, nowInterval, parseISO8601DayStringToDate, parseJsDateString, parseReadableTimeString, rawDateCellScheduleDayCodes, readDaysOfWeek, readDaysOfWeekNames, readableTimeStringToDate, reduceDatesFunction, requireCurrentTimezone, roundDateDownTo, roundDateTimeDown, roundDateTimeDownToSteps, roundDateTo, roundDateToDate, roundDateToUnixDateTimeNumber, roundDownToHour, roundDownToMinute, roundToMinuteSteps, safeFormatToISO8601DateString, safeToJsDate, searchTimezoneInfos, setOnDateWithTimezoneNormalFunction, shiftDateCellTimingToSystemTimezone, shiftDateCellTimingToTimezone, shiftDateCellTimingToTimezoneFunction, shiftDateCellTimingToUTCTimezone, simplifyDateCellScheduleDayCodes, sortByDateFunction, sortByISO8601DateStringFunction, sortByISO8601DateStrings, sortDateCellRangeAndSizeFunction, sortDateCellRanges, sortDateRangeStartAscendingCompareFunction, startOfDayInTimezoneDayStringFactory, startOfDayInTimezoneFromISO8601DayString, startOfWeekForYearWeekCode, systemBaseDateToNormalDate, systemBaseDateToNormalDateOffset, systemDateTimezoneUtcNormal, systemExperiencesDaylightSavings, systemNormalDateToBaseDate, systemNormalDateToBaseDateOffset, targetDateToBaseDate, timezoneInfoForSystem, timezoneStringToSearchableString, timezoneStringToTimezoneInfo, toISO8601DayStringForSystem, toISO8601DayStringForUTC, toISODateString, toJsDate, toJsDayDate, toLocalReadableTimeString, toReadableTimeString, transformDateInTimezoneNormalFunction, transformDateRangeDatesFunction, transformDateRangeInTimezoneNormalFunction, transformDateRangeToTimezoneFunction, transformDateRangeWithStartOfDay, updateDateCellTimingToSystemTimezone, updateDateCellTimingToTimezone, updateDateCellTimingToTimezoneFunction, updateDateCellTimingToUTCTimezone, updateDateCellTimingWithDateCellTimingEvent, utcDayForDate, validDateCellRangeSeriesType, validDateCellRangeType, validDateCellTimingType, weekdayDateCellScheduleDayCodes, weekendDateCellScheduleDayCodes, yearWeekCode, yearWeekCodeDateFactory, yearWeekCodeDateTimezoneInstance, yearWeekCodeFactory, yearWeekCodeForCalendarMonth, yearWeekCodeForCalendarMonthFactory, yearWeekCodeForDateRange, yearWeekCodeForDateRangeFactory, yearWeekCodeForDateRangeInTimezone, yearWeekCodeFromDate, yearWeekCodeFromPair, yearWeekCodeGroupFactory, yearWeekCodeIndex, yearWeekCodePair, yearWeekCodePairFromDate };
|