@ancon/wildcat-utils 1.44.0-r13-2-tz.45 → 1.44.0-r13-2-tz.46

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.
Files changed (31) hide show
  1. package/date/convertToLocalTimezone.js +1 -1
  2. package/date/convertToLocalTimezone.mjs +1 -1
  3. package/date/convertToSpecificTimezone.d.ts +2 -0
  4. package/date/convertToSpecificTimezone.js +1 -0
  5. package/date/convertToSpecificTimezone.mjs +8 -0
  6. package/index.js +1 -1
  7. package/index.mjs +332 -331
  8. package/outlet/getOutletCurrentActiveOperatingHour.js +1 -1
  9. package/outlet/getOutletCurrentActiveOperatingHour.mjs +34 -21
  10. package/outlet/getOutletCurrentAvailabilityInfo.js +1 -1
  11. package/outlet/getOutletCurrentAvailabilityInfo.mjs +1 -1
  12. package/outlet/getOutletNextOpeningTagInformation.js +1 -1
  13. package/outlet/getOutletNextOpeningTagInformation.mjs +1 -1
  14. package/outlet/getOutletNextOpeningTimeText.js +1 -1
  15. package/outlet/getOutletNextOpeningTimeText.mjs +1 -1
  16. package/outlet/getOutletNextReadyToOrderTime.js +1 -1
  17. package/outlet/getOutletNextReadyToOrderTime.mjs +7 -6
  18. package/outlet/getOutletPickerTimesForDay.js +1 -1
  19. package/outlet/getOutletPickerTimesForDay.mjs +3 -2
  20. package/outlet/getOutletPickerTimesForWeek.js +1 -1
  21. package/outlet/getOutletPickerTimesForWeek.mjs +3 -2
  22. package/outlet/getOutletTagInformation.js +1 -1
  23. package/outlet/getOutletTagInformation.mjs +1 -1
  24. package/outlet/getServiceIntervalTimeSpanMoment.d.ts +1 -1
  25. package/outlet/getServiceIntervalTimeSpanMoment.js +1 -1
  26. package/outlet/getServiceIntervalTimeSpanMoment.mjs +5 -5
  27. package/outlet/index.js +1 -1
  28. package/outlet/index.mjs +66 -65
  29. package/outlet/searchNextOpeningMoment.js +1 -1
  30. package/outlet/searchNextOpeningMoment.mjs +50 -42
  31. package/package.json +6 -1
