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