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