qrono 1.2.1 → 1.4.0

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/dist/qrono.js CHANGED
@@ -1,38 +1,38 @@
1
- var rt = Object.defineProperty;
2
- var K = Object.getOwnPropertySymbols;
3
- var st = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable;
4
- var V = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, k = (t, e) => {
1
+ var st = Object.defineProperty;
2
+ var Q = Object.getOwnPropertySymbols;
3
+ var rt = Object.prototype.hasOwnProperty, at = Object.prototype.propertyIsEnumerable;
4
+ var G = (t, e, n) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, F = (t, e) => {
5
5
  for (var n in e || (e = {}))
6
- st.call(e, n) && V(t, n, e[n]);
7
- if (K)
8
- for (var n of K(e))
9
- at.call(e, n) && V(t, n, e[n]);
6
+ rt.call(e, n) && G(t, n, e[n]);
7
+ if (Q)
8
+ for (var n of Q(e))
9
+ at.call(e, n) && G(t, n, e[n]);
10
10
  return t;
11
11
  };
12
- const ut = new Date(1915, 0, 1, 12, 0, 0, 0), T = 7, _ = 24, v = 60, N = v * _, J = 60, ct = J * v, ft = ct * _, X = 1e3, ht = J * X, U = ft * X;
13
- function D(t, ...e) {
12
+ const ut = new Date(1915, 0, 1, 12, 0, 0, 0), w = 7, K = 24, M = 60, C = M * K, V = 60, ct = V * M, ft = ct * K, J = 1e3, lt = V * J, X = ft * J;
13
+ function g(t, ...e) {
14
14
  return e.flat().some(t.hasOwnProperty, t);
15
15
  }
16
- function F(t) {
17
- return Object.entries(t).filter(([, e]) => !lt(e)).map(([e]) => e);
16
+ function ht(t) {
17
+ return Object.entries(t).filter(([, e]) => !dt(e)).map(([e]) => e);
18
18
  }
19
- function w(t) {
19
+ function Y(t) {
20
20
  return t !== void 0;
21
21
  }
22
- function lt(t) {
22
+ function dt(t) {
23
23
  return t instanceof Function;
24
24
  }
25
25
  function mt(t) {
26
26
  return typeof t == "string" || t instanceof String;
27
27
  }
28
- function S(t) {
28
+ function T(t) {
29
29
  return t !== null && typeof t == "object" && t.constructor === Object;
30
30
  }
31
- function tt(t) {
31
+ function _(t) {
32
32
  return !Number.isNaN(t.getTime());
33
33
  }
34
- function Y(t) {
35
- return D(t, [
34
+ function S(t) {
35
+ return g(t, [
36
36
  "year",
37
37
  "month",
38
38
  "day",
@@ -42,45 +42,35 @@ function Y(t) {
42
42
  "millisecond"
43
43
  ]);
44
44
  }
45
- const C = o;
46
- o.date = a;
47
- const d = {
45
+ const I = s;
46
+ s.date = u;
47
+ const v = {
48
48
  localtime: !1,
49
49
  disambiguation: "compatible"
50
50
  };
51
- for (const t of F(d))
52
- o[t] = function(e) {
53
- return w(e) ? (d[t] = e, this) : d[t];
54
- };
55
- o.context = function(t) {
56
- if (w(t)) {
57
- for (const e of F(d))
58
- D(t, e) && (d[e] = t[e]);
51
+ s.context = function(t) {
52
+ if (Y(t)) {
53
+ for (const e of ht(v))
54
+ g(t, e) && (v[e] = t[e]);
59
55
  return this;
60
56
  }
61
- return k({}, d);
62
- };
63
- o.asUtc = function() {
64
- return d.localtime = !1, this;
57
+ return F({}, v);
65
58
  };
66
- o.asLocaltime = function() {
67
- return d.localtime = !0, this;
68
- };
69
- const yt = 1, dt = 2, et = 3, M = 4, pt = 5, Dt = 6, gt = 7;
70
- Object.assign(o, {
59
+ const yt = 1, pt = 2, tt = 3, b = 4, Dt = 5, gt = 6, Ot = 7;
60
+ Object.assign(s, {
71
61
  monday: yt,
72
- tuesday: dt,
73
- wednesday: et,
74
- thursday: M,
75
- friday: pt,
76
- saturday: Dt,
77
- sunday: gt
62
+ tuesday: pt,
63
+ wednesday: tt,
64
+ thursday: b,
65
+ friday: Dt,
66
+ saturday: gt,
67
+ sunday: Ot
78
68
  });
79
- const c = /* @__PURE__ */ Symbol();
80
- function o(...t) {
81
- var s;
69
+ const f = /* @__PURE__ */ Symbol();
70
+ function s(...t) {
71
+ var r;
82
72
  if (!new.target)
83
- return new o(...t);
73
+ return new s(...t);
84
74
  const e = {
85
75
  // properties
86
76
  nativeDate: null,
@@ -88,181 +78,167 @@ function o(...t) {
88
78
  disambiguation: "compatible",
89
79
  // methods
90
80
  set: Mt,
91
- parse: vt,
92
- valid: Ot,
81
+ parse: St,
82
+ valid: bt,
93
83
  context: wt,
94
- getNative: bt
84
+ getNative: vt
95
85
  };
96
- if (this[c] = e, e.context(d), t[0] instanceof o) {
97
- const r = t.shift();
98
- for (const i of F(e))
99
- e[i] = r[i]();
86
+ if (this[f] = e, e.context(v), t[0] instanceof s) {
87
+ const i = t.shift();
88
+ e.nativeDate = i.nativeDate(), e.context(i.context());
100
89
  }
101
- S(t[0]) && !Y(t[0]) && e.context(t.shift());
102
- const n = t[0], u = t[1];
90
+ T(t[0]) && !S(t[0]) && e.context(t.shift());
91
+ const n = t[0], a = t[1];
103
92
  if (n == null)
104
- (s = e.nativeDate) != null || (e.nativeDate = /* @__PURE__ */ new Date());
93
+ (r = e.nativeDate) != null || (e.nativeDate = /* @__PURE__ */ new Date());
105
94
  else if (n instanceof Date)
106
95
  e.nativeDate = new Date(n.getTime());
107
96
  else if (mt(n))
108
97
  e.parse(n);
109
- else if (S(n)) {
110
- if (!Y(n))
98
+ else if (T(n)) {
99
+ if (!S(n))
111
100
  throw RangeError(
112
101
  "Missing time field (year, minute, day, hour, minute, second or millisecond)"
113
102
  );
114
103
  e.set(n);
115
- } else if (Number.isFinite(n) && !Number.isFinite(u))
104
+ } else if (Number.isFinite(n) && !Number.isFinite(a))
116
105
  e.nativeDate = new Date(n);
117
106
  else if (Number.isFinite(n) || Array.isArray(n)) {
118
- const r = t.flat(), i = r.filter((m) => Number.isSafeInteger(m));
119
- if (i.length !== r.length)
107
+ const i = t.flat(), o = i.filter((h) => Number.isSafeInteger(h));
108
+ if (o.length !== i.length)
120
109
  throw RangeError("Should be safe integers");
121
- if (i.length > 7)
110
+ if (o.length > 7)
122
111
  throw RangeError("Too many numbers");
123
112
  e.set({
124
- year: i[0],
125
- month: i[1],
126
- day: i[2],
127
- hour: i[3],
128
- minute: i[4],
129
- second: i[5],
130
- millisecond: i[6]
113
+ year: o[0],
114
+ month: o[1],
115
+ day: o[2],
116
+ hour: o[3],
117
+ minute: o[4],
118
+ second: o[5],
119
+ millisecond: o[6]
131
120
  });
132
121
  } else
133
122
  throw TypeError(`Invalid argument ${t}`);
134
123
  return this;
135
124
  }
136
- function Ot() {
137
- return tt(this.nativeDate);
125
+ function bt() {
126
+ return _(this.nativeDate);
138
127
  }
139
128
  function wt(t) {
140
- if (t) {
141
- for (const e of F(d))
142
- D(t, e) && (this[e] = t[e]);
143
- return this;
144
- }
129
+ return t ? ("localtime" in t && (this.localtime = t.localtime), "disambiguation" in t && (this.disambiguation = t.disambiguation), this) : { localtime: this.localtime, disambiguation: this.disambiguation };
145
130
  }
146
- function bt(t) {
131
+ function vt(t) {
147
132
  return this.nativeDate[`get${this.localtime ? "" : "UTC"}${t}`]();
148
133
  }
149
134
  function Mt(t) {
150
- var A, H, I, E, R, P, W, j, x, L, B, z, q, Z, Q, G;
151
- const e = k({}, t);
135
+ var N, k, H, U, E, A, R, P, x, W, j, L, z, q, B, Z;
136
+ const e = F({}, t);
152
137
  if (e.month = e.month && e.month - 1, !this.localtime) {
153
- const O = (A = this.nativeDate) != null ? A : /* @__PURE__ */ new Date(0), $ = /* @__PURE__ */ new Date(0);
138
+ const D = (N = this.nativeDate) != null ? N : /* @__PURE__ */ new Date(0), $ = /* @__PURE__ */ new Date(0);
154
139
  return $.setUTCFullYear(
155
- (H = e.year) != null ? H : O.getUTCFullYear(),
156
- (I = e.month) != null ? I : O.getUTCMonth(),
157
- (E = e.day) != null ? E : O.getUTCDate()
140
+ (k = e.year) != null ? k : D.getUTCFullYear(),
141
+ (H = e.month) != null ? H : D.getUTCMonth(),
142
+ (U = e.day) != null ? U : D.getUTCDate()
158
143
  ), $.setUTCHours(
159
- (R = e.hour) != null ? R : O.getUTCHours(),
160
- (P = e.minute) != null ? P : O.getUTCMinutes(),
161
- (W = e.second) != null ? W : O.getUTCSeconds(),
162
- (j = e.millisecond) != null ? j : O.getUTCMilliseconds()
144
+ (E = e.hour) != null ? E : D.getUTCHours(),
145
+ (A = e.minute) != null ? A : D.getUTCMinutes(),
146
+ (R = e.second) != null ? R : D.getUTCSeconds(),
147
+ (P = e.millisecond) != null ? P : D.getUTCMilliseconds()
163
148
  ), this.nativeDate = $, this;
164
149
  }
165
- const n = !D(t, "hour", "minute", "second", "millisecond"), u = n ? "later" : this.disambiguation, s = (x = this.nativeDate) != null ? x : new Date(0, 0), r = new Date(ut.getTime()), i = {
166
- year: (L = e.year) != null ? L : s.getFullYear(),
167
- month: (B = e.month) != null ? B : s.getMonth(),
168
- day: (z = e.day) != null ? z : s.getDate(),
169
- hour: (q = e.hour) != null ? q : n ? 0 : s.getHours(),
170
- minute: (Z = e.minute) != null ? Z : n ? 0 : s.getMinutes(),
171
- second: (Q = e.second) != null ? Q : n ? 0 : s.getSeconds(),
172
- millisecond: (G = e.millisecond) != null ? G : n ? 0 : s.getMilliseconds()
150
+ const n = !g(t, "hour", "minute", "second", "millisecond"), a = n ? "later" : this.disambiguation, r = (x = this.nativeDate) != null ? x : new Date(0, 0), i = new Date(ut.getTime()), o = {
151
+ year: (W = e.year) != null ? W : r.getFullYear(),
152
+ month: (j = e.month) != null ? j : r.getMonth(),
153
+ day: (L = e.day) != null ? L : r.getDate(),
154
+ hour: (z = e.hour) != null ? z : n ? 0 : r.getHours(),
155
+ minute: (q = e.minute) != null ? q : n ? 0 : r.getMinutes(),
156
+ second: (B = e.second) != null ? B : n ? 0 : r.getSeconds(),
157
+ millisecond: (Z = e.millisecond) != null ? Z : n ? 0 : r.getMilliseconds()
173
158
  };
174
- r.setFullYear(i.year, i.month, i.day), r.setHours(
175
- i.hour,
176
- i.minute,
177
- i.second,
178
- i.millisecond
159
+ i.setFullYear(o.year, o.month, o.day), i.setHours(
160
+ o.hour,
161
+ o.minute,
162
+ o.second,
163
+ o.millisecond
179
164
  );
180
- const m = r.getTime(), y = new Date(m);
181
- y.setDate(r.getDate() + 1);
182
- const h = new Date(m);
183
- h.setDate(r.getDate() - 1);
184
- const f = y.getTimezoneOffset() - h.getTimezoneOffset();
185
- if (u === "compatible" || f === 0)
186
- return this.nativeDate = r, this;
187
- const g = i.year * 1e8 + i.month * 1e6 + i.day * 1e4 + i.hour * 100 + i.minute < r.getFullYear() * 1e8 + r.getMonth() * 1e6 + r.getDate() * 1e4 + r.getHours() * 100 + r.getMinutes(), b = new Date(
188
- new Date(m).setUTCMinutes(r.getUTCMinutes() + f)
189
- ), it = b.getHours() === r.getHours() && b.getMinutes() === r.getMinutes();
190
- if (!g && !it)
191
- return this.nativeDate = r, this;
192
- if (u === "reject")
193
- throw new RangeError(`Requested local time ${i} is ambiguous.`);
194
- return this.nativeDate = u === "later" ? r : b, this;
165
+ const h = i.getTime(), d = new Date(h);
166
+ d.setDate(i.getDate() + 1);
167
+ const l = new Date(h);
168
+ l.setDate(i.getDate() - 1);
169
+ const c = d.getTimezoneOffset() - l.getTimezoneOffset();
170
+ if (a === "compatible" || c === 0)
171
+ return this.nativeDate = i, this;
172
+ const p = o.year * 1e8 + o.month * 1e6 + o.day * 1e4 + o.hour * 100 + o.minute < i.getFullYear() * 1e8 + i.getMonth() * 1e6 + i.getDate() * 1e4 + i.getHours() * 100 + i.getMinutes(), O = new Date(
173
+ new Date(h).setUTCMinutes(i.getUTCMinutes() + c)
174
+ ), ot = O.getHours() === i.getHours() && O.getMinutes() === i.getMinutes();
175
+ if (!p && !ot)
176
+ return this.nativeDate = i, this;
177
+ if (a === "reject")
178
+ throw new RangeError(`Requested local time ${o} is ambiguous.`);
179
+ return this.nativeDate = a === "later" ? i : O, this;
195
180
  }
196
181
  const Tt = new RegExp(
197
182
  // yyyy[[-|/]MM[[-|/]DD]]
198
183
  "^(\\d{4})(?:[-/]?([0-2]?\\d)(?:[-/]?([0-3]?\\d))?)?(?:[T\\s]([0-2]?\\d)(?::([0-5]?\\d)?(?::([0-6]?\\d)?(?:[.:](\\d{1,3})?\\d*)?)?)?)?(Z|[-+]\\d{2}:?\\d{2})?$"
199
184
  );
200
- function vt(t) {
201
- var h;
185
+ function St(t) {
186
+ var l;
202
187
  const e = t.trim().toUpperCase(), n = e.match(Tt);
203
188
  if (!n)
204
189
  throw RangeError(
205
190
  `Failed to parse '${t}'. Should be yyyy[[-|/]MM[[-|/]DD]][(T| )HH:mm[:ss[(.|:)SSS]]][Z|(+|-)hh:mm]`
206
191
  );
207
- const u = n[4] !== void 0, [s, r, i, m] = [
192
+ const a = n[4] !== void 0, [r, i, o, h] = [
208
193
  +n[1],
209
194
  +n[2] || 1,
210
195
  +n[3] || 1,
211
196
  n[8]
212
- ], y = new Date(e);
213
- if (!tt(y))
197
+ ], d = new Date(e);
198
+ if (!_(d))
214
199
  throw RangeError(
215
200
  `Failed to parse '${t}' by Date. Should be yyyy[[-|/]MM[[-|/]DD]][(T| )HH:mm[:ss[(.|:)SSS]]][Z|(+|-)hh:mm]`
216
201
  );
217
- return m ? this.nativeDate = y : u ? this.set({
218
- year: s,
219
- month: r,
220
- day: i,
202
+ return h ? this.nativeDate = d : a ? this.set({
203
+ year: r,
204
+ month: i,
205
+ day: o,
221
206
  hour: +n[4] || 0,
222
207
  minute: +n[5] || 0,
223
208
  second: +n[6] || 0,
224
- millisecond: +((h = n[7]) == null ? void 0 : h.padStart(3, "0")) || 0
225
- }) : this.set({ year: s, month: r, day: i }), this;
209
+ millisecond: +((l = n[7]) == null ? void 0 : l.padStart(3, "0")) || 0
210
+ }) : this.set({ year: r, month: i, day: o }), this;
226
211
  }
227
- const p = (t, e) => String(t).padStart(e, "0");
228
- o.prototype.toString = function() {
229
- if (this[c].localtime) {
230
- const t = this[c].nativeDate, e = -t.getTimezoneOffset(), n = Math.abs(e);
231
- return `${p(t.getFullYear(), 4)}-${p(t.getMonth() + 1, 2)}-${p(t.getDate(), 2)}T${p(t.getHours(), 2)}:${p(t.getMinutes(), 2)}:${p(t.getSeconds(), 2)}.${p(t.getMilliseconds(), 3)}${e >= 0 ? "+" : "-"}${p(Math.trunc(n / v), 2)}:${p(n % v, 2)}`;
212
+ const y = (t, e) => String(t).padStart(e, "0");
213
+ s.prototype.toString = function() {
214
+ if (this[f].localtime) {
215
+ const t = this[f].nativeDate, e = -t.getTimezoneOffset(), n = Math.abs(e);
216
+ return `${y(t.getFullYear(), 4)}-${y(t.getMonth() + 1, 2)}-${y(t.getDate(), 2)}T${y(t.getHours(), 2)}:${y(t.getMinutes(), 2)}:${y(t.getSeconds(), 2)}.${y(t.getMilliseconds(), 3)}${e >= 0 ? "+" : "-"}${y(Math.trunc(n / M), 2)}:${y(n % M, 2)}`;
232
217
  }
233
- return this[c].nativeDate.toISOString();
218
+ return this[f].nativeDate.toISOString();
234
219
  };
235
- o.prototype.valueOf = function() {
236
- return this[c].nativeDate.valueOf();
220
+ s.prototype.valueOf = function() {
221
+ return this[f].nativeDate.valueOf();
237
222
  };
238
- o.prototype.clone = function(...t) {
239
- return new o(this, ...t);
223
+ s.prototype.clone = function(...t) {
224
+ return new s(this, ...t);
240
225
  };
241
- o.prototype.context = function(t) {
242
- return w(t) ? this.clone(t) : {
243
- localtime: this[c].localtime,
244
- disambiguation: this[c].disambiguation
226
+ s.prototype.context = function(t) {
227
+ return Y(t) ? this.clone(t) : {
228
+ localtime: this[f].localtime,
229
+ disambiguation: this[f].disambiguation
245
230
  };
246
231
  };
247
- o.prototype.nativeDate = function() {
248
- return new Date(this[c].nativeDate.getTime());
249
- };
250
- o.prototype.offset = function() {
251
- return this[c].localtime ? -this[c].nativeDate.getTimezoneOffset() : 0;
232
+ s.prototype.nativeDate = function() {
233
+ return new Date(this[f].nativeDate.getTime());
252
234
  };
253
- o.prototype.localtime = function(t) {
254
- return w(t) ? this.clone({ localtime: t }) : this[c].localtime;
235
+ s.prototype.offset = function() {
236
+ return this[f].localtime ? -this[f].nativeDate.getTimezoneOffset() : 0;
255
237
  };
256
- o.prototype.disambiguation = function(t) {
257
- return w(t) ? this.clone({ disambiguation: t }) : this[c].disambiguation;
238
+ s.prototype.valid = function() {
239
+ return this[f].valid();
258
240
  };
259
- o.prototype.valid = function() {
260
- return this[c].valid();
261
- };
262
- o.prototype.numeric = function() {
263
- return this[c].nativeDate.getTime();
264
- };
265
- o.prototype.toObject = function() {
241
+ s.prototype.toObject = function() {
266
242
  return {
267
243
  year: this.year(),
268
244
  month: this.month(),
@@ -273,7 +249,7 @@ o.prototype.toObject = function() {
273
249
  millisecond: this.millisecond()
274
250
  };
275
251
  };
276
- o.prototype.toArray = function() {
252
+ s.prototype.toArray = function() {
277
253
  return [
278
254
  this.year(),
279
255
  this.month(),
@@ -284,14 +260,8 @@ o.prototype.toArray = function() {
284
260
  this.millisecond()
285
261
  ];
286
262
  };
287
- o.prototype.toDate = function(...t) {
288
- return new a(this.clone(...t));
289
- };
290
- o.prototype.asUtc = function() {
291
- return this.clone({ localtime: !1 });
292
- };
293
- o.prototype.asLocaltime = function() {
294
- return this.clone({ localtime: !0 });
263
+ s.prototype.toDate = function(...t) {
264
+ return new u(this.clone(...t));
295
265
  };
296
266
  for (const [t, e, n] of [
297
267
  ["year", "FullYear", 0],
@@ -302,64 +272,63 @@ for (const [t, e, n] of [
302
272
  ["second", "Seconds", 0],
303
273
  ["millisecond", "Milliseconds", 0]
304
274
  ])
305
- o.prototype[t] = function(u) {
306
- return w(u) ? this.clone({ [t]: u }) : this[c].getNative(e) + n;
275
+ s.prototype[t] = function(a) {
276
+ return Y(a) ? this.clone({ [t]: a }) : this[f].getNative(e) + n;
307
277
  };
308
- o.prototype.dayOfWeek = function() {
309
- return 1 + (this[c].getNative("Day") - 1 + T) % T;
278
+ s.prototype.dayOfWeek = function() {
279
+ return 1 + (this[f].getNative("Day") - 1 + w) % w;
310
280
  };
311
- o.prototype.dayOfYear = function() {
281
+ s.prototype.dayOfYear = function() {
312
282
  const t = this.toDate();
313
283
  return 1 + t - t.startOfYear();
314
284
  };
315
- o.prototype.weekOfYear = function() {
316
- const t = this.toDate(), e = t.day(t.day() - t.dayOfWeek() + M), n = e.startOfYear(), u = n.dayOfWeek() === M ? n : n.day(
317
- 1 + (M - n.dayOfWeek() + T) % T
285
+ s.prototype.weekOfYear = function() {
286
+ const t = this.toDate(), e = t.day(t.day() - t.dayOfWeek() + b), n = e.startOfYear(), a = n.dayOfWeek() === b ? n : n.day(
287
+ 1 + (b - n.dayOfWeek() + w) % w
318
288
  );
319
- return 1 + Math.ceil((e - u) / T);
289
+ return 1 + Math.ceil((e - a) / w);
320
290
  };
321
- o.prototype.yearOfWeek = function() {
291
+ s.prototype.yearOfWeek = function() {
322
292
  const t = this.toDate();
323
- return t.day(t.day() - t.dayOfWeek() + M).year();
293
+ return t.day(t.day() - t.dayOfWeek() + b).year();
324
294
  };
325
- o.prototype.isLeapYear = function() {
295
+ s.prototype.isLeapYear = function() {
326
296
  const t = this.year();
327
297
  return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
328
298
  };
329
- o.prototype.hasDstInYear = function() {
330
- if (!this[c].localtime)
299
+ s.prototype.hasOffsetChangeInYear = function() {
300
+ if (!this[f].localtime)
331
301
  return !1;
332
302
  const t = this.offset();
333
303
  return [3, 6, 9, 12].map((e) => this.month(e).offset()).some((e) => e !== t);
334
304
  };
335
- o.prototype.isInDst = function() {
336
- if (!this[c].localtime)
337
- return !1;
338
- const t = Array.from(
339
- { length: 12 },
340
- (u, s) => this.month(s + 1).offset()
341
- ), e = Math.min(...t), n = Math.max(...t);
342
- return e !== n && this.offset() === n;
343
- };
344
- o.prototype.isDstTransitionDay = function() {
345
- return this[c].localtime ? this.minutesInDay() !== N : !1;
346
- };
347
- o.prototype.minutesInDay = function() {
348
- if (!this[c].localtime)
349
- return N;
305
+ s.prototype.isInDst = function() {
306
+ if (!this[f].localtime) return !1;
307
+ const t = this.offset();
308
+ let e = !1, n = !1;
309
+ for (let a = 1; a <= 5; a += 2)
310
+ if (this.month(-a).offset() < t && (e = !0), this.month(a).offset() < t && (n = !0), e && n) return !0;
311
+ return !1;
312
+ };
313
+ s.prototype.hasOffsetChangeInDay = function() {
314
+ return this[f].localtime ? this.minutesInDay() !== C : !1;
315
+ };
316
+ s.prototype.minutesInDay = function() {
317
+ if (!this[f].localtime)
318
+ return C;
350
319
  const t = this.context({ disambiguation: "later" }).startOfDay(), e = t.plus({ day: 1 }).startOfDay();
351
- return t.day() === e.day() ? N : (e - t) / ht;
320
+ return t.day() === e.day() ? C : (e - t) / lt;
352
321
  };
353
- o.prototype.daysInMonth = function() {
322
+ s.prototype.daysInMonth = function() {
354
323
  const t = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], e = this.month();
355
324
  return t[e - 1] + (this.isLeapYear() && e === 2 ? 1 : 0);
356
325
  };
357
- o.prototype.daysInYear = function() {
326
+ s.prototype.daysInYear = function() {
358
327
  return this.isLeapYear() ? 366 : 365;
359
328
  };
360
- o.prototype.weeksInYear = function() {
329
+ s.prototype.weeksInYear = function() {
361
330
  const t = this.toDate({ month: 12, day: 31 }), e = t.minus({ year: 1 });
362
- return t.dayOfWeek() === M || e.dayOfWeek() === et ? 53 : 52;
331
+ return t.dayOfWeek() === b || e.dayOfWeek() === tt ? 53 : 52;
363
332
  };
364
333
  for (const [t, e] of [
365
334
  ["Year", { month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }],
@@ -368,139 +337,136 @@ for (const [t, e] of [
368
337
  ["Minute", { second: 0, millisecond: 0 }],
369
338
  ["Second", { millisecond: 0 }]
370
339
  ])
371
- o.prototype[`startOf${t}`] = function() {
340
+ s.prototype[`startOf${t}`] = function() {
372
341
  return this.clone(e);
373
342
  };
374
- o.prototype.startOfDay = function() {
343
+ s.prototype.startOfDay = function() {
375
344
  const t = this.clone(
376
345
  { disambiguation: "later" },
377
346
  { hour: 0, minute: 0, second: 0, millisecond: 0 }
378
- ).numeric();
347
+ ).valueOf();
379
348
  return this.clone(t);
380
349
  };
381
- o.prototype.isSame = function(t) {
382
- return +this == +t;
383
- };
384
- o.prototype.isBefore = function(t) {
385
- return this < t;
386
- };
387
- o.prototype.isAfter = function(t) {
388
- return this > t;
389
- };
390
- o.prototype.isSameOrBefore = function(t) {
391
- return this <= t;
392
- };
393
- o.prototype.isSameOrAfter = function(t) {
394
- return this >= t;
395
- };
396
- o.prototype.isBetween = function(t, e) {
397
- return t <= this && this <= e || e <= this && this <= t;
398
- };
399
- o.prototype.plus = function(...t) {
350
+ function et(t) {
351
+ Object.assign(t, {
352
+ isSame(e) {
353
+ return +this == +e;
354
+ },
355
+ isBefore(e) {
356
+ return this < e;
357
+ },
358
+ isAfter(e) {
359
+ return this > e;
360
+ },
361
+ isSameOrBefore(e) {
362
+ return this <= e;
363
+ },
364
+ isSameOrAfter(e) {
365
+ return this >= e;
366
+ },
367
+ isBetween(e, n) {
368
+ return e <= this && this <= n || n <= this && this <= e;
369
+ }
370
+ });
371
+ }
372
+ et(s.prototype);
373
+ s.prototype.plus = function(...t) {
400
374
  return nt.call(this, 1, ...t);
401
375
  };
402
- o.prototype.minus = function(...t) {
376
+ s.prototype.minus = function(...t) {
403
377
  return nt.call(this, -1, ...t);
404
378
  };
405
379
  function nt(t, ...e) {
406
- var m, y;
407
- const n = e[0], u = e[1];
408
- if (Number.isFinite(n) && !Number.isFinite(u))
409
- return this.clone(this.numeric() + n);
410
- let s = null;
411
- if (S(n)) {
412
- if (!Y(n))
380
+ var h, d;
381
+ const n = e[0], a = e[1];
382
+ if (Number.isFinite(n) && !Number.isFinite(a))
383
+ return this.clone(this.valueOf() + n);
384
+ let r = null;
385
+ if (T(n)) {
386
+ if (!S(n))
413
387
  throw RangeError(
414
388
  "Missing time field (year, minute, day, hour, minute, second or millisecond)"
415
389
  );
416
- s = n;
390
+ r = n;
417
391
  } else if (Number.isFinite(n) || Array.isArray(n)) {
418
- const h = e.flat(), f = h.filter((g) => Number.isSafeInteger(g));
419
- if (f.length !== h.length)
392
+ const l = e.flat(), c = l.filter((p) => Number.isSafeInteger(p));
393
+ if (c.length !== l.length)
420
394
  throw RangeError("Should be safe integers");
421
- if (f.length > 7)
395
+ if (c.length > 7)
422
396
  throw RangeError("Too many numbers");
423
- s = {
424
- year: f[0],
425
- month: f[1],
426
- day: f[2],
427
- hour: f[3],
428
- minute: f[4],
429
- second: f[5],
430
- millisecond: f[6]
397
+ r = {
398
+ year: c[0],
399
+ month: c[1],
400
+ day: c[2],
401
+ hour: c[3],
402
+ minute: c[4],
403
+ second: c[5],
404
+ millisecond: c[6]
431
405
  };
432
406
  } else
433
407
  throw TypeError();
434
- const r = this.nativeDate(), i = this[c].localtime ? "" : "UTC";
435
- if (D(s, "year") || D(s, "month")) {
436
- const h = this.year() + t * ((m = s.year) != null ? m : 0), f = this.month() + t * ((y = s.month) != null ? y : 0), g = new Date(r.getTime());
437
- g[`set${i}FullYear`](h, f, 0);
438
- const b = g[`get${i}Date`]();
439
- b < this.day() ? r[`set${i}FullYear`](h, g[`get${i}Month`](), b) : r[`set${i}FullYear`](h, f - 1);
408
+ const i = this.nativeDate(), o = this[f].localtime ? "" : "UTC";
409
+ if (g(r, "year") || g(r, "month")) {
410
+ const l = this.year() + t * ((h = r.year) != null ? h : 0), c = this.month() + t * ((d = r.month) != null ? d : 0), p = new Date(i.getTime());
411
+ p[`set${o}FullYear`](l, c, 0);
412
+ const O = p[`get${o}Date`]();
413
+ O < this.day() ? i[`set${o}FullYear`](l, p[`get${o}Month`](), O) : i[`set${o}FullYear`](l, c - 1);
440
414
  }
441
- D(s, "day") && r[`set${i}Date`](r[`get${i}Date`]() + t * s.day);
442
- for (const [h, f] of [
415
+ g(r, "day") && i[`set${o}Date`](i[`get${o}Date`]() + t * r.day);
416
+ for (const [l, c] of [
443
417
  ["hour", "Hours"],
444
418
  ["minute", "Minutes"],
445
419
  ["second", "Seconds"],
446
420
  ["millisecond", "Milliseconds"]
447
421
  ])
448
- !D(s, h) || s[h] == null || r[`setUTC${f}`](
449
- r[`getUTC${f}`]() + t * s[h]
422
+ !g(r, l) || r[l] == null || i[`setUTC${c}`](
423
+ i[`getUTC${c}`]() + t * r[l]
450
424
  );
451
- return this.clone(r);
425
+ return this.clone(i);
452
426
  }
453
- const l = /* @__PURE__ */ Symbol();
454
- function a(...t) {
427
+ const m = /* @__PURE__ */ Symbol();
428
+ function u(...t) {
455
429
  if (!new.target)
456
- return new a(...t);
430
+ return new u(...t);
457
431
  const e = { datetime: null };
458
- this[l] = e;
432
+ this[m] = e;
459
433
  let n = null;
460
- t[0] instanceof a ? n = t.shift().toDatetime() : t[0] instanceof o && (n = t.shift());
461
- const u = t[0], s = t[1];
462
- return Number.isFinite(u) && !Number.isFinite(s) && (t[0] = Math.floor(u) * U), n ? n = n.clone(...t) : n = C(...t), e.datetime = n.startOfDay(), this;
434
+ t[0] instanceof u ? n = t.shift().toDatetime() : t[0] instanceof s && (n = t.shift());
435
+ const a = t[0], r = t[1];
436
+ return Number.isFinite(a) && !Number.isFinite(r) && (t[0] = Math.floor(a) * X), n ? n = n.clone(...t) : n = I(...t), e.datetime = n.startOfDay(), this;
463
437
  }
464
- a.prototype.toString = function() {
465
- return this[l].datetime.toString().substring(0, 10);
466
- };
467
- a.prototype.valueOf = function() {
468
- return this[l].datetime / U;
438
+ u.prototype.toString = function() {
439
+ return this[m].datetime.toString().substring(0, 10);
469
440
  };
470
- a.prototype.valid = function() {
471
- return this[l].datetime.valid();
441
+ u.prototype.valueOf = function() {
442
+ return this[m].datetime / X;
472
443
  };
473
- a.prototype.clone = function(...t) {
474
- return new a(this, ...t);
444
+ u.prototype.valid = function() {
445
+ return this[m].datetime.valid();
475
446
  };
476
- a.prototype.toDatetime = function() {
477
- return C(this[l].datetime.toArray());
447
+ u.prototype.clone = function(...t) {
448
+ return new u(this, ...t);
478
449
  };
479
- a.prototype.numeric = function() {
480
- return this[l].datetime.numeric() / U;
450
+ u.prototype.toDatetime = function() {
451
+ return I(this[m].datetime.toArray());
481
452
  };
482
- a.prototype.toObject = function() {
453
+ u.prototype.toObject = function() {
483
454
  return {
484
455
  year: this.year(),
485
456
  month: this.month(),
486
457
  day: this.day()
487
458
  };
488
459
  };
489
- a.prototype.toArray = function() {
460
+ u.prototype.toArray = function() {
490
461
  return [this.year(), this.month(), this.day()];
491
462
  };
492
- a.prototype.startOfYear = function() {
493
- return new a(this[l].datetime.startOfYear());
494
- };
495
- a.prototype.startOfMonth = function() {
496
- return new a(this[l].datetime.startOfMonth());
497
- };
498
- a.prototype.startOfDay = function() {
499
- return this[l].datetime.clone();
500
- };
463
+ for (const t of ["Year", "Month"])
464
+ u.prototype[`startOf${t}`] = function() {
465
+ return new u(this[m].datetime[`startOf${t}`]());
466
+ };
501
467
  for (const t of ["year", "month", "day"])
502
- a.prototype[t] = function(e) {
503
- return w(e) ? new a(this[l].datetime[t](e)) : this[l].datetime[t]();
468
+ u.prototype[t] = function(e) {
469
+ return Y(e) ? new u(this[m].datetime[t](e)) : this[m].datetime[t]();
504
470
  };
505
471
  for (const t of [
506
472
  "dayOfWeek",
@@ -512,75 +478,62 @@ for (const t of [
512
478
  "daysInYear",
513
479
  "weeksInYear"
514
480
  ])
515
- a.prototype[t] = function() {
516
- return this[l].datetime[t]();
481
+ u.prototype[t] = function() {
482
+ return this[m].datetime[t]();
517
483
  };
518
- for (const t of ["minutesInDay", "hasDstInYear", "isDstTransitionDay"])
519
- a.prototype[t] = function() {
520
- return C(
484
+ for (const t of [
485
+ "minutesInDay",
486
+ "hasOffsetChangeInYear",
487
+ "hasOffsetChangeInDay"
488
+ ])
489
+ u.prototype[t] = function() {
490
+ return I(
521
491
  { disambiguation: "later" },
522
- this[l].datetime.toArray().slice(0, 3)
492
+ this[m].datetime.toArray().slice(0, 3)
523
493
  )[t]();
524
494
  };
525
- a.prototype.endOfYear = function() {
495
+ u.prototype.endOfYear = function() {
526
496
  return this.clone({ month: 12, day: 31 });
527
497
  };
528
- a.prototype.endOfMonth = function() {
498
+ u.prototype.endOfMonth = function() {
529
499
  return this.clone({ day: this.daysInMonth() });
530
500
  };
531
- a.prototype.isSame = function(t) {
532
- return +this == +t;
533
- };
534
- a.prototype.isBefore = function(t) {
535
- return this < t;
536
- };
537
- a.prototype.isAfter = function(t) {
538
- return this > t;
539
- };
540
- a.prototype.isSameOrBefore = function(t) {
541
- return this <= t;
542
- };
543
- a.prototype.isSameOrAfter = function(t) {
544
- return this >= t;
545
- };
546
- a.prototype.isBetween = function(t, e) {
547
- return t <= this && this <= e || e <= this && this <= t;
548
- };
549
- a.prototype.plus = function(...t) {
550
- return ot.call(this, 1, ...t);
551
- };
552
- a.prototype.minus = function(...t) {
553
- return ot.call(this, -1, ...t);
554
- };
555
- function ot(t, ...e) {
556
- var i, m, y;
557
- const n = e[0], u = e[1], s = this[l].datetime;
558
- if (Number.isFinite(n) && !Number.isFinite(u))
559
- return s.plus({ day: t * n }).toDate();
560
- let r = null;
561
- if (S(n) && Y(n))
562
- r = {
563
- year: t * ((i = n.year) != null ? i : 0),
564
- month: t * ((m = n.month) != null ? m : 0),
565
- day: t * ((y = n.day) != null ? y : 0)
501
+ et(u.prototype);
502
+ u.prototype.plus = function(...t) {
503
+ return it.call(this, 1, ...t);
504
+ };
505
+ u.prototype.minus = function(...t) {
506
+ return it.call(this, -1, ...t);
507
+ };
508
+ function it(t, ...e) {
509
+ var o, h, d;
510
+ const n = e[0], a = e[1], r = this[m].datetime;
511
+ if (Number.isFinite(n) && !Number.isFinite(a))
512
+ return r.plus({ day: t * n }).toDate();
513
+ let i = null;
514
+ if (T(n) && S(n))
515
+ i = {
516
+ year: t * ((o = n.year) != null ? o : 0),
517
+ month: t * ((h = n.month) != null ? h : 0),
518
+ day: t * ((d = n.day) != null ? d : 0)
566
519
  };
567
520
  else if (Number.isFinite(n)) {
568
521
  if (e.length > 3)
569
522
  throw RangeError("Too many arguments");
570
- r = { year: t * n, month: t * u, day: t * arg2 };
523
+ i = { year: t * n, month: t * a, day: t * arg2 };
571
524
  } else if (Array.isArray(n)) {
572
525
  if (n.length > 3)
573
526
  throw RangeError("Too many elements");
574
- r = {
527
+ i = {
575
528
  year: t * n[0],
576
529
  month: t * n[1],
577
530
  day: t * n[2]
578
531
  };
579
532
  } else
580
533
  throw TypeError();
581
- return s.plus(r).toDate();
534
+ return r.plus(i).toDate();
582
535
  }
583
536
  export {
584
- C as qrono
537
+ I as qrono
585
538
  };
586
539
  //# sourceMappingURL=qrono.js.map