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