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