@ancon/wildcat-utils 1.44.0-r13-2-tz.45 → 1.44.0-r13-2-tz.46
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/date/convertToLocalTimezone.js +1 -1
- package/date/convertToLocalTimezone.mjs +1 -1
- package/date/convertToSpecificTimezone.d.ts +2 -0
- package/date/convertToSpecificTimezone.js +1 -0
- package/date/convertToSpecificTimezone.mjs +8 -0
- package/index.js +1 -1
- package/index.mjs +332 -331
- package/outlet/getOutletCurrentActiveOperatingHour.js +1 -1
- package/outlet/getOutletCurrentActiveOperatingHour.mjs +34 -21
- package/outlet/getOutletCurrentAvailabilityInfo.js +1 -1
- package/outlet/getOutletCurrentAvailabilityInfo.mjs +1 -1
- package/outlet/getOutletNextOpeningTagInformation.js +1 -1
- package/outlet/getOutletNextOpeningTagInformation.mjs +1 -1
- package/outlet/getOutletNextOpeningTimeText.js +1 -1
- package/outlet/getOutletNextOpeningTimeText.mjs +1 -1
- package/outlet/getOutletNextReadyToOrderTime.js +1 -1
- package/outlet/getOutletNextReadyToOrderTime.mjs +7 -6
- package/outlet/getOutletPickerTimesForDay.js +1 -1
- package/outlet/getOutletPickerTimesForDay.mjs +3 -2
- package/outlet/getOutletPickerTimesForWeek.js +1 -1
- package/outlet/getOutletPickerTimesForWeek.mjs +3 -2
- package/outlet/getOutletTagInformation.js +1 -1
- package/outlet/getOutletTagInformation.mjs +1 -1
- package/outlet/getServiceIntervalTimeSpanMoment.d.ts +1 -1
- package/outlet/getServiceIntervalTimeSpanMoment.js +1 -1
- package/outlet/getServiceIntervalTimeSpanMoment.mjs +5 -5
- package/outlet/index.js +1 -1
- package/outlet/index.mjs +66 -65
- package/outlet/searchNextOpeningMoment.js +1 -1
- package/outlet/searchNextOpeningMoment.mjs +50 -42
- package/package.json +6 -1
|
@@ -1,76 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IntervalState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { OutletMapKeyFormatter as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
1
|
+
import c from "moment";
|
|
2
|
+
import { IntervalState as g } from "@ancon/wildcat-types";
|
|
3
|
+
import p from "../time/getTimeSpanParts.mjs";
|
|
4
|
+
import m from "../date/convertToSpecificTimezone.mjs";
|
|
5
|
+
import { OutletMapKeyFormatter as O, OutletTimelineDayCount as y } from "./constants.mjs";
|
|
6
|
+
import u from "./getServiceIntervalTimeSpanMoment.mjs";
|
|
7
|
+
function x(l) {
|
|
8
8
|
let e = null;
|
|
9
|
-
const { intervals: t, exception:
|
|
10
|
-
if (
|
|
11
|
-
const { state: i } =
|
|
12
|
-
i || (e =
|
|
9
|
+
const { intervals: t, exception: n } = l;
|
|
10
|
+
if (n) {
|
|
11
|
+
const { state: i } = n;
|
|
12
|
+
i || (e = n);
|
|
13
13
|
} else {
|
|
14
14
|
const i = t.sort(
|
|
15
|
-
(
|
|
15
|
+
(o, r) => p(o.from).hours - p(r.from).hours
|
|
16
16
|
), [f] = i;
|
|
17
17
|
return f;
|
|
18
18
|
}
|
|
19
19
|
return e;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function D(l, e, t) {
|
|
22
22
|
var i, f;
|
|
23
|
-
const
|
|
23
|
+
const n = [];
|
|
24
24
|
if (e.exception) {
|
|
25
|
-
if (e.exception.state ===
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
if (e.exception.state === g.Opened) {
|
|
26
|
+
let o = u(
|
|
27
|
+
l,
|
|
28
28
|
e.exception.from
|
|
29
|
-
// relevantMoment.utcOffset(),
|
|
30
29
|
);
|
|
31
|
-
|
|
30
|
+
o = m(
|
|
31
|
+
o,
|
|
32
|
+
t.utcOffset(),
|
|
33
|
+
!0
|
|
34
|
+
), t.isBefore(o) && n.push({
|
|
32
35
|
interval: e.exception,
|
|
33
|
-
moment:
|
|
36
|
+
moment: o
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
} else
|
|
37
|
-
for (let
|
|
38
|
-
const r = e.intervals[
|
|
39
|
-
|
|
40
|
+
for (let o = 0; o < e.intervals.length; o += 1) {
|
|
41
|
+
const r = e.intervals[o];
|
|
42
|
+
let s = u(
|
|
43
|
+
l,
|
|
40
44
|
r.from
|
|
41
45
|
);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
s = m(
|
|
47
|
+
s,
|
|
48
|
+
t.utcOffset(),
|
|
49
|
+
!0
|
|
50
|
+
), console.log("relevantMoment", t.format()), console.log("openingMoment", s.format()), t.isBefore(s) && n.push({ interval: r, moment: s });
|
|
46
51
|
}
|
|
47
|
-
return
|
|
52
|
+
return n.length < 2 ? ((i = n[0]) == null ? void 0 : i.interval) ?? null : ((f = n.sort(
|
|
48
53
|
// @ts-ignore TODO
|
|
49
|
-
(
|
|
54
|
+
(o, r) => o.moment - t - (r.moment - t)
|
|
50
55
|
)[0]) == null ? void 0 : f.interval) ?? null;
|
|
51
56
|
}
|
|
52
|
-
function
|
|
57
|
+
function K(l, e) {
|
|
53
58
|
let t = null;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
const n = c(e).format(O), i = D(
|
|
60
|
+
n,
|
|
61
|
+
l[n],
|
|
57
62
|
e
|
|
58
63
|
);
|
|
59
64
|
if (console.log(
|
|
60
65
|
"initialDayOperatingHour",
|
|
61
66
|
i,
|
|
62
67
|
e.format()
|
|
63
|
-
), i && (t =
|
|
64
|
-
|
|
68
|
+
), i && (t = u(
|
|
69
|
+
n,
|
|
65
70
|
i.from
|
|
66
|
-
|
|
67
|
-
)), console.log("initialDayOperatingHour", t == null ? void 0 : t.format()), !t)
|
|
71
|
+
), t = m(t, e.utcOffset(), !0)), console.log("initialDayOperatingHour", t == null ? void 0 : t.format()), !t)
|
|
68
72
|
for (let f = 1; f < y; f += 1) {
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
t =
|
|
73
|
+
const o = c(e).add(f, "d"), r = o.format(O), s = l[r], a = x(s);
|
|
74
|
+
if (a) {
|
|
75
|
+
t = u(
|
|
72
76
|
r,
|
|
73
|
-
|
|
77
|
+
a.from
|
|
78
|
+
), t = m(
|
|
79
|
+
t,
|
|
80
|
+
o.utcOffset(),
|
|
81
|
+
!0
|
|
74
82
|
);
|
|
75
83
|
break;
|
|
76
84
|
}
|
|
@@ -78,5 +86,5 @@ function S(s, e) {
|
|
|
78
86
|
return t;
|
|
79
87
|
}
|
|
80
88
|
export {
|
|
81
|
-
|
|
89
|
+
K as default
|
|
82
90
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.44.0-r13-2-tz.
|
|
3
|
+
"version": "1.44.0-r13-2-tz.46",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -306,6 +306,11 @@
|
|
|
306
306
|
"require": "./date/convertToLocalTimezone.js",
|
|
307
307
|
"types": "./date/convertToLocalTimezone.d.ts"
|
|
308
308
|
},
|
|
309
|
+
"./date/convertToSpecificTimezone": {
|
|
310
|
+
"import": "./date/convertToSpecificTimezone.mjs",
|
|
311
|
+
"require": "./date/convertToSpecificTimezone.js",
|
|
312
|
+
"types": "./date/convertToSpecificTimezone.d.ts"
|
|
313
|
+
},
|
|
309
314
|
"./date/createLocalTimezoneDate": {
|
|
310
315
|
"import": "./date/createLocalTimezoneDate.mjs",
|
|
311
316
|
"require": "./date/createLocalTimezoneDate.js",
|