@ancon/wildcat-utils 1.44.0-timezone-refactor.1 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/checkout/checkoutHasWallet.d.ts +3 -0
- package/checkout/getCheckoutRequestItemFromCheckoutItem.d.ts +2 -2
- package/checkout/getCheckoutRequestItemFromCheckoutItem.js +1 -1
- package/checkout/getCheckoutRequestItemFromCheckoutItem.mjs +26 -14
- package/checkout/getCheckoutWalletTopUpMetaData.d.ts +7 -0
- package/checkout/getCheckoutWalletTopUpMetaData.js +1 -0
- package/checkout/getCheckoutWalletTopUpMetaData.mjs +15 -0
- package/checkout/getWalletMetaFromCheckout.d.ts +3 -0
- package/checkout/index.d.ts +4 -1
- package/checkout/index.js +1 -1
- package/checkout/index.mjs +25 -19
- package/checkout/isWalletTopUpCheckout.d.ts +2 -0
- package/checkout/isWalletTopUpCheckout.js +1 -0
- package/checkout/isWalletTopUpCheckout.mjs +12 -0
- package/checkout/isWalletTopUpCheckoutItem.d.ts +2 -0
- package/checkout/isWalletTopUpCheckoutItem.js +1 -0
- package/checkout/isWalletTopUpCheckoutItem.mjs +9 -0
- package/courses/constants.js +1 -1
- package/courses/constants.mjs +1 -1
- package/date/convertToLocalTimezone.d.ts +8 -0
- package/date/convertToLocalTimezone.js +1 -0
- package/date/convertToLocalTimezone.mjs +12 -0
- package/date/convertToSpecificTimezone.d.ts +9 -0
- package/date/convertToSpecificTimezone.js +1 -0
- package/date/convertToSpecificTimezone.mjs +6 -0
- package/date/getTimezoneUtcOffsetDifference.d.ts +8 -0
- package/date/getTimezoneUtcOffsetDifference.js +1 -0
- package/date/getTimezoneUtcOffsetDifference.mjs +8 -0
- package/date/index.d.ts +5 -1
- package/date/index.js +1 -1
- package/date/index.mjs +14 -6
- package/date/isDSTShiftPresentInRange.d.ts +8 -0
- package/date/isDSTShiftPresentInRange.js +1 -0
- package/date/isDSTShiftPresentInRange.mjs +9 -0
- package/hangfire/createHangfirePoller.d.ts +8 -2
- package/hangfire/createHangfirePoller.js +1 -1
- package/hangfire/createHangfirePoller.mjs +72 -62
- package/hangfire/createMakeHangfireRequest.d.ts +10 -1
- package/hangfire/createMakeHangfireRequest.js +1 -1
- package/hangfire/createMakeHangfireRequest.mjs +16 -14
- package/index.js +1 -1
- package/index.mjs +216 -198
- package/outlet/getOutletCurrentActiveOperatingHour.js +1 -1
- package/outlet/getOutletCurrentActiveOperatingHour.mjs +26 -21
- package/outlet/getOutletCurrentAvailabilityInfo.js +1 -1
- package/outlet/getOutletCurrentAvailabilityInfo.mjs +18 -15
- package/outlet/getOutletNextOpeningTagInformation.js +1 -1
- package/outlet/getOutletNextOpeningTagInformation.mjs +13 -10
- package/outlet/getOutletNextOpeningTimeText.js +1 -1
- package/outlet/getOutletNextOpeningTimeText.mjs +12 -9
- package/outlet/getOutletNextReadyToOrderTime.js +1 -1
- package/outlet/getOutletNextReadyToOrderTime.mjs +38 -26
- package/outlet/getOutletPickerTimesForDay.js +1 -1
- package/outlet/getOutletPickerTimesForDay.mjs +101 -46
- package/outlet/getOutletPickerTimesForWeek.js +1 -1
- package/outlet/getOutletPickerTimesForWeek.mjs +13 -8
- package/outlet/getOutletTagInformation.js +1 -1
- package/outlet/getOutletTagInformation.mjs +64 -62
- package/outlet/getServiceIntervalEnd.js +1 -1
- package/outlet/getServiceIntervalEnd.mjs +11 -10
- package/outlet/getServiceIntervalStart.js +1 -1
- package/outlet/getServiceIntervalStart.mjs +7 -6
- package/outlet/getServiceIntervalTimeSpanMoment.d.ts +9 -0
- package/outlet/getServiceIntervalTimeSpanMoment.js +1 -0
- package/outlet/getServiceIntervalTimeSpanMoment.mjs +9 -0
- package/outlet/getTimezoneAdjustedServiceInterval.d.ts +14 -0
- package/outlet/getTimezoneAdjustedServiceInterval.js +1 -0
- package/outlet/getTimezoneAdjustedServiceInterval.mjs +26 -0
- package/outlet/index.js +1 -1
- package/outlet/index.mjs +69 -66
- package/outlet/searchNextOpeningMoment.js +1 -1
- package/outlet/searchNextOpeningMoment.mjs +61 -58
- package/outlet/types.d.ts +6 -0
- package/outlet/types.js +1 -1
- package/outlet/types.mjs +3 -2
- package/package.json +56 -11
- package/time/convertSecondsToTimeSpan.d.ts +9 -0
- package/time/convertSecondsToTimeSpan.js +1 -0
- package/time/convertSecondsToTimeSpan.mjs +12 -0
- package/time/convertTimeSpanToSeconds.d.ts +6 -0
- package/time/convertTimeSpanToSeconds.js +1 -0
- package/time/convertTimeSpanToSeconds.mjs +8 -0
- package/time/createTimeSpan.js +1 -1
- package/time/createTimeSpan.mjs +10 -5
- package/time/formatTimeSpan.js +1 -1
- package/time/formatTimeSpan.mjs +5 -4
- package/time/getDurationBetweenTimeSpans.d.ts +2 -2
- package/time/getDurationBetweenTimeSpans.js +1 -1
- package/time/getDurationBetweenTimeSpans.mjs +11 -9
- package/time/getEndTimeSpanOfTimePeriod.js +1 -1
- package/time/getEndTimeSpanOfTimePeriod.mjs +8 -6
- package/time/index.d.ts +3 -1
- package/time/index.js +1 -1
- package/time/index.mjs +16 -12
- package/outlet/getMomentFromDateAndTimeString.d.ts +0 -3
- package/outlet/getMomentFromDateAndTimeString.js +0 -1
- package/outlet/getMomentFromDateAndTimeString.mjs +0 -17
- package/outlet/getNextTenthMinute.d.ts +0 -2
- package/outlet/getNextTenthMinute.js +0 -1
- package/outlet/getNextTenthMinute.mjs +0 -7
|
@@ -1,76 +1,79 @@
|
|
|
1
|
-
import
|
|
1
|
+
import c from "moment";
|
|
2
2
|
import { IntervalState as p } from "@ancon/wildcat-types";
|
|
3
|
-
import
|
|
4
|
-
import { OutletMapKeyFormatter as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
r || (e = t);
|
|
3
|
+
import a from "../time/getTimeSpanParts.mjs";
|
|
4
|
+
import { OutletMapKeyFormatter as d, OutletTimelineDayCount as O } from "./constants.mjs";
|
|
5
|
+
import f from "./getTimezoneAdjustedServiceInterval.mjs";
|
|
6
|
+
import "../date/getTimezoneUtcOffsetDifference.mjs";
|
|
7
|
+
import "../date/convertToSpecificTimezone.mjs";
|
|
8
|
+
import "./getServiceIntervalTimeSpanMoment.mjs";
|
|
9
|
+
function g(l) {
|
|
10
|
+
let t = null;
|
|
11
|
+
const { intervals: e, exception: n } = l;
|
|
12
|
+
if (n) {
|
|
13
|
+
const { state: r } = n;
|
|
14
|
+
r || (t = n);
|
|
16
15
|
} else {
|
|
17
|
-
const r =
|
|
18
|
-
(
|
|
19
|
-
), [
|
|
20
|
-
return
|
|
16
|
+
const r = e.sort(
|
|
17
|
+
(i, o) => a(i.from).hours - a(o.from).hours
|
|
18
|
+
), [s] = r;
|
|
19
|
+
return s;
|
|
21
20
|
}
|
|
22
|
-
return
|
|
21
|
+
return t;
|
|
23
22
|
}
|
|
24
|
-
function
|
|
25
|
-
var r,
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
const o =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
function v(l, t, e) {
|
|
24
|
+
var r, s;
|
|
25
|
+
const n = [];
|
|
26
|
+
if (t.exception) {
|
|
27
|
+
if (t.exception.state === p.Opened) {
|
|
28
|
+
const o = f(
|
|
29
|
+
l,
|
|
30
|
+
t.exception,
|
|
31
|
+
e.utcOffset()
|
|
32
|
+
).openingTime;
|
|
33
|
+
e.isBefore(o) && n.push({
|
|
34
|
+
interval: t.exception,
|
|
35
35
|
moment: o
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
} else
|
|
39
|
-
for (let
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
for (let i = 0; i < t.intervals.length; i += 1) {
|
|
40
|
+
const o = t.intervals[i], u = f(
|
|
41
|
+
l,
|
|
42
|
+
o,
|
|
43
|
+
e.utcOffset()
|
|
44
|
+
).openingTime;
|
|
45
|
+
e.isBefore(u) && n.push({ interval: o, moment: u });
|
|
45
46
|
}
|
|
46
|
-
return
|
|
47
|
+
return n.length < 2 ? ((r = n[0]) == null ? void 0 : r.interval) ?? null : ((s = n.sort(
|
|
47
48
|
// @ts-ignore TODO
|
|
48
|
-
(
|
|
49
|
-
)[0]) == null ? void 0 :
|
|
49
|
+
(i, o) => i.moment - e - (o.moment - e)
|
|
50
|
+
)[0]) == null ? void 0 : s.interval) ?? null;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
let
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
function K(l, t) {
|
|
53
|
+
let e = null;
|
|
54
|
+
const n = c(t).format(d), r = v(
|
|
55
|
+
n,
|
|
56
|
+
l[n],
|
|
57
|
+
t
|
|
57
58
|
);
|
|
58
|
-
if (r && (
|
|
59
|
-
|
|
60
|
-
r
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
if (r && (e = f(
|
|
60
|
+
n,
|
|
61
|
+
r,
|
|
62
|
+
t.utcOffset()
|
|
63
|
+
).openingTime), !e)
|
|
64
|
+
for (let s = 1; s < O; s += 1) {
|
|
65
|
+
const i = c(t).add(s, "d"), o = i.format(d), m = l[o], u = g(m);
|
|
66
|
+
if (u) {
|
|
67
|
+
e = f(
|
|
68
|
+
o,
|
|
69
|
+
u,
|
|
70
|
+
i.utcOffset()
|
|
71
|
+
).openingTime;
|
|
69
72
|
break;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
return
|
|
75
|
+
return e;
|
|
73
76
|
}
|
|
74
77
|
export {
|
|
75
|
-
|
|
78
|
+
K as default
|
|
76
79
|
};
|
package/outlet/types.d.ts
CHANGED
|
@@ -24,9 +24,15 @@ export declare enum OutletListSection {
|
|
|
24
24
|
OrderNow = "OrderNow",
|
|
25
25
|
Closed = "Closed"
|
|
26
26
|
}
|
|
27
|
+
export declare enum PickerTimeTimezoneTag {
|
|
28
|
+
Standard = 0,
|
|
29
|
+
Summer = 1
|
|
30
|
+
}
|
|
27
31
|
export declare type PickerTime = {
|
|
28
32
|
timestamp: number;
|
|
29
33
|
timeLabel: string;
|
|
30
34
|
dayLabel: string;
|
|
35
|
+
/** This is available for time label duplicated picker times in an interval that has a DST shift */
|
|
36
|
+
timezoneTag?: PickerTimeTimezoneTag;
|
|
31
37
|
};
|
|
32
38
|
export declare type PickerDay = PickerTime[];
|
package/outlet/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var d=(r=>(r.PreOrder="PreOrder",r.OrderNow="OrderNow",r.Closed="Closed",r))(d||{}),e=(r=>(r[r.Standard=0]="Standard",r[r.Summer=1]="Summer",r))(e||{});exports.OutletListSection=d;exports.PickerTimeTimezoneTag=e;
|
package/outlet/types.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var d = /* @__PURE__ */ ((r) => (r.PreOrder = "PreOrder", r.OrderNow = "OrderNow", r.Closed = "Closed", r))(d || {});
|
|
1
|
+
var d = /* @__PURE__ */ ((r) => (r.PreOrder = "PreOrder", r.OrderNow = "OrderNow", r.Closed = "Closed", r))(d || {}), a = /* @__PURE__ */ ((r) => (r[r.Standard = 0] = "Standard", r[r.Summer = 1] = "Summer", r))(a || {});
|
|
2
2
|
export {
|
|
3
|
-
d as OutletListSection
|
|
3
|
+
d as OutletListSection,
|
|
4
|
+
a as PickerTimeTimezoneTag
|
|
4
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.44.0
|
|
3
|
+
"version": "1.44.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -156,6 +156,11 @@
|
|
|
156
156
|
"require": "./checkout/getCheckoutRequestItemFromCheckoutItem.js",
|
|
157
157
|
"types": "./checkout/getCheckoutRequestItemFromCheckoutItem.d.ts"
|
|
158
158
|
},
|
|
159
|
+
"./checkout/getCheckoutWalletTopUpMetaData": {
|
|
160
|
+
"import": "./checkout/getCheckoutWalletTopUpMetaData.mjs",
|
|
161
|
+
"require": "./checkout/getCheckoutWalletTopUpMetaData.js",
|
|
162
|
+
"types": "./checkout/getCheckoutWalletTopUpMetaData.d.ts"
|
|
163
|
+
},
|
|
159
164
|
"./checkout/getTotalCheckoutItemsQuantity": {
|
|
160
165
|
"import": "./checkout/getTotalCheckoutItemsQuantity.mjs",
|
|
161
166
|
"require": "./checkout/getTotalCheckoutItemsQuantity.js",
|
|
@@ -211,6 +216,16 @@
|
|
|
211
216
|
"require": "./checkout/isUpdatingCheckoutAllowed.js",
|
|
212
217
|
"types": "./checkout/isUpdatingCheckoutAllowed.d.ts"
|
|
213
218
|
},
|
|
219
|
+
"./checkout/isWalletTopUpCheckout": {
|
|
220
|
+
"import": "./checkout/isWalletTopUpCheckout.mjs",
|
|
221
|
+
"require": "./checkout/isWalletTopUpCheckout.js",
|
|
222
|
+
"types": "./checkout/isWalletTopUpCheckout.d.ts"
|
|
223
|
+
},
|
|
224
|
+
"./checkout/isWalletTopUpCheckoutItem": {
|
|
225
|
+
"import": "./checkout/isWalletTopUpCheckoutItem.mjs",
|
|
226
|
+
"require": "./checkout/isWalletTopUpCheckoutItem.js",
|
|
227
|
+
"types": "./checkout/isWalletTopUpCheckoutItem.d.ts"
|
|
228
|
+
},
|
|
214
229
|
"./checkout/isWoltDeliveryInProgress": {
|
|
215
230
|
"import": "./checkout/isWoltDeliveryInProgress.mjs",
|
|
216
231
|
"require": "./checkout/isWoltDeliveryInProgress.js",
|
|
@@ -286,6 +301,16 @@
|
|
|
286
301
|
"require": "./currency/index.js",
|
|
287
302
|
"types": "./currency/index.d.ts"
|
|
288
303
|
},
|
|
304
|
+
"./date/convertToLocalTimezone": {
|
|
305
|
+
"import": "./date/convertToLocalTimezone.mjs",
|
|
306
|
+
"require": "./date/convertToLocalTimezone.js",
|
|
307
|
+
"types": "./date/convertToLocalTimezone.d.ts"
|
|
308
|
+
},
|
|
309
|
+
"./date/convertToSpecificTimezone": {
|
|
310
|
+
"import": "./date/convertToSpecificTimezone.mjs",
|
|
311
|
+
"require": "./date/convertToSpecificTimezone.js",
|
|
312
|
+
"types": "./date/convertToSpecificTimezone.d.ts"
|
|
313
|
+
},
|
|
289
314
|
"./date/createLocalTimezoneDate": {
|
|
290
315
|
"import": "./date/createLocalTimezoneDate.mjs",
|
|
291
316
|
"require": "./date/createLocalTimezoneDate.js",
|
|
@@ -301,11 +326,21 @@
|
|
|
301
326
|
"require": "./date/getFormattedUTCDateTime.js",
|
|
302
327
|
"types": "./date/getFormattedUTCDateTime.d.ts"
|
|
303
328
|
},
|
|
329
|
+
"./date/getTimezoneUtcOffsetDifference": {
|
|
330
|
+
"import": "./date/getTimezoneUtcOffsetDifference.mjs",
|
|
331
|
+
"require": "./date/getTimezoneUtcOffsetDifference.js",
|
|
332
|
+
"types": "./date/getTimezoneUtcOffsetDifference.d.ts"
|
|
333
|
+
},
|
|
304
334
|
"./date": {
|
|
305
335
|
"import": "./date/index.mjs",
|
|
306
336
|
"require": "./date/index.js",
|
|
307
337
|
"types": "./date/index.d.ts"
|
|
308
338
|
},
|
|
339
|
+
"./date/isDSTShiftPresentInRange": {
|
|
340
|
+
"import": "./date/isDSTShiftPresentInRange.mjs",
|
|
341
|
+
"require": "./date/isDSTShiftPresentInRange.js",
|
|
342
|
+
"types": "./date/isDSTShiftPresentInRange.d.ts"
|
|
343
|
+
},
|
|
309
344
|
"./error/createCodedError": {
|
|
310
345
|
"import": "./error/createCodedError.mjs",
|
|
311
346
|
"require": "./error/createCodedError.js",
|
|
@@ -596,16 +631,6 @@
|
|
|
596
631
|
"require": "./outlet/getListOutletOpeningHoursTable.js",
|
|
597
632
|
"types": "./outlet/getListOutletOpeningHoursTable.d.ts"
|
|
598
633
|
},
|
|
599
|
-
"./outlet/getMomentFromDateAndTimeString": {
|
|
600
|
-
"import": "./outlet/getMomentFromDateAndTimeString.mjs",
|
|
601
|
-
"require": "./outlet/getMomentFromDateAndTimeString.js",
|
|
602
|
-
"types": "./outlet/getMomentFromDateAndTimeString.d.ts"
|
|
603
|
-
},
|
|
604
|
-
"./outlet/getNextTenthMinute": {
|
|
605
|
-
"import": "./outlet/getNextTenthMinute.mjs",
|
|
606
|
-
"require": "./outlet/getNextTenthMinute.js",
|
|
607
|
-
"types": "./outlet/getNextTenthMinute.d.ts"
|
|
608
|
-
},
|
|
609
634
|
"./outlet/getOrderFormatAOTipSettings": {
|
|
610
635
|
"import": "./outlet/getOrderFormatAOTipSettings.mjs",
|
|
611
636
|
"require": "./outlet/getOrderFormatAOTipSettings.js",
|
|
@@ -741,6 +766,11 @@
|
|
|
741
766
|
"require": "./outlet/getServiceIntervalStart.js",
|
|
742
767
|
"types": "./outlet/getServiceIntervalStart.d.ts"
|
|
743
768
|
},
|
|
769
|
+
"./outlet/getServiceIntervalTimeSpanMoment": {
|
|
770
|
+
"import": "./outlet/getServiceIntervalTimeSpanMoment.mjs",
|
|
771
|
+
"require": "./outlet/getServiceIntervalTimeSpanMoment.js",
|
|
772
|
+
"types": "./outlet/getServiceIntervalTimeSpanMoment.d.ts"
|
|
773
|
+
},
|
|
744
774
|
"./outlet/getServiceIntervalsForOrderFormat": {
|
|
745
775
|
"import": "./outlet/getServiceIntervalsForOrderFormat.mjs",
|
|
746
776
|
"require": "./outlet/getServiceIntervalsForOrderFormat.js",
|
|
@@ -756,6 +786,11 @@
|
|
|
756
786
|
"require": "./outlet/getStructuredOutletAddress.js",
|
|
757
787
|
"types": "./outlet/getStructuredOutletAddress.d.ts"
|
|
758
788
|
},
|
|
789
|
+
"./outlet/getTimezoneAdjustedServiceInterval": {
|
|
790
|
+
"import": "./outlet/getTimezoneAdjustedServiceInterval.mjs",
|
|
791
|
+
"require": "./outlet/getTimezoneAdjustedServiceInterval.js",
|
|
792
|
+
"types": "./outlet/getTimezoneAdjustedServiceInterval.d.ts"
|
|
793
|
+
},
|
|
759
794
|
"./outlet/hoursAndMinutesToMinutes": {
|
|
760
795
|
"import": "./outlet/hoursAndMinutesToMinutes.mjs",
|
|
761
796
|
"require": "./outlet/hoursAndMinutesToMinutes.js",
|
|
@@ -1046,6 +1081,16 @@
|
|
|
1046
1081
|
"require": "./ticketItem/isTicketItemReady.js",
|
|
1047
1082
|
"types": "./ticketItem/isTicketItemReady.d.ts"
|
|
1048
1083
|
},
|
|
1084
|
+
"./time/convertSecondsToTimeSpan": {
|
|
1085
|
+
"import": "./time/convertSecondsToTimeSpan.mjs",
|
|
1086
|
+
"require": "./time/convertSecondsToTimeSpan.js",
|
|
1087
|
+
"types": "./time/convertSecondsToTimeSpan.d.ts"
|
|
1088
|
+
},
|
|
1089
|
+
"./time/convertTimeSpanToSeconds": {
|
|
1090
|
+
"import": "./time/convertTimeSpanToSeconds.mjs",
|
|
1091
|
+
"require": "./time/convertTimeSpanToSeconds.js",
|
|
1092
|
+
"types": "./time/convertTimeSpanToSeconds.d.ts"
|
|
1093
|
+
},
|
|
1049
1094
|
"./time/createTimeSpan": {
|
|
1050
1095
|
"import": "./time/createTimeSpan.mjs",
|
|
1051
1096
|
"require": "./time/createTimeSpan.js",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TimeFormat } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This function converts the given seconds to a time span.
|
|
4
|
+
*
|
|
5
|
+
* @param seconds The seconds to convert.
|
|
6
|
+
* @param format The format of the time. Default is `HH:mm`.
|
|
7
|
+
* @returns The formatted time span.
|
|
8
|
+
*/
|
|
9
|
+
export default function convertSecondsToTimeSpan(seconds: number, format?: TimeFormat): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./createTimeSpan.js");function i(t,n="HH:mm"){const e=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return s({hours:e,minutes:o,seconds:r},n)}module.exports=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./getTimeSpanParts.js");function r(e){const{hours:t,minutes:n,seconds:s}=o(e);return t*3600+n*60+(s??0)}module.exports=r;
|
package/time/createTimeSpan.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function m(n,r="HH:mm"){const{hours:e,minutes:a,seconds:c}=n,t=e.toString().padStart(2,"0"),s=a.toString().padStart(2,"0"),o=(c??0).toString().padStart(2,"0");switch(r){case"HH:mm:ss":return`${t}:${s}:${o}`;case"HH:mm":default:return`${t}:${s}`}}module.exports=m;
|
package/time/createTimeSpan.mjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function m(n, a = "HH:mm") {
|
|
2
|
+
const { hours: r, minutes: e, seconds: o } = n, t = r.toString().padStart(2, "0"), s = e.toString().padStart(2, "0"), c = (o ?? 0).toString().padStart(2, "0");
|
|
3
|
+
switch (a) {
|
|
4
|
+
case "HH:mm:ss":
|
|
5
|
+
return `${t}:${s}:${c}`;
|
|
6
|
+
case "HH:mm":
|
|
7
|
+
default:
|
|
8
|
+
return `${t}:${s}`;
|
|
9
|
+
}
|
|
5
10
|
}
|
|
6
11
|
export {
|
|
7
|
-
|
|
12
|
+
m as default
|
|
8
13
|
};
|
package/time/formatTimeSpan.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const r=require("
|
|
1
|
+
"use strict";const r=require("./getTimeSpanParts.js"),i=require("./createTimeSpan.js");function m(e,t="HH:mm"){return i(r(e),t)}module.exports=m;
|
package/time/formatTimeSpan.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import t from "./getTimeSpanParts.mjs";
|
|
2
|
+
import e from "./createTimeSpan.mjs";
|
|
3
|
+
function i(m, r = "HH:mm") {
|
|
4
|
+
return e(t(m), r);
|
|
4
5
|
}
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
i as default
|
|
7
8
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TimeFormat } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* This function gets the duration between `from` and `to` time spans.
|
|
4
|
-
* If the `to` time span is before the `from` time span, it will return the duration of the next day.
|
|
3
|
+
* This function gets the duration between `from` and `to` time spans of a day.
|
|
5
4
|
*
|
|
6
5
|
* @param fromTimeSpan The start time span.
|
|
7
6
|
* @param toTimeSpan The end time span.
|
|
8
7
|
* @param format The format of the time. Default is `HH:mm`.
|
|
8
|
+
* @throws An error if the `to` time span is before the `from` time span.
|
|
9
9
|
* @returns The duration time span between the two time spans.
|
|
10
10
|
*/
|
|
11
11
|
export default function getDurationBetweenTimeSpans(fromTimeSpan: string, toTimeSpan: string, format?: TimeFormat): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const i=require("./convertSecondsToTimeSpan.js"),n=require("./convertTimeSpanToSeconds.js");require("./createTimeSpan.js");require("./getTimeSpanParts.js");function c(o,t,r="HH:mm"){const s=n(o),e=n(t)-s;if(e<0)throw new Error("The `to` time span should be greater than the `from` time span.");return i(e,r)}module.exports=c;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import s from "./convertSecondsToTimeSpan.mjs";
|
|
2
|
+
import e from "./convertTimeSpanToSeconds.mjs";
|
|
3
|
+
import "./createTimeSpan.mjs";
|
|
4
|
+
import "./getTimeSpanParts.mjs";
|
|
5
|
+
function d(n, t, r = "HH:mm") {
|
|
6
|
+
const m = e(n), o = e(t) - m;
|
|
7
|
+
if (o < 0)
|
|
8
|
+
throw new Error(
|
|
9
|
+
"The `to` time span should be greater than the `from` time span."
|
|
10
|
+
);
|
|
11
|
+
return s(o, r);
|
|
10
12
|
}
|
|
11
13
|
export {
|
|
12
14
|
d as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const m=require("./convertSecondsToTimeSpan.js"),e=require("./convertTimeSpanToSeconds.js");require("./createTimeSpan.js");require("./getTimeSpanParts.js");function d(n,o="HH:mm"){const{from:r,duration:t}=n,i=e(r),c=e(t),s=i+c;return m(s,o)}module.exports=d;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import d from "./convertSecondsToTimeSpan.mjs";
|
|
2
|
+
import o from "./convertTimeSpanToSeconds.mjs";
|
|
3
|
+
import "./createTimeSpan.mjs";
|
|
4
|
+
import "./getTimeSpanParts.mjs";
|
|
5
|
+
function a(n, e = "HH:mm") {
|
|
6
|
+
const { from: t, duration: m } = n, r = o(t), i = o(m), c = r + i;
|
|
7
|
+
return d(c, e);
|
|
6
8
|
}
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
a as default
|
|
9
11
|
};
|
package/time/index.d.ts
CHANGED
|
@@ -6,4 +6,6 @@ import getEndTimeSpanOfTimePeriod from './getEndTimeSpanOfTimePeriod';
|
|
|
6
6
|
import createTimeSpan from './createTimeSpan';
|
|
7
7
|
import formatTimeSpan from './formatTimeSpan';
|
|
8
8
|
import getDurationBetweenTimeSpans from './getDurationBetweenTimeSpans';
|
|
9
|
-
|
|
9
|
+
import convertSecondsToTimeSpan from './convertSecondsToTimeSpan';
|
|
10
|
+
import convertTimeSpanToSeconds from './convertTimeSpanToSeconds';
|
|
11
|
+
export { toMinutes, getNextTenthMinute, getTimeSpanParts, getPrevNthMinute, getEndTimeSpanOfTimePeriod, createTimeSpan, formatTimeSpan, getDurationBetweenTimeSpans, convertSecondsToTimeSpan, convertTimeSpanToSeconds, };
|
package/time/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toMinutes.js"),t=require("./getNextTenthMinute.js"),i=require("./getPrevNthMinute.js"),n=require("./getTimeSpanParts.js"),r=require("./getEndTimeSpanOfTimePeriod.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toMinutes.js"),t=require("./getNextTenthMinute.js"),i=require("./getPrevNthMinute.js"),n=require("./getTimeSpanParts.js"),r=require("./getEndTimeSpanOfTimePeriod.js"),o=require("./createTimeSpan.js"),m=require("./formatTimeSpan.js"),a=require("./getDurationBetweenTimeSpans.js"),T=require("./convertSecondsToTimeSpan.js"),c=require("./convertTimeSpanToSeconds.js");require("moment");exports.toMinutes=e;exports.getNextTenthMinute=t;exports.getPrevNthMinute=i;exports.getTimeSpanParts=n;exports.getEndTimeSpanOfTimePeriod=r;exports.createTimeSpan=o;exports.formatTimeSpan=m;exports.getDurationBetweenTimeSpans=a;exports.convertSecondsToTimeSpan=T;exports.convertTimeSpanToSeconds=c;
|
package/time/index.mjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as o } from "./toMinutes.mjs";
|
|
2
2
|
import { default as f } from "./getNextTenthMinute.mjs";
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
3
|
+
import { default as n } from "./getPrevNthMinute.mjs";
|
|
4
|
+
import { default as s } from "./getTimeSpanParts.mjs";
|
|
5
|
+
import { default as i } from "./getEndTimeSpanOfTimePeriod.mjs";
|
|
6
6
|
import { default as x } from "./createTimeSpan.mjs";
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
7
|
+
import { default as l } from "./formatTimeSpan.mjs";
|
|
8
|
+
import { default as c } from "./getDurationBetweenTimeSpans.mjs";
|
|
9
|
+
import { default as v } from "./convertSecondsToTimeSpan.mjs";
|
|
10
|
+
import { default as P } from "./convertTimeSpanToSeconds.mjs";
|
|
9
11
|
import "moment";
|
|
10
12
|
export {
|
|
13
|
+
v as convertSecondsToTimeSpan,
|
|
14
|
+
P as convertTimeSpanToSeconds,
|
|
11
15
|
x as createTimeSpan,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
l as formatTimeSpan,
|
|
17
|
+
c as getDurationBetweenTimeSpans,
|
|
18
|
+
i as getEndTimeSpanOfTimePeriod,
|
|
15
19
|
f as getNextTenthMinute,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
n as getPrevNthMinute,
|
|
21
|
+
s as getTimeSpanParts,
|
|
22
|
+
o as toMinutes
|
|
19
23
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=require("moment");function u(t){const[e,r,n]=t.split(":");return m().startOf("day").set({hour:Number(e),minute:Number(r),second:Number(n),millisecond:0})}function i(t,e){const[r,n,o]=t.split("-");return u(e).year(Number(r)).month(Number(n)-1).date(Number(o))}module.exports=i;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import o from "moment";
|
|
2
|
-
function u(t) {
|
|
3
|
-
const [e, r, n] = t.split(":");
|
|
4
|
-
return o().startOf("day").set({
|
|
5
|
-
hour: Number(e),
|
|
6
|
-
minute: Number(r),
|
|
7
|
-
second: Number(n),
|
|
8
|
-
millisecond: 0
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
function a(t, e) {
|
|
12
|
-
const [r, n, m] = t.split("-");
|
|
13
|
-
return u(e).year(Number(r)).month(Number(n) - 1).date(Number(m));
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
a as default
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("moment");function n(t){return Math.ceil((t??e()).minutes()/10)*10}module.exports=n;
|