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