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