@@ -1,76 +1,84 @@
1
- import a from "moment";
2
- import { IntervalState as p } from "@ancon/wildcat-types";
3
- import u from "../time/getTimeSpanParts.mjs";
4
- import O from "../date/getTimezoneUtcOffsetDifference.mjs";
5
- import { OutletMapKeyFormatter as g, OutletTimelineDayCount as y } from "./constants.mjs";
6
- import c from "./getServiceIntervalTimeSpanMoment.mjs";
7
- function D(s) {
1
+ import c from "moment";
2
+ import { IntervalState as g } from "@ancon/wildcat-types";
3
+ import p from "../time/getTimeSpanParts.mjs";
4
+ import m from "../date/convertToSpecificTimezone.mjs";
5
+ import { OutletMapKeyFormatter as O, OutletTimelineDayCount as y } from "./constants.mjs";
6
+ import u from "./getServiceIntervalTimeSpanMoment.mjs";
7
+ function x(l) {
8
8
  let e = null;
9
- const { intervals: t, exception: o } = s;
10
- if (o) {
11
- const { state: i } = o;
12
- i || (e = o);
9
+ const { intervals: t, exception: n } = l;
10
+ if (n) {
11
+ const { state: i } = n;
12
+ i || (e = n);
13
13
  } else {
14
14
  const i = t.sort(
15
- (n, r) => u(n.from).hours - u(r.from).hours
15
+ (o, r) => p(o.from).hours - p(r.from).hours
16
16
  ), [f] = i;
17
17
  return f;
18
18
  }
19
19
  return e;
20
20
  }
21
- function h(s, e, t) {
21
+ function D(l, e, t) {
22
22
  var i, f;
23
- const o = [];
23
+ const n = [];
24
24
  if (e.exception) {
25
- if (e.exception.state === p.Opened) {
26
- const n = c(
27
- s,
25
+ if (e.exception.state === g.Opened) {
26
+ let o = u(
27
+ l,
28
28
  e.exception.from
29
- // relevantMoment.utcOffset(),
30
29
  );
31
- t.isBefore(n) && o.push({
30
+ o = m(
31
+ o,
32
+ t.utcOffset(),
33
+ !0
34
+ ), t.isBefore(o) && n.push({
32
35
  interval: e.exception,
33
- moment: n
36
+ moment: o
34
37
  });
35
38
  }
36
39
  } else
37
- for (let n = 0; n < e.intervals.length; n += 1) {
38
- const r = e.intervals[n], l = c(
39
- s,
40
+ for (let o = 0; o < e.intervals.length; o += 1) {
41
+ const r = e.intervals[o];
42
+ let s = u(
43
+ l,
40
44
  r.from
41
45
  );
42
- O(
43
- t,
44
- l
45
- ) && (console.log("offset changed"), l.utcOffset(t.utcOffset(), !0)), console.log("relevantMoment", t.format()), console.log("openingMoment", l.format()), t.isBefore(l) && o.push({ interval: r, moment: l });
46
+ s = m(
47
+ s,
48
+ t.utcOffset(),
49
+ !0
50
+ ), console.log("relevantMoment", t.format()), console.log("openingMoment", s.format()), t.isBefore(s) && n.push({ interval: r, moment: s });
46
51
  }
47
- return o.length < 2 ? ((i = o[0]) == null ? void 0 : i.interval) ?? null : ((f = o.sort(
52
+ return n.length < 2 ? ((i = n[0]) == null ? void 0 : i.interval) ?? null : ((f = n.sort(
48
53
  // @ts-ignore TODO
49
- (n, r) => n.moment - t - (r.moment - t)
54
+ (o, r) => o.moment - t - (r.moment - t)
50
55
  )[0]) == null ? void 0 : f.interval) ?? null;
51
56
  }
52
- function S(s, e) {
57
+ function K(l, e) {
53
58
  let t = null;
54
- const o = a(e).format(g), i = h(
55
- o,
56
- s[o],
59
+ const n = c(e).format(O), i = D(
60
+ n,
61
+ l[n],
57
62
  e
58
63
  );
59
64
  if (console.log(
60
65
  "initialDayOperatingHour",
61
66
  i,
62
67
  e.format()
63
- ), i && (t = c(
64
- o,
68
+ ), i && (t = u(
69
+ n,
65
70
  i.from
66
- // relevantMoment.utcOffset(),
67
- )), console.log("initialDayOperatingHour", t == null ? void 0 : t.format()), !t)
71
+ ), t = m(t, e.utcOffset(), !0)), console.log("initialDayOperatingHour", t == null ? void 0 : t.format()), !t)
68
72
  for (let f = 1; f < y; f += 1) {
69
- const r = a(e).add(f, "d").format(g), l = s[r], m = D(l);
70
- if (m) {
71
- t = c(
73
+ const o = c(e).add(f, "d"), r = o.format(O), s = l[r], a = x(s);
74
+ if (a) {
75
+ t = u(
72
76
  r,
73
- m.from
77
+ a.from
78
+ ), t = m(
79
+ t,
80
+ o.utcOffset(),
81
+ !0
74
82
  );
75
83
  break;
76
84
  }
@@ -78,5 +86,5 @@ function S(s, e) {
78
86
  return t;
79
87
  }
80
88
  export {
81
- S as default
89
+ K as default
82
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.44.0-r13-2-tz.45",
3
+ "version": "1.44.0-r13-2-tz.46",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -306,6 +306,11 @@
306
306
  "require": "./date/convertToLocalTimezone.js",
307
307
  "types": "./date/convertToLocalTimezone.d.ts"
308
308
  },
309
+ "./date/convertToSpecificTimezone": {
310
+ "import": "./date/convertToSpecificTimezone.mjs",
311
+ "require": "./date/convertToSpecificTimezone.js",
312
+ "types": "./date/convertToSpecificTimezone.d.ts"
313
+ },
309
314
  "./date/createLocalTimezoneDate": {
310
315
  "import": "./date/createLocalTimezoneDate.mjs",
311
316
  "require": "./date/createLocalTimezoneDate.js",