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