@ancon/wildcat-utils 1.44.0-r13-2-tz.27 → 1.44.0-r13-2-tz.28
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=require("@ancon/wildcat-types"),
|
|
1
|
+
"use strict";const p=require("@ancon/wildcat-types"),l=require("moment"),y=require("../date/isDSTShiftPresentInRange.js"),D=require("./getPickerIntervalsForDay.js"),P=require("./getSettingsForOrderFormat.js"),_=require("./getServiceIntervalStart.js"),h=require("./types.js"),x=require("./generatePickerTimesForDay.js"),I=require("./getServiceIntervalEnd.js"),R=require("./getOutletNextReadyToOrderTime.js");require("../date/getTimezoneUtcOffsetDifference.js");require("../shared/constants.js");require("../date/createLocalTimezoneMoment.js");require("./getServiceIntervalsForOrderFormat.js");require("../time/getTimeSpanParts.js");require("./getNextTenthMinute.js");require("./getServiceIntervalTimeSpanMoment.js");require("./hoursAndMinutesToMinutes.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");function z(s,d,O,k){const{preparationTime:T="00:00:00"}=P(d,s==null?void 0:s.orderFormatSettings)??{},i=R(s,d);console.log("nextReadyOrderTime",i.format());let f=i.clone();const c=l(O);if(c>i)f=i.clone().set({year:c.year(),month:c.month(),date:c.date()});else if(i.diff(c,"day")>0)return[];let e=[];const v=D(f,s==null?void 0:s.serviceDateTimes,d);let g;if(v.forEach(t=>{!g&&t.type&&(e=[]);const r=_(f,t,T),u=I(f,t,T);console.log("intervalStartTime, intervalEndTime",r.format(),u.format()),r<i&&(console.log("Add the time that has already passed today"),r.add(i.valueOf()-r.valueOf(),"millisecond"));const n=x(r,u,e,void 0,k);if(n.length>0)switch(t.state){case p.IntervalState.Closed:{const a=n[0],m=n[n.length-1];e=e.filter(({timestamp:o})=>o<a.timestamp||o>m.timestamp);break}case p.IntervalState.Opened:default:{let a=n;const m=y(r,u);console.log("isDSTShiftInterval",m),m&&(a=n.filter(o=>{const q=l(o.timestamp).utc(!0),S=i.clone().utc(!0);return console.log("=>",q.format(),S.format()),q.isSameOrAfter(S)})),e=e.concat(a);break}}g=t.type}),e.length){const t=e[0],r=e[e.length-1];if(y(t.timestamp,r.timestamp)){const n=Math.max(l(t.timestamp).utcOffset(),l(r.timestamp).utcOffset());return e.map(a=>{const o=l(a.timestamp).utcOffset()===n?h.PickerTimeTimezoneTag.Summer:h.PickerTimeTimezoneTag.Standard;return{...a,timezoneTag:o}})}}return e}module.exports=z;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntervalState as y } from "@ancon/wildcat-types";
|
|
2
|
-
import
|
|
2
|
+
import c from "moment";
|
|
3
3
|
import O from "../date/isDSTShiftPresentInRange.mjs";
|
|
4
4
|
import P from "./getPickerIntervalsForDay.mjs";
|
|
5
5
|
import x from "./getSettingsForOrderFormat.mjs";
|
|
@@ -22,13 +22,13 @@ import "./constants.mjs";
|
|
|
22
22
|
import "./getOutletCurrentActiveOperatingHour.mjs";
|
|
23
23
|
import "./searchNextOpeningMoment.mjs";
|
|
24
24
|
import "./getOutletNextServiceTimeOffset.mjs";
|
|
25
|
-
function tt(o,
|
|
26
|
-
const { preparationTime: T = "00:00:00" } = x(
|
|
25
|
+
function tt(o, d, u, v) {
|
|
26
|
+
const { preparationTime: T = "00:00:00" } = x(d, o == null ? void 0 : o.orderFormatSettings) ?? {}, r = F(o, d);
|
|
27
27
|
console.log("nextReadyOrderTime", r.format());
|
|
28
|
-
let
|
|
29
|
-
const s =
|
|
28
|
+
let p = r.clone();
|
|
29
|
+
const s = c(u);
|
|
30
30
|
if (s > r)
|
|
31
|
-
|
|
31
|
+
p = r.clone().set({
|
|
32
32
|
year: s.year(),
|
|
33
33
|
month: s.month(),
|
|
34
34
|
date: s.date()
|
|
@@ -37,33 +37,33 @@ function tt(o, l, u, v) {
|
|
|
37
37
|
return [];
|
|
38
38
|
let t = [];
|
|
39
39
|
const D = P(
|
|
40
|
-
|
|
40
|
+
p,
|
|
41
41
|
o == null ? void 0 : o.serviceDateTimes,
|
|
42
|
-
|
|
42
|
+
d
|
|
43
43
|
);
|
|
44
|
-
let
|
|
44
|
+
let g;
|
|
45
45
|
if (D.forEach((e) => {
|
|
46
|
-
!
|
|
46
|
+
!g && e.type && (t = []);
|
|
47
47
|
const i = I(
|
|
48
|
-
|
|
48
|
+
p,
|
|
49
49
|
e,
|
|
50
50
|
T
|
|
51
|
-
),
|
|
52
|
-
|
|
51
|
+
), l = E(
|
|
52
|
+
p,
|
|
53
53
|
e,
|
|
54
54
|
T
|
|
55
55
|
);
|
|
56
56
|
console.log(
|
|
57
57
|
"intervalStartTime, intervalEndTime",
|
|
58
58
|
i.format(),
|
|
59
|
-
|
|
59
|
+
l.format()
|
|
60
60
|
), i < r && (console.log("Add the time that has already passed today"), i.add(
|
|
61
61
|
r.valueOf() - i.valueOf(),
|
|
62
62
|
"millisecond"
|
|
63
63
|
));
|
|
64
64
|
const m = R(
|
|
65
65
|
i,
|
|
66
|
-
|
|
66
|
+
l,
|
|
67
67
|
t,
|
|
68
68
|
void 0,
|
|
69
69
|
v
|
|
@@ -71,30 +71,31 @@ function tt(o, l, u, v) {
|
|
|
71
71
|
if (m.length > 0)
|
|
72
72
|
switch (e.state) {
|
|
73
73
|
case y.Closed: {
|
|
74
|
-
const
|
|
74
|
+
const n = m[0], f = m[m.length - 1];
|
|
75
75
|
t = t.filter(
|
|
76
|
-
({ timestamp:
|
|
76
|
+
({ timestamp: a }) => a < n.timestamp || a > f.timestamp
|
|
77
77
|
);
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
80
|
case y.Opened:
|
|
81
81
|
default: {
|
|
82
|
-
let
|
|
83
|
-
O(
|
|
82
|
+
let n = m;
|
|
83
|
+
const f = O(
|
|
84
84
|
i,
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
|
|
85
|
+
l
|
|
86
|
+
);
|
|
87
|
+
console.log("isDSTShiftInterval", f), f && (n = m.filter((a) => {
|
|
88
|
+
const S = c(a.timestamp).utc(!0), h = r.clone().utc(!0);
|
|
88
89
|
return console.log(
|
|
89
90
|
"=>",
|
|
90
|
-
|
|
91
|
+
S.format(),
|
|
91
92
|
h.format()
|
|
92
|
-
),
|
|
93
|
-
})), t = t.concat(
|
|
93
|
+
), S.isSameOrAfter(h);
|
|
94
|
+
})), t = t.concat(n);
|
|
94
95
|
break;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
g = e.type;
|
|
98
99
|
}), t.length) {
|
|
99
100
|
const e = t[0], i = t[t.length - 1];
|
|
100
101
|
if (O(
|
|
@@ -102,12 +103,12 @@ function tt(o, l, u, v) {
|
|
|
102
103
|
i.timestamp
|
|
103
104
|
)) {
|
|
104
105
|
const m = Math.max(
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
c(e.timestamp).utcOffset(),
|
|
107
|
+
c(i.timestamp).utcOffset()
|
|
107
108
|
);
|
|
108
|
-
return t.map((
|
|
109
|
-
const
|
|
110
|
-
return { ...
|
|
109
|
+
return t.map((n) => {
|
|
110
|
+
const a = c(n.timestamp).utcOffset() === m ? k.Summer : k.Standard;
|
|
111
|
+
return { ...n, timezoneTag: a };
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
}
|