@ancon/wildcat-utils 1.44.0-r13-2-tz.18 → 1.44.0-r13-2-tz.19
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.
- package/date/isDSTShiftPresentOnDate.js +1 -1
- package/date/isDSTShiftPresentOnDate.mjs +7 -5
- package/outlet/getServiceIntervalTimeSpanMoment.d.ts +1 -1
- package/outlet/getServiceIntervalTimeSpanMoment.js +1 -1
- package/outlet/getServiceIntervalTimeSpanMoment.mjs +5 -5
- package/outlet/searchNextOpeningMoment.js +1 -1
- package/outlet/searchNextOpeningMoment.mjs +55 -61
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const o=require("moment"),s=require("./isDSTShiftPresentInRange.js");require("./getTimezoneUtcOffsetDifference.js");function a(e){const t=o(e),n=t.startOf("day"),r=t.endOf("day");return console.log("isDSTShiftPresentOnDate",e,t.format(),n.format(),r.format()),s(n,r)}module.exports=a;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import r from "moment";
|
|
2
2
|
import a from "./isDSTShiftPresentInRange.mjs";
|
|
3
3
|
import "./getTimezoneUtcOffsetDifference.mjs";
|
|
4
|
-
function i(
|
|
5
|
-
const t = r(
|
|
4
|
+
function i(n) {
|
|
5
|
+
const t = r(n), o = t.startOf("day"), e = t.endOf("day");
|
|
6
6
|
return console.log(
|
|
7
7
|
"isDSTShiftPresentOnDate",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
n,
|
|
9
|
+
t.format(),
|
|
10
|
+
o.format(),
|
|
11
|
+
e.format()
|
|
12
|
+
), a(o, e);
|
|
11
13
|
}
|
|
12
14
|
export {
|
|
13
15
|
i as default
|
|
@@ -6,4 +6,4 @@ import { Moment, MomentInput } from 'moment';
|
|
|
6
6
|
* @param timeSpan - Service interval time span.
|
|
7
7
|
* @returns The generated Moment object
|
|
8
8
|
*/
|
|
9
|
-
export default function getServiceIntervalTimeSpanMoment(date: MomentInput, timeSpan: string,
|
|
9
|
+
export default function getServiceIntervalTimeSpanMoment(date: MomentInput, timeSpan: string, timezoneOffset?: number): Moment;
|
|
@@ -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),n.hour(t.hours).minute(t.minutes).second(0).millisecond(0)}module.exports=s;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function u(
|
|
4
|
-
const
|
|
5
|
-
return
|
|
1
|
+
import i from "moment";
|
|
2
|
+
import r from "../time/getTimeSpanParts.mjs";
|
|
3
|
+
function u(m, n, t) {
|
|
4
|
+
const e = r(n), o = i(m);
|
|
5
|
+
return t !== void 0 && o.utcOffset(t), o.hour(e.hours).minute(e.minutes).second(0).millisecond(0);
|
|
6
6
|
}
|
|
7
7
|
export {
|
|
8
8
|
u as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const m=require("moment"),y=require("@ancon/wildcat-types"),O=require("../time/getTimeSpanParts.js"),f=require("./constants.js"),u=require("./getServiceIntervalTimeSpanMoment.js");function g(i,n){const e=i.clone().date()-n.date();return e!==0?i.subtract(e,"day"):i}function p(i){let n=null;const{intervals:t,exception:e}=i;if(e){const{state:r}=e;r||(n=e)}else{const r=t.sort((o,s)=>O(o.from).hours-O(s.from).hours),[l]=r;return l}return n}function d(i,n,t){var r,l;const e=[];if(n.exception){if(n.exception.state===y.IntervalState.Opened){const o=u(i,n.exception.from,t.utcOffset());t.isBefore(o)&&e.push({interval:n.exception,moment:o})}}else for(let o=0;o<n.intervals.length;o+=1){const s=n.intervals[o],c=u(i,s.from,t.utcOffset());console.log("relevantMoment",t.format()),console.log("openingMoment",c.format()),t.isBefore(c)&&e.push({interval:s,moment:c})}return e.length<2?((r=e[0])==null?void 0:r.interval)??null:((l=e.sort((o,s)=>o.moment-t-(s.moment-t))[0])==null?void 0:l.interval)??null}function h(i,n){let t=null;const e=m(n).format(f.OutletMapKeyFormatter),r=d(e,i[e],n);if(r&&(t=u(e,r.from)),!t)for(let l=1;l<f.OutletTimelineDayCount;l+=1){const o=m(n).add(l,"d"),s=o.format(f.OutletMapKeyFormatter),c=i[s],a=p(c);if(a){t=u(s,a.from),t=g(t,o);break}}return t}module.exports=h;
|
|
@@ -1,83 +1,77 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from "moment";
|
|
2
2
|
import { IntervalState as p } from "@ancon/wildcat-types";
|
|
3
|
-
import
|
|
3
|
+
import u from "../time/getTimeSpanParts.mjs";
|
|
4
4
|
import { OutletMapKeyFormatter as O, OutletTimelineDayCount as g } from "./constants.mjs";
|
|
5
|
-
import
|
|
6
|
-
function y(
|
|
7
|
-
const
|
|
8
|
-
return
|
|
5
|
+
import a from "./getServiceIntervalTimeSpanMoment.mjs";
|
|
6
|
+
function y(i, n) {
|
|
7
|
+
const e = i.clone().date() - n.date();
|
|
8
|
+
return e !== 0 ? i.subtract(e, "day") : i;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
const { intervals:
|
|
13
|
-
if (
|
|
14
|
-
const { state:
|
|
15
|
-
|
|
10
|
+
function d(i) {
|
|
11
|
+
let n = null;
|
|
12
|
+
const { intervals: t, exception: e } = i;
|
|
13
|
+
if (e) {
|
|
14
|
+
const { state: r } = e;
|
|
15
|
+
r || (n = e);
|
|
16
16
|
} else {
|
|
17
|
-
const
|
|
18
|
-
(o,
|
|
19
|
-
), [
|
|
20
|
-
return
|
|
17
|
+
const r = t.sort(
|
|
18
|
+
(o, f) => u(o.from).hours - u(f.from).hours
|
|
19
|
+
), [s] = r;
|
|
20
|
+
return s;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return n;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
const o =
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
function h(i, n, t) {
|
|
25
|
+
var r, s;
|
|
26
|
+
const e = [];
|
|
27
|
+
if (n.exception) {
|
|
28
|
+
if (n.exception.state === p.Opened) {
|
|
29
|
+
const o = a(
|
|
30
|
+
i,
|
|
31
|
+
n.exception.from,
|
|
32
|
+
t.utcOffset()
|
|
32
33
|
);
|
|
33
|
-
|
|
34
|
-
interval:
|
|
34
|
+
t.isBefore(o) && e.push({
|
|
35
|
+
interval: n.exception,
|
|
35
36
|
moment: o
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
} else
|
|
39
|
-
for (let o = 0; o <
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
for (let o = 0; o < n.intervals.length; o += 1) {
|
|
41
|
+
const f = n.intervals[o], l = a(
|
|
42
|
+
i,
|
|
43
|
+
f.from,
|
|
44
|
+
t.utcOffset()
|
|
43
45
|
);
|
|
44
|
-
console.log("relevantMoment",
|
|
45
|
-
"openingMoment",
|
|
46
|
-
s.format(),
|
|
47
|
-
c(
|
|
48
|
-
r,
|
|
49
|
-
i.from,
|
|
50
|
-
u().utcOffset()
|
|
51
|
-
).format()
|
|
52
|
-
), n.clone().utc(!0).isBefore(s.clone().utc(!0)) && t.push({ interval: i, moment: s });
|
|
46
|
+
console.log("relevantMoment", t.format()), console.log("openingMoment", l.format()), t.isBefore(l) && e.push({ interval: f, moment: l });
|
|
53
47
|
}
|
|
54
|
-
return
|
|
48
|
+
return e.length < 2 ? ((r = e[0]) == null ? void 0 : r.interval) ?? null : ((s = e.sort(
|
|
55
49
|
// @ts-ignore TODO
|
|
56
|
-
(o,
|
|
57
|
-
)[0]) == null ? void 0 :
|
|
50
|
+
(o, f) => o.moment - t - (f.moment - t)
|
|
51
|
+
)[0]) == null ? void 0 : s.interval) ?? null;
|
|
58
52
|
}
|
|
59
|
-
function S(
|
|
60
|
-
let
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
function S(i, n) {
|
|
54
|
+
let t = null;
|
|
55
|
+
const e = m(n).format(O), r = h(
|
|
56
|
+
e,
|
|
57
|
+
i[e],
|
|
58
|
+
n
|
|
65
59
|
);
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
)), !
|
|
70
|
-
for (let
|
|
71
|
-
const o =
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
),
|
|
60
|
+
if (r && (t = a(
|
|
61
|
+
e,
|
|
62
|
+
r.from
|
|
63
|
+
)), !t)
|
|
64
|
+
for (let s = 1; s < g; s += 1) {
|
|
65
|
+
const o = m(n).add(s, "d"), f = o.format(O), l = i[f], c = d(l);
|
|
66
|
+
if (c) {
|
|
67
|
+
t = a(
|
|
68
|
+
f,
|
|
69
|
+
c.from
|
|
70
|
+
), t = y(t, o);
|
|
77
71
|
break;
|
|
78
72
|
}
|
|
79
73
|
}
|
|
80
|
-
return
|
|
74
|
+
return t;
|
|
81
75
|
}
|
|
82
76
|
export {
|
|
83
77
|
S as default
|