@dereekb/date 13.6.11 → 13.6.13
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 +509 -72
- package/index.esm.js +503 -75
- package/package.json +5 -5
- package/src/lib/date/date.duration.data.d.ts +140 -0
- package/src/lib/date/date.model.d.ts +8 -8
- package/src/lib/date/index.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -17,7 +17,7 @@ function _array_like_to_array$7(arr, len) {
|
|
|
17
17
|
function _array_without_holes$4(arr) {
|
|
18
18
|
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
19
19
|
}
|
|
20
|
-
function _define_property$
|
|
20
|
+
function _define_property$i(obj, key, value) {
|
|
21
21
|
if (key in obj) {
|
|
22
22
|
Object.defineProperty(obj, key, {
|
|
23
23
|
value: value,
|
|
@@ -36,7 +36,7 @@ function _iterable_to_array$4(iter) {
|
|
|
36
36
|
function _non_iterable_spread$4() {
|
|
37
37
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
38
38
|
}
|
|
39
|
-
function _object_spread$
|
|
39
|
+
function _object_spread$f(target) {
|
|
40
40
|
for(var i = 1; i < arguments.length; i++){
|
|
41
41
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
42
42
|
var ownKeys = Object.keys(source);
|
|
@@ -46,7 +46,7 @@ function _object_spread$e(target) {
|
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
48
|
ownKeys.forEach(function(key) {
|
|
49
|
-
_define_property$
|
|
49
|
+
_define_property$i(target, key, source[key]);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
return target;
|
|
@@ -388,7 +388,7 @@ function isSameDateDay(a, b) {
|
|
|
388
388
|
* ```
|
|
389
389
|
*/ function copyHoursAndMinutesToDate(param, target) {
|
|
390
390
|
var hours = param.hours, minutes = param.minutes, removeSeconds = param.removeSeconds, _param_roundDownToMinute = param.roundDownToMinute, roundDownToMinute = _param_roundDownToMinute === void 0 ? true : _param_roundDownToMinute;
|
|
391
|
-
return dateFns.set(target !== null && target !== void 0 ? target : new Date(), _object_spread$
|
|
391
|
+
return dateFns.set(target !== null && target !== void 0 ? target : new Date(), _object_spread$f({
|
|
392
392
|
hours: hours
|
|
393
393
|
}, minutes != null ? {
|
|
394
394
|
minutes: minutes
|
|
@@ -745,7 +745,7 @@ function _construct(Parent, args, Class) {
|
|
|
745
745
|
}
|
|
746
746
|
return _construct.apply(null, arguments);
|
|
747
747
|
}
|
|
748
|
-
function _define_property$
|
|
748
|
+
function _define_property$h(obj, key, value) {
|
|
749
749
|
if (key in obj) {
|
|
750
750
|
Object.defineProperty(obj, key, {
|
|
751
751
|
value: value,
|
|
@@ -787,7 +787,7 @@ function _instanceof$2(left, right) {
|
|
|
787
787
|
function _is_native_function(fn) {
|
|
788
788
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
789
789
|
}
|
|
790
|
-
function _object_spread$
|
|
790
|
+
function _object_spread$e(target) {
|
|
791
791
|
for(var i = 1; i < arguments.length; i++){
|
|
792
792
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
793
793
|
var ownKeys = Object.keys(source);
|
|
@@ -797,12 +797,12 @@ function _object_spread$d(target) {
|
|
|
797
797
|
}));
|
|
798
798
|
}
|
|
799
799
|
ownKeys.forEach(function(key) {
|
|
800
|
-
_define_property$
|
|
800
|
+
_define_property$h(target, key, source[key]);
|
|
801
801
|
});
|
|
802
802
|
}
|
|
803
803
|
return target;
|
|
804
804
|
}
|
|
805
|
-
function ownKeys$
|
|
805
|
+
function ownKeys$b(object, enumerableOnly) {
|
|
806
806
|
var keys = Object.keys(object);
|
|
807
807
|
if (Object.getOwnPropertySymbols) {
|
|
808
808
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -810,12 +810,12 @@ function ownKeys$a(object, enumerableOnly) {
|
|
|
810
810
|
}
|
|
811
811
|
return keys;
|
|
812
812
|
}
|
|
813
|
-
function _object_spread_props$
|
|
813
|
+
function _object_spread_props$b(target, source) {
|
|
814
814
|
source = source != null ? source : {};
|
|
815
815
|
if (Object.getOwnPropertyDescriptors) {
|
|
816
816
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
817
817
|
} else {
|
|
818
|
-
ownKeys$
|
|
818
|
+
ownKeys$b(Object(source)).forEach(function(key) {
|
|
819
819
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
820
820
|
});
|
|
821
821
|
}
|
|
@@ -1614,7 +1614,7 @@ var DEFAULT_EXPAND_DAYS_FOR_DATE_RANGE_MAX_EXPANSION_SIZE = 1500;
|
|
|
1614
1614
|
newDistance = util.MS_IN_DAY;
|
|
1615
1615
|
}
|
|
1616
1616
|
var end = dateFns.addMilliseconds(dateRange.start, newDistance);
|
|
1617
|
-
return _object_spread_props$
|
|
1617
|
+
return _object_spread_props$b(_object_spread$e({}, dateRange), {
|
|
1618
1618
|
start: dateRange.start,
|
|
1619
1619
|
end: end
|
|
1620
1620
|
});
|
|
@@ -1886,7 +1886,7 @@ function _create_class$7(Constructor, protoProps, staticProps) {
|
|
|
1886
1886
|
if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
|
|
1887
1887
|
return Constructor;
|
|
1888
1888
|
}
|
|
1889
|
-
function _define_property$
|
|
1889
|
+
function _define_property$g(obj, key, value) {
|
|
1890
1890
|
if (key in obj) {
|
|
1891
1891
|
Object.defineProperty(obj, key, {
|
|
1892
1892
|
value: value,
|
|
@@ -2145,10 +2145,10 @@ function _type_of$6(obj) {
|
|
|
2145
2145
|
var systemOffset = getCurrentSystemOffsetInMs(date);
|
|
2146
2146
|
return -normalOffset + systemOffset;
|
|
2147
2147
|
};
|
|
2148
|
-
_define_property$
|
|
2149
|
-
_define_property$
|
|
2150
|
-
_define_property$
|
|
2151
|
-
_define_property$
|
|
2148
|
+
_define_property$g(this, "config", void 0);
|
|
2149
|
+
_define_property$g(this, "hasConversion", void 0);
|
|
2150
|
+
_define_property$g(this, "_getOffset", void 0);
|
|
2151
|
+
_define_property$g(this, "_setOnDate", util.cachedGetter(function() {
|
|
2152
2152
|
return setOnDateWithTimezoneNormalFunction(_this);
|
|
2153
2153
|
}));
|
|
2154
2154
|
var getOffsetInMsFn;
|
|
@@ -2905,7 +2905,7 @@ function _type_of$6(obj) {
|
|
|
2905
2905
|
});
|
|
2906
2906
|
}
|
|
2907
2907
|
|
|
2908
|
-
function _define_property$
|
|
2908
|
+
function _define_property$f(obj, key, value) {
|
|
2909
2909
|
if (key in obj) {
|
|
2910
2910
|
Object.defineProperty(obj, key, {
|
|
2911
2911
|
value: value,
|
|
@@ -2918,7 +2918,7 @@ function _define_property$e(obj, key, value) {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
return obj;
|
|
2920
2920
|
}
|
|
2921
|
-
function _object_spread$
|
|
2921
|
+
function _object_spread$d(target) {
|
|
2922
2922
|
for(var i = 1; i < arguments.length; i++){
|
|
2923
2923
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2924
2924
|
var ownKeys = Object.keys(source);
|
|
@@ -2928,7 +2928,7 @@ function _object_spread$c(target) {
|
|
|
2928
2928
|
}));
|
|
2929
2929
|
}
|
|
2930
2930
|
ownKeys.forEach(function(key) {
|
|
2931
|
-
_define_property$
|
|
2931
|
+
_define_property$f(target, key, source[key]);
|
|
2932
2932
|
});
|
|
2933
2933
|
}
|
|
2934
2934
|
return target;
|
|
@@ -2951,7 +2951,7 @@ function _object_spread$c(target) {
|
|
|
2951
2951
|
*/ function fitDateRangeToDayPeriodFunction(timezone) {
|
|
2952
2952
|
var transformFn = transformDateRangeInTimezoneNormalFunction(timezone, 'baseDateToTargetDate');
|
|
2953
2953
|
var fn = function fn(input) {
|
|
2954
|
-
return _object_spread$
|
|
2954
|
+
return _object_spread$d({}, input, transformFn(input, fitUTCDateRangeToDayPeriod));
|
|
2955
2955
|
};
|
|
2956
2956
|
fn._timezoneInstance = transformFn._timezoneInstance;
|
|
2957
2957
|
return fn;
|
|
@@ -3501,7 +3501,7 @@ var dateShortDateAndTimeStringFormat = DATE_SHORT_DATE_AND_TIME_STRING_FORMAT;
|
|
|
3501
3501
|
return dateFns.startOfDay(result);
|
|
3502
3502
|
}
|
|
3503
3503
|
|
|
3504
|
-
function _define_property$
|
|
3504
|
+
function _define_property$e(obj, key, value) {
|
|
3505
3505
|
if (key in obj) {
|
|
3506
3506
|
Object.defineProperty(obj, key, {
|
|
3507
3507
|
value: value,
|
|
@@ -3514,7 +3514,7 @@ function _define_property$d(obj, key, value) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
return obj;
|
|
3516
3516
|
}
|
|
3517
|
-
function _object_spread$
|
|
3517
|
+
function _object_spread$c(target) {
|
|
3518
3518
|
for(var i = 1; i < arguments.length; i++){
|
|
3519
3519
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
3520
3520
|
var ownKeys = Object.keys(source);
|
|
@@ -3524,12 +3524,12 @@ function _object_spread$b(target) {
|
|
|
3524
3524
|
}));
|
|
3525
3525
|
}
|
|
3526
3526
|
ownKeys.forEach(function(key) {
|
|
3527
|
-
_define_property$
|
|
3527
|
+
_define_property$e(target, key, source[key]);
|
|
3528
3528
|
});
|
|
3529
3529
|
}
|
|
3530
3530
|
return target;
|
|
3531
3531
|
}
|
|
3532
|
-
function ownKeys$
|
|
3532
|
+
function ownKeys$a(object, enumerableOnly) {
|
|
3533
3533
|
var keys = Object.keys(object);
|
|
3534
3534
|
if (Object.getOwnPropertySymbols) {
|
|
3535
3535
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -3537,12 +3537,12 @@ function ownKeys$9(object, enumerableOnly) {
|
|
|
3537
3537
|
}
|
|
3538
3538
|
return keys;
|
|
3539
3539
|
}
|
|
3540
|
-
function _object_spread_props$
|
|
3540
|
+
function _object_spread_props$a(target, source) {
|
|
3541
3541
|
source = source != null ? source : {};
|
|
3542
3542
|
if (Object.getOwnPropertyDescriptors) {
|
|
3543
3543
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
3544
3544
|
} else {
|
|
3545
|
-
ownKeys$
|
|
3545
|
+
ownKeys$a(Object(source)).forEach(function(key) {
|
|
3546
3546
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3547
3547
|
});
|
|
3548
3548
|
}
|
|
@@ -3918,7 +3918,7 @@ function _type_of$5(obj) {
|
|
|
3918
3918
|
*/ function updateDateCellTimingToTimezoneFunction(timezone) {
|
|
3919
3919
|
var fn = function fn(timing) {
|
|
3920
3920
|
var startsAt = timing.startsAt;
|
|
3921
|
-
var newTiming = _object_spread_props$
|
|
3921
|
+
var newTiming = _object_spread_props$a(_object_spread$c({}, timing), {
|
|
3922
3922
|
start: dateCellTimingStart({
|
|
3923
3923
|
startsAt: startsAt,
|
|
3924
3924
|
timezone: timezone
|
|
@@ -3974,7 +3974,7 @@ function _type_of$5(obj) {
|
|
|
3974
3974
|
var endNormal = inputTimingNormalInstance.baseDateToTargetDate(timing.end);
|
|
3975
3975
|
var startsAt = normalInstance.targetDateToBaseDate(startsAtNormal);
|
|
3976
3976
|
var end = normalInstance.targetDateToBaseDate(endNormal);
|
|
3977
|
-
var newTiming = _object_spread_props$
|
|
3977
|
+
var newTiming = _object_spread_props$a(_object_spread$c({}, timing), {
|
|
3978
3978
|
start: dateCellTimingStart({
|
|
3979
3979
|
startsAt: startsAt,
|
|
3980
3980
|
timezone: timezone
|
|
@@ -4196,7 +4196,7 @@ function _array_like_to_array$6(arr, len) {
|
|
|
4196
4196
|
function _array_without_holes$3(arr) {
|
|
4197
4197
|
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
4198
4198
|
}
|
|
4199
|
-
function _define_property$
|
|
4199
|
+
function _define_property$d(obj, key, value) {
|
|
4200
4200
|
if (key in obj) {
|
|
4201
4201
|
Object.defineProperty(obj, key, {
|
|
4202
4202
|
value: value,
|
|
@@ -4215,7 +4215,7 @@ function _iterable_to_array$3(iter) {
|
|
|
4215
4215
|
function _non_iterable_spread$3() {
|
|
4216
4216
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4217
4217
|
}
|
|
4218
|
-
function _object_spread$
|
|
4218
|
+
function _object_spread$b(target) {
|
|
4219
4219
|
for(var i = 1; i < arguments.length; i++){
|
|
4220
4220
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4221
4221
|
var ownKeys = Object.keys(source);
|
|
@@ -4225,12 +4225,12 @@ function _object_spread$a(target) {
|
|
|
4225
4225
|
}));
|
|
4226
4226
|
}
|
|
4227
4227
|
ownKeys.forEach(function(key) {
|
|
4228
|
-
_define_property$
|
|
4228
|
+
_define_property$d(target, key, source[key]);
|
|
4229
4229
|
});
|
|
4230
4230
|
}
|
|
4231
4231
|
return target;
|
|
4232
4232
|
}
|
|
4233
|
-
function ownKeys$
|
|
4233
|
+
function ownKeys$9(object, enumerableOnly) {
|
|
4234
4234
|
var keys = Object.keys(object);
|
|
4235
4235
|
if (Object.getOwnPropertySymbols) {
|
|
4236
4236
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -4238,12 +4238,12 @@ function ownKeys$8(object, enumerableOnly) {
|
|
|
4238
4238
|
}
|
|
4239
4239
|
return keys;
|
|
4240
4240
|
}
|
|
4241
|
-
function _object_spread_props$
|
|
4241
|
+
function _object_spread_props$9(target, source) {
|
|
4242
4242
|
source = source != null ? source : {};
|
|
4243
4243
|
if (Object.getOwnPropertyDescriptors) {
|
|
4244
4244
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4245
4245
|
} else {
|
|
4246
|
-
ownKeys$
|
|
4246
|
+
ownKeys$9(Object(source)).forEach(function(key) {
|
|
4247
4247
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4248
4248
|
});
|
|
4249
4249
|
}
|
|
@@ -4775,7 +4775,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4775
4775
|
* ```
|
|
4776
4776
|
*/ function expandDateCellRange(block) {
|
|
4777
4777
|
return util.range(block.i, dateCellEndIndex(block) + 1).map(function(i) {
|
|
4778
|
-
return _object_spread_props$
|
|
4778
|
+
return _object_spread_props$9(_object_spread$b({}, block), {
|
|
4779
4779
|
i: i,
|
|
4780
4780
|
to: i
|
|
4781
4781
|
}); // copy block, set to as i
|
|
@@ -4862,7 +4862,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4862
4862
|
var to = Math.min(inputTo, maxAllowedIndex) || 0;
|
|
4863
4863
|
var block = null;
|
|
4864
4864
|
if (inputBlock != null) {
|
|
4865
|
-
block = _object_spread_props$
|
|
4865
|
+
block = _object_spread_props$9(_object_spread$b({}, inputBlock), {
|
|
4866
4866
|
i: i,
|
|
4867
4867
|
to: to
|
|
4868
4868
|
});
|
|
@@ -4996,7 +4996,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4996
4996
|
// add current
|
|
4997
4997
|
addBlockWithRange(current.block, currentNextIndex, currentEndIndex);
|
|
4998
4998
|
// change next to start at the next range
|
|
4999
|
-
continueToNext(_object_spread_props$
|
|
4999
|
+
continueToNext(_object_spread_props$9(_object_spread$b({}, next.block), {
|
|
5000
5000
|
i: currentEndIndex + 1,
|
|
5001
5001
|
to: nextEndIndex
|
|
5002
5002
|
}), next.priority);
|
|
@@ -5016,7 +5016,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
5016
5016
|
// add the next item first since it overwrites the current
|
|
5017
5017
|
addBlockWithRange(next.block, nextStartIndex, nextEndIndex);
|
|
5018
5018
|
// continue with the current item as next.
|
|
5019
|
-
continueToNext(_object_spread_props$
|
|
5019
|
+
continueToNext(_object_spread_props$9(_object_spread$b({}, current.block), {
|
|
5020
5020
|
i: nextEndIndex + 1,
|
|
5021
5021
|
to: currentEndIndex
|
|
5022
5022
|
}), current.priority);
|
|
@@ -5031,7 +5031,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
5031
5031
|
addBlockWithRange(current.block, currentNextIndex, currentEndIndex);
|
|
5032
5032
|
if (nextEndIndex > currentEndIndex) {
|
|
5033
5033
|
// change next to start at the next range
|
|
5034
|
-
continueToNext(_object_spread_props$
|
|
5034
|
+
continueToNext(_object_spread_props$9(_object_spread$b({}, next.block), {
|
|
5035
5035
|
i: currentEndIndex + 1,
|
|
5036
5036
|
to: nextEndIndex
|
|
5037
5037
|
}), next.priority);
|
|
@@ -5047,7 +5047,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
5047
5047
|
// add the next
|
|
5048
5048
|
addBlockWithRange(next.block, nextStartIndex, nextEndIndex);
|
|
5049
5049
|
// continue with the current
|
|
5050
|
-
continueToNext(_object_spread_props$
|
|
5050
|
+
continueToNext(_object_spread_props$9(_object_spread$b({}, current.block), {
|
|
5051
5051
|
i: nextEndIndex + 1,
|
|
5052
5052
|
to: currentEndIndex
|
|
5053
5053
|
}), next.priority);
|
|
@@ -5087,7 +5087,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
5087
5087
|
};
|
|
5088
5088
|
}
|
|
5089
5089
|
|
|
5090
|
-
function _define_property$
|
|
5090
|
+
function _define_property$c(obj, key, value) {
|
|
5091
5091
|
if (key in obj) {
|
|
5092
5092
|
Object.defineProperty(obj, key, {
|
|
5093
5093
|
value: value,
|
|
@@ -5100,7 +5100,7 @@ function _define_property$b(obj, key, value) {
|
|
|
5100
5100
|
}
|
|
5101
5101
|
return obj;
|
|
5102
5102
|
}
|
|
5103
|
-
function _object_spread$
|
|
5103
|
+
function _object_spread$a(target) {
|
|
5104
5104
|
for(var i = 1; i < arguments.length; i++){
|
|
5105
5105
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
5106
5106
|
var ownKeys = Object.keys(source);
|
|
@@ -5110,12 +5110,12 @@ function _object_spread$9(target) {
|
|
|
5110
5110
|
}));
|
|
5111
5111
|
}
|
|
5112
5112
|
ownKeys.forEach(function(key) {
|
|
5113
|
-
_define_property$
|
|
5113
|
+
_define_property$c(target, key, source[key]);
|
|
5114
5114
|
});
|
|
5115
5115
|
}
|
|
5116
5116
|
return target;
|
|
5117
5117
|
}
|
|
5118
|
-
function ownKeys$
|
|
5118
|
+
function ownKeys$8(object, enumerableOnly) {
|
|
5119
5119
|
var keys = Object.keys(object);
|
|
5120
5120
|
if (Object.getOwnPropertySymbols) {
|
|
5121
5121
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -5123,12 +5123,12 @@ function ownKeys$7(object, enumerableOnly) {
|
|
|
5123
5123
|
}
|
|
5124
5124
|
return keys;
|
|
5125
5125
|
}
|
|
5126
|
-
function _object_spread_props$
|
|
5126
|
+
function _object_spread_props$8(target, source) {
|
|
5127
5127
|
source = source != null ? source : {};
|
|
5128
5128
|
if (Object.getOwnPropertyDescriptors) {
|
|
5129
5129
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
5130
5130
|
} else {
|
|
5131
|
-
ownKeys$
|
|
5131
|
+
ownKeys$8(Object(source)).forEach(function(key) {
|
|
5132
5132
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5133
5133
|
});
|
|
5134
5134
|
}
|
|
@@ -5393,7 +5393,7 @@ function _type_of$3(obj) {
|
|
|
5393
5393
|
blocksEvaluated += 1;
|
|
5394
5394
|
if (filter(block, blockIndex)) {
|
|
5395
5395
|
var startsAt = startsAtFactory(block.i);
|
|
5396
|
-
var durationSpan = _object_spread_props$
|
|
5396
|
+
var durationSpan = _object_spread_props$8(_object_spread$a({}, block), {
|
|
5397
5397
|
startsAt: startsAt,
|
|
5398
5398
|
duration: duration
|
|
5399
5399
|
});
|
|
@@ -5414,7 +5414,7 @@ function _type_of$3(obj) {
|
|
|
5414
5414
|
if (dateCellRangeHasRange(block)) {
|
|
5415
5415
|
// Expands the block's range as if it is at a single index
|
|
5416
5416
|
util.range(block.i, block.to + 1).findIndex(function(i) {
|
|
5417
|
-
var blockAtIndex = _object_spread_props$
|
|
5417
|
+
var blockAtIndex = _object_spread_props$8(_object_spread$a({}, block), {
|
|
5418
5418
|
i: i,
|
|
5419
5419
|
to: i
|
|
5420
5420
|
}); // copy block, set to as i
|
|
@@ -5994,7 +5994,7 @@ function isSameDurationSpan(a, b) {
|
|
|
5994
5994
|
});
|
|
5995
5995
|
}
|
|
5996
5996
|
|
|
5997
|
-
function _define_property$
|
|
5997
|
+
function _define_property$b(obj, key, value) {
|
|
5998
5998
|
if (key in obj) {
|
|
5999
5999
|
Object.defineProperty(obj, key, {
|
|
6000
6000
|
value: value,
|
|
@@ -6007,7 +6007,7 @@ function _define_property$a(obj, key, value) {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
return obj;
|
|
6009
6009
|
}
|
|
6010
|
-
function _object_spread$
|
|
6010
|
+
function _object_spread$9(target) {
|
|
6011
6011
|
for(var i = 1; i < arguments.length; i++){
|
|
6012
6012
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
6013
6013
|
var ownKeys = Object.keys(source);
|
|
@@ -6017,12 +6017,12 @@ function _object_spread$8(target) {
|
|
|
6017
6017
|
}));
|
|
6018
6018
|
}
|
|
6019
6019
|
ownKeys.forEach(function(key) {
|
|
6020
|
-
_define_property$
|
|
6020
|
+
_define_property$b(target, key, source[key]);
|
|
6021
6021
|
});
|
|
6022
6022
|
}
|
|
6023
6023
|
return target;
|
|
6024
6024
|
}
|
|
6025
|
-
function ownKeys$
|
|
6025
|
+
function ownKeys$7(object, enumerableOnly) {
|
|
6026
6026
|
var keys = Object.keys(object);
|
|
6027
6027
|
if (Object.getOwnPropertySymbols) {
|
|
6028
6028
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -6030,12 +6030,12 @@ function ownKeys$6(object, enumerableOnly) {
|
|
|
6030
6030
|
}
|
|
6031
6031
|
return keys;
|
|
6032
6032
|
}
|
|
6033
|
-
function _object_spread_props$
|
|
6033
|
+
function _object_spread_props$7(target, source) {
|
|
6034
6034
|
source = source != null ? source : {};
|
|
6035
6035
|
if (Object.getOwnPropertyDescriptors) {
|
|
6036
6036
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
6037
6037
|
} else {
|
|
6038
|
-
ownKeys$
|
|
6038
|
+
ownKeys$7(Object(source)).forEach(function(key) {
|
|
6039
6039
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6040
6040
|
});
|
|
6041
6041
|
}
|
|
@@ -6152,7 +6152,7 @@ function _object_spread_props$6(target, source) {
|
|
|
6152
6152
|
var asRange = dateCellRangeWithRange(x);
|
|
6153
6153
|
var rangesOverlap = overlapsRange(asRange);
|
|
6154
6154
|
if (rangesOverlap) {
|
|
6155
|
-
result = _object_spread_props$
|
|
6155
|
+
result = _object_spread_props$7(_object_spread$9({}, x), {
|
|
6156
6156
|
i: Math.max(i, asRange.i),
|
|
6157
6157
|
to: Math.min(to, asRange.to) // should be no larger than to
|
|
6158
6158
|
});
|
|
@@ -6609,7 +6609,7 @@ function _array_like_to_array$4(arr, len) {
|
|
|
6609
6609
|
function _array_without_holes$2(arr) {
|
|
6610
6610
|
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
6611
6611
|
}
|
|
6612
|
-
function _define_property$
|
|
6612
|
+
function _define_property$a(obj, key, value) {
|
|
6613
6613
|
if (key in obj) {
|
|
6614
6614
|
Object.defineProperty(obj, key, {
|
|
6615
6615
|
value: value,
|
|
@@ -6628,7 +6628,7 @@ function _iterable_to_array$2(iter) {
|
|
|
6628
6628
|
function _non_iterable_spread$2() {
|
|
6629
6629
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6630
6630
|
}
|
|
6631
|
-
function _object_spread$
|
|
6631
|
+
function _object_spread$8(target) {
|
|
6632
6632
|
for(var i = 1; i < arguments.length; i++){
|
|
6633
6633
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
6634
6634
|
var ownKeys = Object.keys(source);
|
|
@@ -6638,12 +6638,12 @@ function _object_spread$7(target) {
|
|
|
6638
6638
|
}));
|
|
6639
6639
|
}
|
|
6640
6640
|
ownKeys.forEach(function(key) {
|
|
6641
|
-
_define_property$
|
|
6641
|
+
_define_property$a(target, key, source[key]);
|
|
6642
6642
|
});
|
|
6643
6643
|
}
|
|
6644
6644
|
return target;
|
|
6645
6645
|
}
|
|
6646
|
-
function ownKeys$
|
|
6646
|
+
function ownKeys$6(object, enumerableOnly) {
|
|
6647
6647
|
var keys = Object.keys(object);
|
|
6648
6648
|
if (Object.getOwnPropertySymbols) {
|
|
6649
6649
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -6651,12 +6651,12 @@ function ownKeys$5(object, enumerableOnly) {
|
|
|
6651
6651
|
}
|
|
6652
6652
|
return keys;
|
|
6653
6653
|
}
|
|
6654
|
-
function _object_spread_props$
|
|
6654
|
+
function _object_spread_props$6(target, source) {
|
|
6655
6655
|
source = source != null ? source : {};
|
|
6656
6656
|
if (Object.getOwnPropertyDescriptors) {
|
|
6657
6657
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
6658
6658
|
} else {
|
|
6659
|
-
ownKeys$
|
|
6659
|
+
ownKeys$6(Object(source)).forEach(function(key) {
|
|
6660
6660
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6661
6661
|
});
|
|
6662
6662
|
}
|
|
@@ -7451,7 +7451,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7451
7451
|
startsAtTime: startsAtTime,
|
|
7452
7452
|
updateWithDefaults: true
|
|
7453
7453
|
});
|
|
7454
|
-
return expandDateCellSchedule(_object_spread_props$
|
|
7454
|
+
return expandDateCellSchedule(_object_spread_props$6(_object_spread$8({}, input), {
|
|
7455
7455
|
schedule: fullDateRange,
|
|
7456
7456
|
timing: fullDateRange
|
|
7457
7457
|
}));
|
|
@@ -7487,7 +7487,7 @@ var DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX = /^[0-9]{0,9}$/;
|
|
|
7487
7487
|
});
|
|
7488
7488
|
}
|
|
7489
7489
|
|
|
7490
|
-
function _define_property$
|
|
7490
|
+
function _define_property$9(obj, key, value) {
|
|
7491
7491
|
if (key in obj) {
|
|
7492
7492
|
Object.defineProperty(obj, key, {
|
|
7493
7493
|
value: value,
|
|
@@ -7500,7 +7500,7 @@ function _define_property$8(obj, key, value) {
|
|
|
7500
7500
|
}
|
|
7501
7501
|
return obj;
|
|
7502
7502
|
}
|
|
7503
|
-
function _object_spread$
|
|
7503
|
+
function _object_spread$7(target) {
|
|
7504
7504
|
for(var i = 1; i < arguments.length; i++){
|
|
7505
7505
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
7506
7506
|
var ownKeys = Object.keys(source);
|
|
@@ -7510,7 +7510,7 @@ function _object_spread$6(target) {
|
|
|
7510
7510
|
}));
|
|
7511
7511
|
}
|
|
7512
7512
|
ownKeys.forEach(function(key) {
|
|
7513
|
-
_define_property$
|
|
7513
|
+
_define_property$9(target, key, source[key]);
|
|
7514
7514
|
});
|
|
7515
7515
|
}
|
|
7516
7516
|
return target;
|
|
@@ -7592,11 +7592,439 @@ function _object_spread$6(target) {
|
|
|
7592
7592
|
* // event.type === CalendarDateType.TIME
|
|
7593
7593
|
* ```
|
|
7594
7594
|
*/ function calendarDateForDateDurationSpan(dateDurationSpan) {
|
|
7595
|
-
return _object_spread$
|
|
7595
|
+
return _object_spread$7({
|
|
7596
7596
|
type: exports.CalendarDateType.TIME
|
|
7597
7597
|
}, dateDurationSpan);
|
|
7598
7598
|
}
|
|
7599
7599
|
|
|
7600
|
+
function _define_property$8(obj, key, value) {
|
|
7601
|
+
if (key in obj) {
|
|
7602
|
+
Object.defineProperty(obj, key, {
|
|
7603
|
+
value: value,
|
|
7604
|
+
enumerable: true,
|
|
7605
|
+
configurable: true,
|
|
7606
|
+
writable: true
|
|
7607
|
+
});
|
|
7608
|
+
} else {
|
|
7609
|
+
obj[key] = value;
|
|
7610
|
+
}
|
|
7611
|
+
return obj;
|
|
7612
|
+
}
|
|
7613
|
+
function _object_spread$6(target) {
|
|
7614
|
+
for(var i = 1; i < arguments.length; i++){
|
|
7615
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
7616
|
+
var ownKeys = Object.keys(source);
|
|
7617
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
7618
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
7619
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
7620
|
+
}));
|
|
7621
|
+
}
|
|
7622
|
+
ownKeys.forEach(function(key) {
|
|
7623
|
+
_define_property$8(target, key, source[key]);
|
|
7624
|
+
});
|
|
7625
|
+
}
|
|
7626
|
+
return target;
|
|
7627
|
+
}
|
|
7628
|
+
function ownKeys$5(object, enumerableOnly) {
|
|
7629
|
+
var keys = Object.keys(object);
|
|
7630
|
+
if (Object.getOwnPropertySymbols) {
|
|
7631
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
7632
|
+
keys.push.apply(keys, symbols);
|
|
7633
|
+
}
|
|
7634
|
+
return keys;
|
|
7635
|
+
}
|
|
7636
|
+
function _object_spread_props$5(target, source) {
|
|
7637
|
+
source = source != null ? source : {};
|
|
7638
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
7639
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
7640
|
+
} else {
|
|
7641
|
+
ownKeys$5(Object(source)).forEach(function(key) {
|
|
7642
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
7643
|
+
});
|
|
7644
|
+
}
|
|
7645
|
+
return target;
|
|
7646
|
+
}
|
|
7647
|
+
/**
|
|
7648
|
+
* Returns true if the input TimeDurationData has no meaningful values (all zero or undefined).
|
|
7649
|
+
*
|
|
7650
|
+
* @param data - The duration data to check
|
|
7651
|
+
* @returns True if empty
|
|
7652
|
+
*
|
|
7653
|
+
* @example
|
|
7654
|
+
* ```typescript
|
|
7655
|
+
* timeDurationDataIsEmpty({}); // true
|
|
7656
|
+
* timeDurationDataIsEmpty({ hours: 0, minutes: 0 }); // true
|
|
7657
|
+
* timeDurationDataIsEmpty({ hours: 1 }); // false
|
|
7658
|
+
* ```
|
|
7659
|
+
*/ function timeDurationDataIsEmpty(data) {
|
|
7660
|
+
return !data.weeks && !data.days && !data.hours && !data.minutes && !data.seconds && !data.milliseconds;
|
|
7661
|
+
}
|
|
7662
|
+
// MARK: Conversion
|
|
7663
|
+
/**
|
|
7664
|
+
* Converts a TimeDurationData to total milliseconds by summing all fields.
|
|
7665
|
+
*
|
|
7666
|
+
* @param data - The duration data to convert
|
|
7667
|
+
* @returns Total milliseconds
|
|
7668
|
+
*
|
|
7669
|
+
* @example
|
|
7670
|
+
* ```typescript
|
|
7671
|
+
* durationDataToMilliseconds({ hours: 1, minutes: 30 }); // 5400000
|
|
7672
|
+
* durationDataToMilliseconds({ days: 1, hours: 2 }); // 93600000
|
|
7673
|
+
* ```
|
|
7674
|
+
*/ function durationDataToMilliseconds(data) {
|
|
7675
|
+
var ms = 0;
|
|
7676
|
+
if (data.weeks) ms += data.weeks * util.MS_IN_WEEK;
|
|
7677
|
+
if (data.days) ms += data.days * util.MS_IN_DAY;
|
|
7678
|
+
if (data.hours) ms += data.hours * util.MS_IN_HOUR;
|
|
7679
|
+
if (data.minutes) ms += data.minutes * util.MS_IN_MINUTE;
|
|
7680
|
+
if (data.seconds) ms += data.seconds * util.MS_IN_SECOND;
|
|
7681
|
+
if (data.milliseconds) ms += data.milliseconds;
|
|
7682
|
+
return ms;
|
|
7683
|
+
}
|
|
7684
|
+
/**
|
|
7685
|
+
* Maps a TimeUnit to the corresponding field name in TimeDurationData.
|
|
7686
|
+
*/ var TIME_UNIT_TO_FIELD_MAP = {
|
|
7687
|
+
w: 'weeks',
|
|
7688
|
+
d: 'days',
|
|
7689
|
+
h: 'hours',
|
|
7690
|
+
min: 'minutes',
|
|
7691
|
+
s: 'seconds',
|
|
7692
|
+
ms: 'milliseconds'
|
|
7693
|
+
};
|
|
7694
|
+
/**
|
|
7695
|
+
* The default units used for decomposition (largest to smallest, excluding ms and weeks).
|
|
7696
|
+
*/ var DEFAULT_DECOMPOSE_UNITS = [
|
|
7697
|
+
'd',
|
|
7698
|
+
'h',
|
|
7699
|
+
'min',
|
|
7700
|
+
's'
|
|
7701
|
+
];
|
|
7702
|
+
/**
|
|
7703
|
+
* The millisecond values for decomposition, ordered largest to smallest.
|
|
7704
|
+
*/ var UNIT_MS_VALUES = [
|
|
7705
|
+
{
|
|
7706
|
+
unit: 'w',
|
|
7707
|
+
ms: util.MS_IN_WEEK
|
|
7708
|
+
},
|
|
7709
|
+
{
|
|
7710
|
+
unit: 'd',
|
|
7711
|
+
ms: util.MS_IN_DAY
|
|
7712
|
+
},
|
|
7713
|
+
{
|
|
7714
|
+
unit: 'h',
|
|
7715
|
+
ms: util.MS_IN_HOUR
|
|
7716
|
+
},
|
|
7717
|
+
{
|
|
7718
|
+
unit: 'min',
|
|
7719
|
+
ms: util.MS_IN_MINUTE
|
|
7720
|
+
},
|
|
7721
|
+
{
|
|
7722
|
+
unit: 's',
|
|
7723
|
+
ms: util.MS_IN_SECOND
|
|
7724
|
+
},
|
|
7725
|
+
{
|
|
7726
|
+
unit: 'ms',
|
|
7727
|
+
ms: 1
|
|
7728
|
+
}
|
|
7729
|
+
];
|
|
7730
|
+
/**
|
|
7731
|
+
* Decomposes milliseconds into a TimeDurationData object using the specified units.
|
|
7732
|
+
*
|
|
7733
|
+
* Breaks down from largest to smallest unit, only using units in the provided list.
|
|
7734
|
+
*
|
|
7735
|
+
* @param ms - The total milliseconds to decompose
|
|
7736
|
+
* @param units - Which units to decompose into (defaults to days, hours, minutes, seconds)
|
|
7737
|
+
* @returns A TimeDurationData with the decomposed values
|
|
7738
|
+
*
|
|
7739
|
+
* @example
|
|
7740
|
+
* ```typescript
|
|
7741
|
+
* millisecondsToDurationData(5400000); // { days: 0, hours: 1, minutes: 30, seconds: 0 }
|
|
7742
|
+
* millisecondsToDurationData(90000, ['min', 's']); // { minutes: 1, seconds: 30 }
|
|
7743
|
+
* ```
|
|
7744
|
+
*/ function millisecondsToDurationData(ms, units) {
|
|
7745
|
+
var allowedUnits = new Set(units !== null && units !== void 0 ? units : DEFAULT_DECOMPOSE_UNITS);
|
|
7746
|
+
var result = {};
|
|
7747
|
+
var remaining = Math.abs(ms);
|
|
7748
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7749
|
+
try {
|
|
7750
|
+
for(var _iterator = UNIT_MS_VALUES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7751
|
+
var _step_value = _step.value, unit = _step_value.unit, unitMs = _step_value.ms;
|
|
7752
|
+
if (allowedUnits.has(unit)) {
|
|
7753
|
+
var fieldName = TIME_UNIT_TO_FIELD_MAP[unit];
|
|
7754
|
+
var value = Math.floor(remaining / unitMs);
|
|
7755
|
+
result[fieldName] = value;
|
|
7756
|
+
remaining -= value * unitMs;
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
} catch (err) {
|
|
7760
|
+
_didIteratorError = true;
|
|
7761
|
+
_iteratorError = err;
|
|
7762
|
+
} finally{
|
|
7763
|
+
try {
|
|
7764
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7765
|
+
_iterator.return();
|
|
7766
|
+
}
|
|
7767
|
+
} finally{
|
|
7768
|
+
if (_didIteratorError) {
|
|
7769
|
+
throw _iteratorError;
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7772
|
+
}
|
|
7773
|
+
return result;
|
|
7774
|
+
}
|
|
7775
|
+
/**
|
|
7776
|
+
* Reads a specific time unit value from a TimeDurationData object.
|
|
7777
|
+
*
|
|
7778
|
+
* @param data - The duration data
|
|
7779
|
+
* @param unit - The time unit to read
|
|
7780
|
+
* @returns The value for that unit, or 0 if not set
|
|
7781
|
+
*/ function getDurationDataValue(data, unit) {
|
|
7782
|
+
var _data_TIME_UNIT_TO_FIELD_MAP_unit;
|
|
7783
|
+
return (_data_TIME_UNIT_TO_FIELD_MAP_unit = data[TIME_UNIT_TO_FIELD_MAP[unit]]) !== null && _data_TIME_UNIT_TO_FIELD_MAP_unit !== void 0 ? _data_TIME_UNIT_TO_FIELD_MAP_unit : 0;
|
|
7784
|
+
}
|
|
7785
|
+
/**
|
|
7786
|
+
* Returns a new TimeDurationData with the specified unit set to the given value.
|
|
7787
|
+
*
|
|
7788
|
+
* @param data - The original duration data
|
|
7789
|
+
* @param unit - The time unit to set
|
|
7790
|
+
* @param value - The new value
|
|
7791
|
+
* @returns A new TimeDurationData with the updated value
|
|
7792
|
+
*/ function setDurationDataValue(data, unit, value) {
|
|
7793
|
+
return _object_spread_props$5(_object_spread$6({}, data), _define_property$8({}, TIME_UNIT_TO_FIELD_MAP[unit], value));
|
|
7794
|
+
}
|
|
7795
|
+
// MARK: Parsing
|
|
7796
|
+
/**
|
|
7797
|
+
* Regex for matching duration components in a string.
|
|
7798
|
+
*
|
|
7799
|
+
* Matches patterns like "3d", "10 hours", "5min", "8 sec", "500ms", "2w", etc.
|
|
7800
|
+
*/ var DURATION_COMPONENT_REGEX = /(\d+(?:\.\d+)?)\s*(w|wk|weeks?|d|days?|h|hr|hours?|m(?!s)|min|minutes?|s|sec|seconds?|ms|milliseconds?)/gi;
|
|
7801
|
+
/**
|
|
7802
|
+
* Maps parsed unit strings to their canonical TimeUnit value.
|
|
7803
|
+
*/ function normalizeUnitString(unitStr) {
|
|
7804
|
+
var lower = unitStr.toLowerCase();
|
|
7805
|
+
if (lower === 'ms' || lower === 'milliseconds' || lower === 'millisecond') {
|
|
7806
|
+
return 'ms';
|
|
7807
|
+
}
|
|
7808
|
+
if (lower === 's' || lower === 'sec' || lower === 'second' || lower === 'seconds') {
|
|
7809
|
+
return 's';
|
|
7810
|
+
}
|
|
7811
|
+
if (lower === 'm' || lower === 'min' || lower === 'minute' || lower === 'minutes') {
|
|
7812
|
+
return 'min';
|
|
7813
|
+
}
|
|
7814
|
+
if (lower === 'h' || lower === 'hr' || lower === 'hour' || lower === 'hours') {
|
|
7815
|
+
return 'h';
|
|
7816
|
+
}
|
|
7817
|
+
if (lower === 'd' || lower === 'day' || lower === 'days') {
|
|
7818
|
+
return 'd';
|
|
7819
|
+
}
|
|
7820
|
+
if (lower === 'w' || lower === 'wk' || lower === 'week' || lower === 'weeks') {
|
|
7821
|
+
return 'w';
|
|
7822
|
+
}
|
|
7823
|
+
return 'ms';
|
|
7824
|
+
}
|
|
7825
|
+
/**
|
|
7826
|
+
* Parses a human-readable duration string into a TimeDurationData object.
|
|
7827
|
+
*
|
|
7828
|
+
* Supports compact formats ("3d10h5m8s"), spaced formats ("3d 10h 5m 8s"),
|
|
7829
|
+
* and long formats ("3 days 10 hours 5 minutes 8 seconds"). Mixed formats
|
|
7830
|
+
* are also supported. If the same unit appears multiple times, values are summed.
|
|
7831
|
+
*
|
|
7832
|
+
* If the string contains only a number with no unit, it is treated as the
|
|
7833
|
+
* smallest unit that would make sense (milliseconds by default).
|
|
7834
|
+
*
|
|
7835
|
+
* @param input - The duration string to parse
|
|
7836
|
+
* @returns A TimeDurationData object with the parsed values
|
|
7837
|
+
*
|
|
7838
|
+
* @example
|
|
7839
|
+
* ```typescript
|
|
7840
|
+
* parseDurationString('3d10h5m8s'); // { days: 3, hours: 10, minutes: 5, seconds: 8 }
|
|
7841
|
+
* parseDurationString('2 hours 30 minutes'); // { hours: 2, minutes: 30 }
|
|
7842
|
+
* parseDurationString('1w 2d'); // { weeks: 1, days: 2 }
|
|
7843
|
+
* parseDurationString('500ms'); // { milliseconds: 500 }
|
|
7844
|
+
* ```
|
|
7845
|
+
*/ function parseDurationString(input) {
|
|
7846
|
+
var result = {};
|
|
7847
|
+
var match;
|
|
7848
|
+
var hasMatches = false;
|
|
7849
|
+
// Reset regex lastIndex for global regex
|
|
7850
|
+
DURATION_COMPONENT_REGEX.lastIndex = 0;
|
|
7851
|
+
while((match = DURATION_COMPONENT_REGEX.exec(input)) !== null){
|
|
7852
|
+
var _result_fieldName;
|
|
7853
|
+
hasMatches = true;
|
|
7854
|
+
var amount = parseFloat(match[1]);
|
|
7855
|
+
var unit = normalizeUnitString(match[2]);
|
|
7856
|
+
var fieldName = TIME_UNIT_TO_FIELD_MAP[unit];
|
|
7857
|
+
// Sum if the same unit appears multiple times
|
|
7858
|
+
result[fieldName] = ((_result_fieldName = result[fieldName]) !== null && _result_fieldName !== void 0 ? _result_fieldName : 0) + amount;
|
|
7859
|
+
}
|
|
7860
|
+
// If no matches but the input is a plain number, treat as milliseconds
|
|
7861
|
+
if (!hasMatches) {
|
|
7862
|
+
var trimmed = input.trim();
|
|
7863
|
+
var asNumber = parseFloat(trimmed);
|
|
7864
|
+
if (!isNaN(asNumber)) {
|
|
7865
|
+
result['milliseconds'] = asNumber;
|
|
7866
|
+
}
|
|
7867
|
+
}
|
|
7868
|
+
return result;
|
|
7869
|
+
}
|
|
7870
|
+
/**
|
|
7871
|
+
* Parses a duration string directly to milliseconds.
|
|
7872
|
+
*
|
|
7873
|
+
* @param input - The duration string to parse
|
|
7874
|
+
* @returns Total milliseconds
|
|
7875
|
+
*
|
|
7876
|
+
* @example
|
|
7877
|
+
* ```typescript
|
|
7878
|
+
* parseDurationStringToMilliseconds('1h30m'); // 5400000
|
|
7879
|
+
* ```
|
|
7880
|
+
*/ function parseDurationStringToMilliseconds(input) {
|
|
7881
|
+
return durationDataToMilliseconds(parseDurationString(input));
|
|
7882
|
+
}
|
|
7883
|
+
// MARK: Formatting
|
|
7884
|
+
/**
|
|
7885
|
+
* Compact format labels for each unit used in formatted strings.
|
|
7886
|
+
*/ var COMPACT_UNIT_LABELS = [
|
|
7887
|
+
{
|
|
7888
|
+
field: 'weeks',
|
|
7889
|
+
label: 'w'
|
|
7890
|
+
},
|
|
7891
|
+
{
|
|
7892
|
+
field: 'days',
|
|
7893
|
+
label: 'd'
|
|
7894
|
+
},
|
|
7895
|
+
{
|
|
7896
|
+
field: 'hours',
|
|
7897
|
+
label: 'h'
|
|
7898
|
+
},
|
|
7899
|
+
{
|
|
7900
|
+
field: 'minutes',
|
|
7901
|
+
label: 'm'
|
|
7902
|
+
},
|
|
7903
|
+
{
|
|
7904
|
+
field: 'seconds',
|
|
7905
|
+
label: 's'
|
|
7906
|
+
},
|
|
7907
|
+
{
|
|
7908
|
+
field: 'milliseconds',
|
|
7909
|
+
label: 'ms'
|
|
7910
|
+
}
|
|
7911
|
+
];
|
|
7912
|
+
/**
|
|
7913
|
+
* Formats a TimeDurationData to a compact string like "3d10h5m8s".
|
|
7914
|
+
*
|
|
7915
|
+
* Omits zero-value units. Returns "0s" if all fields are zero or empty.
|
|
7916
|
+
*
|
|
7917
|
+
* @param data - The duration data to format
|
|
7918
|
+
* @returns A compact duration string
|
|
7919
|
+
*
|
|
7920
|
+
* @example
|
|
7921
|
+
* ```typescript
|
|
7922
|
+
* formatDurationString({ days: 3, hours: 10, minutes: 5, seconds: 8 }); // "3d10h5m8s"
|
|
7923
|
+
* formatDurationString({ hours: 2, minutes: 30 }); // "2h30m"
|
|
7924
|
+
* formatDurationString({}); // "0s"
|
|
7925
|
+
* ```
|
|
7926
|
+
*/ function formatDurationString(data) {
|
|
7927
|
+
var parts = [];
|
|
7928
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7929
|
+
try {
|
|
7930
|
+
for(var _iterator = COMPACT_UNIT_LABELS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7931
|
+
var _step_value = _step.value, field = _step_value.field, label = _step_value.label;
|
|
7932
|
+
var value = data[field];
|
|
7933
|
+
if (value) {
|
|
7934
|
+
parts.push("".concat(value).concat(label));
|
|
7935
|
+
}
|
|
7936
|
+
}
|
|
7937
|
+
} catch (err) {
|
|
7938
|
+
_didIteratorError = true;
|
|
7939
|
+
_iteratorError = err;
|
|
7940
|
+
} finally{
|
|
7941
|
+
try {
|
|
7942
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7943
|
+
_iterator.return();
|
|
7944
|
+
}
|
|
7945
|
+
} finally{
|
|
7946
|
+
if (_didIteratorError) {
|
|
7947
|
+
throw _iteratorError;
|
|
7948
|
+
}
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7951
|
+
return parts.length > 0 ? parts.join('') : '0s';
|
|
7952
|
+
}
|
|
7953
|
+
/**
|
|
7954
|
+
* Long format labels for each unit.
|
|
7955
|
+
*/ var LONG_UNIT_LABELS = [
|
|
7956
|
+
{
|
|
7957
|
+
field: 'weeks',
|
|
7958
|
+
singular: 'week',
|
|
7959
|
+
plural: 'weeks'
|
|
7960
|
+
},
|
|
7961
|
+
{
|
|
7962
|
+
field: 'days',
|
|
7963
|
+
singular: 'day',
|
|
7964
|
+
plural: 'days'
|
|
7965
|
+
},
|
|
7966
|
+
{
|
|
7967
|
+
field: 'hours',
|
|
7968
|
+
singular: 'hour',
|
|
7969
|
+
plural: 'hours'
|
|
7970
|
+
},
|
|
7971
|
+
{
|
|
7972
|
+
field: 'minutes',
|
|
7973
|
+
singular: 'minute',
|
|
7974
|
+
plural: 'minutes'
|
|
7975
|
+
},
|
|
7976
|
+
{
|
|
7977
|
+
field: 'seconds',
|
|
7978
|
+
singular: 'second',
|
|
7979
|
+
plural: 'seconds'
|
|
7980
|
+
},
|
|
7981
|
+
{
|
|
7982
|
+
field: 'milliseconds',
|
|
7983
|
+
singular: 'millisecond',
|
|
7984
|
+
plural: 'milliseconds'
|
|
7985
|
+
}
|
|
7986
|
+
];
|
|
7987
|
+
/**
|
|
7988
|
+
* Formats a TimeDurationData to a long human-readable string.
|
|
7989
|
+
*
|
|
7990
|
+
* Omits zero-value units. Returns "0 seconds" if all fields are zero or empty.
|
|
7991
|
+
*
|
|
7992
|
+
* @param data - The duration data to format
|
|
7993
|
+
* @returns A human-readable duration string
|
|
7994
|
+
*
|
|
7995
|
+
* @example
|
|
7996
|
+
* ```typescript
|
|
7997
|
+
* formatDurationStringLong({ days: 3, hours: 10 }); // "3 days 10 hours"
|
|
7998
|
+
* formatDurationStringLong({ hours: 1, minutes: 1 }); // "1 hour 1 minute"
|
|
7999
|
+
* ```
|
|
8000
|
+
*/ function formatDurationStringLong(data) {
|
|
8001
|
+
var parts = [];
|
|
8002
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8003
|
+
try {
|
|
8004
|
+
for(var _iterator = LONG_UNIT_LABELS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8005
|
+
var _step_value = _step.value, field = _step_value.field, singular = _step_value.singular, plural = _step_value.plural;
|
|
8006
|
+
var value = data[field];
|
|
8007
|
+
if (value) {
|
|
8008
|
+
parts.push("".concat(value, " ").concat(value === 1 ? singular : plural));
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
} catch (err) {
|
|
8012
|
+
_didIteratorError = true;
|
|
8013
|
+
_iteratorError = err;
|
|
8014
|
+
} finally{
|
|
8015
|
+
try {
|
|
8016
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8017
|
+
_iterator.return();
|
|
8018
|
+
}
|
|
8019
|
+
} finally{
|
|
8020
|
+
if (_didIteratorError) {
|
|
8021
|
+
throw _iteratorError;
|
|
8022
|
+
}
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
return parts.length > 0 ? parts.join(' ') : '0 seconds';
|
|
8026
|
+
}
|
|
8027
|
+
|
|
7600
8028
|
function _array_like_to_array$3(arr, len) {
|
|
7601
8029
|
if (len == null || len > arr.length) len = arr.length;
|
|
7602
8030
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -7863,7 +8291,7 @@ var _type, _type1;
|
|
|
7863
8291
|
*/ var dateRangeParamsType = arktype.type({
|
|
7864
8292
|
type: (_type = arktype.type).enumerated.apply(_type, _to_consumable_array(Object.values(exports.DateRangeType))),
|
|
7865
8293
|
date: model.ARKTYPE_DATE_DTO_TYPE,
|
|
7866
|
-
'distance?': 'number'
|
|
8294
|
+
'distance?': model.clearable('number')
|
|
7867
8295
|
});
|
|
7868
8296
|
// MARK: DateCell
|
|
7869
8297
|
/**
|
|
@@ -7883,7 +8311,7 @@ var _type, _type1;
|
|
|
7883
8311
|
* Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
|
|
7884
8312
|
* into the corresponding runtime types.
|
|
7885
8313
|
*/ var dateCellRangeType = dateCellType.merge({
|
|
7886
|
-
'to?': 'number.integer >= 0'
|
|
8314
|
+
'to?': model.clearable('number.integer >= 0')
|
|
7887
8315
|
});
|
|
7888
8316
|
// MARK: DateCellTiming
|
|
7889
8317
|
/**
|
|
@@ -7919,8 +8347,8 @@ var _type, _type1;
|
|
|
7919
8347
|
'&',
|
|
7920
8348
|
'string'
|
|
7921
8349
|
],
|
|
7922
|
-
'd?': 'number.integer >= 0 []',
|
|
7923
|
-
'ex?': 'number.integer >= 0 []'
|
|
8350
|
+
'd?': model.clearable('number.integer >= 0 []'),
|
|
8351
|
+
'ex?': model.clearable('number.integer >= 0 []')
|
|
7924
8352
|
});
|
|
7925
8353
|
// MARK: ModelRecurrenceInfo
|
|
7926
8354
|
/**
|
|
@@ -7930,11 +8358,11 @@ var _type, _type1;
|
|
|
7930
8358
|
* Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
|
|
7931
8359
|
* or runtime Date objects into the corresponding runtime types.
|
|
7932
8360
|
*/ var modelRecurrenceInfoType = arktype.type({
|
|
7933
|
-
'timezone?': 'string',
|
|
8361
|
+
'timezone?': model.clearable('string'),
|
|
7934
8362
|
rrule: 'string',
|
|
7935
8363
|
start: model.ARKTYPE_DATE_DTO_TYPE,
|
|
7936
8364
|
end: model.ARKTYPE_DATE_DTO_TYPE,
|
|
7937
|
-
'forever?': 'boolean'
|
|
8365
|
+
'forever?': model.clearable('boolean')
|
|
7938
8366
|
});
|
|
7939
8367
|
// MARK: Validators
|
|
7940
8368
|
/**
|
|
@@ -11300,6 +11728,7 @@ exports.dateTimeMinuteWholeDayDecisionFunction = dateTimeMinuteWholeDayDecisionF
|
|
|
11300
11728
|
exports.dateTimeStringFormat = dateTimeStringFormat;
|
|
11301
11729
|
exports.dateTimezoneUtcNormal = dateTimezoneUtcNormal;
|
|
11302
11730
|
exports.daysToMinutes = daysToMinutes;
|
|
11731
|
+
exports.durationDataToMilliseconds = durationDataToMilliseconds;
|
|
11303
11732
|
exports.durationSpanDateRelativeState = durationSpanDateRelativeState;
|
|
11304
11733
|
exports.durationSpanFromDateRange = durationSpanFromDateRange;
|
|
11305
11734
|
exports.durationSpanToDateRange = durationSpanToDateRange;
|
|
@@ -11332,6 +11761,8 @@ exports.formatDateRange = formatDateRange;
|
|
|
11332
11761
|
exports.formatDateRangeDistance = formatDateRangeDistance;
|
|
11333
11762
|
exports.formatDateRangeDistanceFunction = formatDateRangeDistanceFunction;
|
|
11334
11763
|
exports.formatDateRangeFunction = formatDateRangeFunction;
|
|
11764
|
+
exports.formatDurationString = formatDurationString;
|
|
11765
|
+
exports.formatDurationStringLong = formatDurationStringLong;
|
|
11335
11766
|
exports.formatStartedEndedDistanceString = formatStartedEndedDistanceString;
|
|
11336
11767
|
exports.formatToDateString = formatToDateString;
|
|
11337
11768
|
exports.formatToDayRangeString = formatToDayRangeString;
|
|
@@ -11357,6 +11788,7 @@ exports.getCurrentSystemOffsetInMs = getCurrentSystemOffsetInMs;
|
|
|
11357
11788
|
exports.getDateCellTimingFirstEventDateRange = getDateCellTimingFirstEventDateRange;
|
|
11358
11789
|
exports.getDateCellTimingHoursInEvent = getDateCellTimingHoursInEvent;
|
|
11359
11790
|
exports.getDaysOfWeekInDateRange = getDaysOfWeekInDateRange;
|
|
11791
|
+
exports.getDurationDataValue = getDurationDataValue;
|
|
11360
11792
|
exports.getGreatestDateCellIndexInDateCellRanges = getGreatestDateCellIndexInDateCellRanges;
|
|
11361
11793
|
exports.getLeastAndGreatestDateCellIndexInDateCellRanges = getLeastAndGreatestDateCellIndexInDateCellRanges;
|
|
11362
11794
|
exports.getLeastDateCellIndexInDateCellRanges = getLeastDateCellIndexInDateCellRanges;
|
|
@@ -11442,6 +11874,7 @@ exports.makeDaysAndTimeFiltersFunction = makeDaysAndTimeFiltersFunction;
|
|
|
11442
11874
|
exports.makeMongoDBLikeDateQueryBuilder = makeMongoDBLikeDateQueryBuilder;
|
|
11443
11875
|
exports.maxFutureDate = maxFutureDate;
|
|
11444
11876
|
exports.mergeMongoDBLikeRangeFilters = mergeMongoDBLikeRangeFilters;
|
|
11877
|
+
exports.millisecondsToDurationData = millisecondsToDurationData;
|
|
11445
11878
|
exports.minutesToMs = minutesToMs;
|
|
11446
11879
|
exports.modelRecurrenceInfoType = modelRecurrenceInfoType;
|
|
11447
11880
|
exports.modifyDateCellToFitRange = modifyDateCellToFitRange;
|
|
@@ -11451,6 +11884,8 @@ exports.monthDaySlashDateStringFormat = monthDaySlashDateStringFormat;
|
|
|
11451
11884
|
exports.msToMinutes = msToMinutes;
|
|
11452
11885
|
exports.msToSeconds = msToSeconds;
|
|
11453
11886
|
exports.nowInterval = nowInterval;
|
|
11887
|
+
exports.parseDurationString = parseDurationString;
|
|
11888
|
+
exports.parseDurationStringToMilliseconds = parseDurationStringToMilliseconds;
|
|
11454
11889
|
exports.parseISO8601DayStringToDate = parseISO8601DayStringToDate;
|
|
11455
11890
|
exports.parseJsDateString = parseJsDateString;
|
|
11456
11891
|
exports.parseReadableTimeString = parseReadableTimeString;
|
|
@@ -11472,6 +11907,7 @@ exports.roundToMinuteSteps = roundToMinuteSteps;
|
|
|
11472
11907
|
exports.safeFormatToISO8601DateString = safeFormatToISO8601DateString;
|
|
11473
11908
|
exports.safeToJsDate = safeToJsDate;
|
|
11474
11909
|
exports.searchTimezoneInfos = searchTimezoneInfos;
|
|
11910
|
+
exports.setDurationDataValue = setDurationDataValue;
|
|
11475
11911
|
exports.setOnDateWithTimezoneNormalFunction = setOnDateWithTimezoneNormalFunction;
|
|
11476
11912
|
exports.shiftDateCellTimingToSystemTimezone = shiftDateCellTimingToSystemTimezone;
|
|
11477
11913
|
exports.shiftDateCellTimingToTimezone = shiftDateCellTimingToTimezone;
|
|
@@ -11494,6 +11930,7 @@ exports.systemExperiencesDaylightSavings = systemExperiencesDaylightSavings;
|
|
|
11494
11930
|
exports.systemNormalDateToBaseDate = systemNormalDateToBaseDate;
|
|
11495
11931
|
exports.systemNormalDateToBaseDateOffset = systemNormalDateToBaseDateOffset;
|
|
11496
11932
|
exports.targetDateToBaseDate = targetDateToBaseDate;
|
|
11933
|
+
exports.timeDurationDataIsEmpty = timeDurationDataIsEmpty;
|
|
11497
11934
|
exports.timezoneInfoForSystem = timezoneInfoForSystem;
|
|
11498
11935
|
exports.timezoneStringToSearchableString = timezoneStringToSearchableString;
|
|
11499
11936
|
exports.timezoneStringToTimezoneInfo = timezoneStringToTimezoneInfo;
|