yummies 7.10.0 → 7.12.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/async.cjs +162 -48
- package/async.cjs.map +1 -1
- package/async.d.ts +112 -13
- package/async.js +163 -54
- package/async.js.map +1 -1
- package/chunk-CVq3Gv4J.cjs +50 -0
- package/chunk-YKewjYmz.js +37 -0
- package/common.cjs +48 -8
- package/common.cjs.map +1 -1
- package/common.d.ts +35 -2
- package/common.js +49 -11
- package/common.js.map +1 -1
- package/complex.cjs +275 -104
- package/complex.cjs.map +1 -1
- package/complex.d.ts +133 -13
- package/complex.js +275 -109
- package/complex.js.map +1 -1
- package/cookie.cjs +17 -7
- package/cookie.cjs.map +1 -1
- package/cookie.d.ts +8 -0
- package/cookie.js +18 -9
- package/cookie.js.map +1 -1
- package/css.cjs +147 -39
- package/css.cjs.map +1 -1
- package/css.d.ts +98 -6
- package/css.js +143 -41
- package/css.js.map +1 -1
- package/data.cjs +90 -55
- package/data.cjs.map +1 -1
- package/data.d.ts +32 -0
- package/data.js +91 -61
- package/data.js.map +1 -1
- package/date-time.cjs +578 -412
- package/date-time.cjs.map +1 -1
- package/date-time.d.ts +88 -0
- package/date-time.js +575 -421
- package/date-time.js.map +1 -1
- package/device.cjs +48 -23
- package/device.cjs.map +1 -1
- package/device.d.ts +32 -0
- package/device.js +49 -31
- package/device.js.map +1 -1
- package/encodings.cjs +275 -266
- package/encodings.cjs.map +1 -1
- package/encodings.d.ts +8 -0
- package/encodings.js +276 -268
- package/encodings.js.map +1 -1
- package/errors.cjs +20 -18
- package/errors.cjs.map +1 -1
- package/errors.js +19 -19
- package/errors.js.map +1 -1
- package/file.cjs +42 -24
- package/file.cjs.map +1 -1
- package/file.d.ts +16 -0
- package/file.js +43 -27
- package/file.js.map +1 -1
- package/format.cjs +125 -83
- package/format.cjs.map +1 -1
- package/format.d.ts +89 -4
- package/format.js +118 -82
- package/format.js.map +1 -1
- package/html.cjs +226 -137
- package/html.cjs.map +1 -1
- package/html.d.ts +67 -3
- package/html.js +223 -150
- package/html.js.map +1 -1
- package/id.cjs +74 -17
- package/id.cjs.map +1 -1
- package/id.d.ts +10 -10
- package/id.js +73 -24
- package/id.js.map +1 -1
- package/imports.cjs +41 -29
- package/imports.cjs.map +1 -1
- package/imports.d.ts +13 -4
- package/imports.js +40 -31
- package/imports.js.map +1 -1
- package/math.cjs +32 -6
- package/math.cjs.map +1 -1
- package/math.d.ts +17 -1
- package/math.js +33 -10
- package/math.js.map +1 -1
- package/media.cjs +275 -84
- package/media.cjs.map +1 -1
- package/media.d.ts +188 -2
- package/media.js +274 -93
- package/media.js.map +1 -1
- package/mobx.cjs +353 -193
- package/mobx.cjs.map +1 -1
- package/mobx.d.ts +172 -6
- package/mobx.js +351 -200
- package/mobx.js.map +1 -1
- package/ms.cjs +21 -10
- package/ms.cjs.map +1 -1
- package/ms.d.ts +1 -1
- package/ms.js +22 -13
- package/ms.js.map +1 -1
- package/number.cjs +13 -7
- package/number.cjs.map +1 -1
- package/number.js +14 -9
- package/number.js.map +1 -1
- package/package.json +13 -5
- package/parser.cjs +117 -64
- package/parser.cjs.map +1 -1
- package/parser.d.ts +63 -0
- package/parser.js +111 -64
- package/parser.js.map +1 -1
- package/price.cjs +24 -18
- package/price.cjs.map +1 -1
- package/price.d.ts +8 -0
- package/price.js +25 -20
- package/price.js.map +1 -1
- package/random.cjs +79 -13
- package/random.cjs.map +1 -1
- package/random.d.ts +64 -0
- package/random.js +80 -22
- package/random.js.map +1 -1
- package/react.cjs +673 -214
- package/react.cjs.map +1 -1
- package/react.d.ts +428 -9
- package/react.js +674 -239
- package/react.js.map +1 -1
- package/sound.cjs +14 -9
- package/sound.cjs.map +1 -1
- package/sound.d.ts +1 -1
- package/sound.js +15 -11
- package/sound.js.map +1 -1
- package/storage.cjs +49 -50
- package/storage.cjs.map +1 -1
- package/storage.d.ts +15 -6
- package/storage.js +50 -53
- package/storage.js.map +1 -1
- package/text.cjs +51 -34
- package/text.cjs.map +1 -1
- package/text.d.ts +5 -5
- package/text.js +52 -37
- package/text.js.map +1 -1
- package/type-guard.cjs +292 -72
- package/type-guard.cjs.map +1 -1
- package/type-guard.d.ts +199 -42
- package/type-guard.js +288 -73
- package/type-guard.js.map +1 -1
- package/types.cjs +0 -2
- package/types.global.cjs +0 -2
- package/types.global.js +0 -2
- package/types.js +0 -2
- package/vibrate.cjs +31 -6
- package/vibrate.cjs.map +1 -1
- package/vibrate.d.ts +23 -1
- package/vibrate.js +32 -8
- package/vibrate.js.map +1 -1
- package/types.cjs.map +0 -1
- package/types.global.cjs.map +0 -1
- package/types.global.js.map +0 -1
- package/types.js.map +0 -1
package/date-time.js
CHANGED
|
@@ -1,433 +1,587 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-YKewjYmz.js";
|
|
2
|
+
import { typeGuard } from "yummies/type-guard";
|
|
2
3
|
import { format } from "yummies/format";
|
|
3
|
-
import
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import { ms, unitsToMs } from "yummies/ms";
|
|
4
6
|
import { declension } from "yummies/text";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
7
|
+
//#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/duration.js
|
|
8
|
+
var require_duration = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9
|
+
(function(t, s) {
|
|
10
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = s() : "function" == typeof define && define.amd ? define(s) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs_plugin_duration = s();
|
|
11
|
+
})(exports, (function() {
|
|
12
|
+
"use strict";
|
|
13
|
+
var t, s, n = 1e3, i = 6e4, e = 36e5, r = 864e5, o = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u = 31536e6, d = 2628e6, a = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h = {
|
|
14
|
+
years: u,
|
|
15
|
+
months: d,
|
|
16
|
+
days: r,
|
|
17
|
+
hours: e,
|
|
18
|
+
minutes: i,
|
|
19
|
+
seconds: n,
|
|
20
|
+
milliseconds: 1,
|
|
21
|
+
weeks: 6048e5
|
|
22
|
+
}, c = function(t) {
|
|
23
|
+
return t instanceof g;
|
|
24
|
+
}, f = function(t, s, n) {
|
|
25
|
+
return new g(t, n, s.$l);
|
|
26
|
+
}, m = function(t) {
|
|
27
|
+
return s.p(t) + "s";
|
|
28
|
+
}, l = function(t) {
|
|
29
|
+
return t < 0;
|
|
30
|
+
}, $ = function(t) {
|
|
31
|
+
return l(t) ? Math.ceil(t) : Math.floor(t);
|
|
32
|
+
}, y = function(t) {
|
|
33
|
+
return Math.abs(t);
|
|
34
|
+
}, v = function(t, s) {
|
|
35
|
+
return t ? l(t) ? {
|
|
36
|
+
negative: !0,
|
|
37
|
+
format: "" + y(t) + s
|
|
38
|
+
} : {
|
|
39
|
+
negative: !1,
|
|
40
|
+
format: "" + t + s
|
|
41
|
+
} : {
|
|
42
|
+
negative: !1,
|
|
43
|
+
format: ""
|
|
44
|
+
};
|
|
45
|
+
}, g = function() {
|
|
46
|
+
function l(t, s, n) {
|
|
47
|
+
var i = this;
|
|
48
|
+
if (this.$d = {}, this.$l = n, void 0 === t && (this.$ms = 0, this.parseFromMilliseconds()), s) return f(t * h[m(s)], this);
|
|
49
|
+
if ("number" == typeof t) return this.$ms = t, this.parseFromMilliseconds(), this;
|
|
50
|
+
if ("object" == typeof t) return Object.keys(t).forEach((function(s) {
|
|
51
|
+
i.$d[m(s)] = t[s];
|
|
52
|
+
})), this.calMilliseconds(), this;
|
|
53
|
+
if ("string" == typeof t) {
|
|
54
|
+
var e = t.match(a);
|
|
55
|
+
if (e) {
|
|
56
|
+
var r = e.slice(2).map((function(t) {
|
|
57
|
+
return null != t ? Number(t) : 0;
|
|
58
|
+
}));
|
|
59
|
+
return this.$d.years = r[0], this.$d.months = r[1], this.$d.weeks = r[2], this.$d.days = r[3], this.$d.hours = r[4], this.$d.minutes = r[5], this.$d.seconds = r[6], this.calMilliseconds(), this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
var y = l.prototype;
|
|
65
|
+
return y.calMilliseconds = function() {
|
|
66
|
+
var t = this;
|
|
67
|
+
this.$ms = Object.keys(this.$d).reduce((function(s, n) {
|
|
68
|
+
return s + (t.$d[n] || 0) * h[n];
|
|
69
|
+
}), 0);
|
|
70
|
+
}, y.parseFromMilliseconds = function() {
|
|
71
|
+
var t = this.$ms;
|
|
72
|
+
this.$d.years = $(t / u), t %= u, this.$d.months = $(t / d), t %= d, this.$d.days = $(t / r), t %= r, this.$d.hours = $(t / e), t %= e, this.$d.minutes = $(t / i), t %= i, this.$d.seconds = $(t / n), t %= n, this.$d.milliseconds = t;
|
|
73
|
+
}, y.toISOString = function() {
|
|
74
|
+
var t = v(this.$d.years, "Y"), s = v(this.$d.months, "M"), n = +this.$d.days || 0;
|
|
75
|
+
this.$d.weeks && (n += 7 * this.$d.weeks);
|
|
76
|
+
var i = v(n, "D"), e = v(this.$d.hours, "H"), r = v(this.$d.minutes, "M"), o = this.$d.seconds || 0;
|
|
77
|
+
this.$d.milliseconds && (o += this.$d.milliseconds / 1e3, o = Math.round(1e3 * o) / 1e3);
|
|
78
|
+
var u = v(o, "S"), d = t.negative || s.negative || i.negative || e.negative || r.negative || u.negative, a = e.format || r.format || u.format ? "T" : "", h = (d ? "-" : "") + "P" + t.format + s.format + i.format + a + e.format + r.format + u.format;
|
|
79
|
+
return "P" === h || "-P" === h ? "P0D" : h;
|
|
80
|
+
}, y.toJSON = function() {
|
|
81
|
+
return this.toISOString();
|
|
82
|
+
}, y.format = function(t) {
|
|
83
|
+
var n = t || "YYYY-MM-DDTHH:mm:ss", i = {
|
|
84
|
+
Y: this.$d.years,
|
|
85
|
+
YY: s.s(this.$d.years, 2, "0"),
|
|
86
|
+
YYYY: s.s(this.$d.years, 4, "0"),
|
|
87
|
+
M: this.$d.months,
|
|
88
|
+
MM: s.s(this.$d.months, 2, "0"),
|
|
89
|
+
D: this.$d.days,
|
|
90
|
+
DD: s.s(this.$d.days, 2, "0"),
|
|
91
|
+
H: this.$d.hours,
|
|
92
|
+
HH: s.s(this.$d.hours, 2, "0"),
|
|
93
|
+
m: this.$d.minutes,
|
|
94
|
+
mm: s.s(this.$d.minutes, 2, "0"),
|
|
95
|
+
s: this.$d.seconds,
|
|
96
|
+
ss: s.s(this.$d.seconds, 2, "0"),
|
|
97
|
+
SSS: s.s(this.$d.milliseconds, 3, "0")
|
|
98
|
+
};
|
|
99
|
+
return n.replace(o, (function(t, s) {
|
|
100
|
+
return s || String(i[t]);
|
|
101
|
+
}));
|
|
102
|
+
}, y.as = function(t) {
|
|
103
|
+
return this.$ms / h[m(t)];
|
|
104
|
+
}, y.get = function(t) {
|
|
105
|
+
var s = this.$ms, n = m(t);
|
|
106
|
+
return "milliseconds" === n ? s %= 1e3 : s = "weeks" === n ? $(s / h[n]) : this.$d[n], s || 0;
|
|
107
|
+
}, y.add = function(t, s, n) {
|
|
108
|
+
var i;
|
|
109
|
+
return i = s ? t * h[m(s)] : c(t) ? t.$ms : f(t, this).$ms, f(this.$ms + i * (n ? -1 : 1), this);
|
|
110
|
+
}, y.subtract = function(t, s) {
|
|
111
|
+
return this.add(t, s, !0);
|
|
112
|
+
}, y.locale = function(t) {
|
|
113
|
+
var s = this.clone();
|
|
114
|
+
return s.$l = t, s;
|
|
115
|
+
}, y.clone = function() {
|
|
116
|
+
return f(this.$ms, this);
|
|
117
|
+
}, y.humanize = function(s) {
|
|
118
|
+
return t().add(this.$ms, "ms").locale(this.$l).fromNow(!s);
|
|
119
|
+
}, y.valueOf = function() {
|
|
120
|
+
return this.asMilliseconds();
|
|
121
|
+
}, y.milliseconds = function() {
|
|
122
|
+
return this.get("milliseconds");
|
|
123
|
+
}, y.asMilliseconds = function() {
|
|
124
|
+
return this.as("milliseconds");
|
|
125
|
+
}, y.seconds = function() {
|
|
126
|
+
return this.get("seconds");
|
|
127
|
+
}, y.asSeconds = function() {
|
|
128
|
+
return this.as("seconds");
|
|
129
|
+
}, y.minutes = function() {
|
|
130
|
+
return this.get("minutes");
|
|
131
|
+
}, y.asMinutes = function() {
|
|
132
|
+
return this.as("minutes");
|
|
133
|
+
}, y.hours = function() {
|
|
134
|
+
return this.get("hours");
|
|
135
|
+
}, y.asHours = function() {
|
|
136
|
+
return this.as("hours");
|
|
137
|
+
}, y.days = function() {
|
|
138
|
+
return this.get("days");
|
|
139
|
+
}, y.asDays = function() {
|
|
140
|
+
return this.as("days");
|
|
141
|
+
}, y.weeks = function() {
|
|
142
|
+
return this.get("weeks");
|
|
143
|
+
}, y.asWeeks = function() {
|
|
144
|
+
return this.as("weeks");
|
|
145
|
+
}, y.months = function() {
|
|
146
|
+
return this.get("months");
|
|
147
|
+
}, y.asMonths = function() {
|
|
148
|
+
return this.as("months");
|
|
149
|
+
}, y.years = function() {
|
|
150
|
+
return this.get("years");
|
|
151
|
+
}, y.asYears = function() {
|
|
152
|
+
return this.as("years");
|
|
153
|
+
}, l;
|
|
154
|
+
}(), p = function(t, s, n) {
|
|
155
|
+
return t.add(s.years() * n, "y").add(s.months() * n, "M").add(s.days() * n, "d").add(s.hours() * n, "h").add(s.minutes() * n, "m").add(s.seconds() * n, "s").add(s.milliseconds() * n, "ms");
|
|
156
|
+
};
|
|
157
|
+
return function(n, i, e) {
|
|
158
|
+
t = e, s = e().$utils(), e.duration = function(t, s) {
|
|
159
|
+
return f(t, { $l: e.locale() }, s);
|
|
160
|
+
}, e.isDuration = c;
|
|
161
|
+
var r = i.prototype.add, o = i.prototype.subtract;
|
|
162
|
+
i.prototype.add = function(t, s) {
|
|
163
|
+
return c(t) ? p(this, t, 1) : r.bind(this)(t, s);
|
|
164
|
+
}, i.prototype.subtract = function(t, s) {
|
|
165
|
+
return c(t) ? p(this, t, -1) : o.bind(this)(t, s);
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}));
|
|
169
|
+
}));
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/relativeTime.js
|
|
172
|
+
var require_relativeTime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
173
|
+
(function(r, e) {
|
|
174
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (r = "undefined" != typeof globalThis ? globalThis : r || self).dayjs_plugin_relativeTime = e();
|
|
175
|
+
})(exports, (function() {
|
|
176
|
+
"use strict";
|
|
177
|
+
return function(r, e, t) {
|
|
178
|
+
r = r || {};
|
|
179
|
+
var n = e.prototype, o = {
|
|
180
|
+
future: "in %s",
|
|
181
|
+
past: "%s ago",
|
|
182
|
+
s: "a few seconds",
|
|
183
|
+
m: "a minute",
|
|
184
|
+
mm: "%d minutes",
|
|
185
|
+
h: "an hour",
|
|
186
|
+
hh: "%d hours",
|
|
187
|
+
d: "a day",
|
|
188
|
+
dd: "%d days",
|
|
189
|
+
M: "a month",
|
|
190
|
+
MM: "%d months",
|
|
191
|
+
y: "a year",
|
|
192
|
+
yy: "%d years"
|
|
193
|
+
};
|
|
194
|
+
function i(r, e, t, o) {
|
|
195
|
+
return n.fromToBase(r, e, t, o);
|
|
196
|
+
}
|
|
197
|
+
t.en.relativeTime = o, n.fromToBase = function(e, n, i, d, u) {
|
|
198
|
+
for (var f, a, s, l = i.$locale().relativeTime || o, h = r.thresholds || [
|
|
199
|
+
{
|
|
200
|
+
l: "s",
|
|
201
|
+
r: 44,
|
|
202
|
+
d: "second"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
l: "m",
|
|
206
|
+
r: 89
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
l: "mm",
|
|
210
|
+
r: 44,
|
|
211
|
+
d: "minute"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
l: "h",
|
|
215
|
+
r: 89
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
l: "hh",
|
|
219
|
+
r: 21,
|
|
220
|
+
d: "hour"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
l: "d",
|
|
224
|
+
r: 35
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
l: "dd",
|
|
228
|
+
r: 25,
|
|
229
|
+
d: "day"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
l: "M",
|
|
233
|
+
r: 45
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
l: "MM",
|
|
237
|
+
r: 10,
|
|
238
|
+
d: "month"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
l: "y",
|
|
242
|
+
r: 17
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
l: "yy",
|
|
246
|
+
d: "year"
|
|
247
|
+
}
|
|
248
|
+
], m = h.length, c = 0; c < m; c += 1) {
|
|
249
|
+
var y = h[c];
|
|
250
|
+
y.d && (f = d ? t(e).diff(i, y.d, !0) : i.diff(e, y.d, !0));
|
|
251
|
+
var p = (r.rounding || Math.round)(Math.abs(f));
|
|
252
|
+
if (s = f > 0, p <= y.r || !y.r) {
|
|
253
|
+
p <= 1 && c > 0 && (y = h[c - 1]);
|
|
254
|
+
var v = l[y.l];
|
|
255
|
+
u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n, y.l, s);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (n) return a;
|
|
260
|
+
var M = s ? l.future : l.past;
|
|
261
|
+
return "function" == typeof M ? M(a) : M.replace("%s", a);
|
|
262
|
+
}, n.to = function(r, e) {
|
|
263
|
+
return i(r, e, this, !0);
|
|
264
|
+
}, n.from = function(r, e) {
|
|
265
|
+
return i(r, e, this);
|
|
266
|
+
};
|
|
267
|
+
var d = function(r) {
|
|
268
|
+
return r.$u ? t.utc() : t();
|
|
269
|
+
};
|
|
270
|
+
n.toNow = function(r) {
|
|
271
|
+
return this.to(d(this), r);
|
|
272
|
+
}, n.fromNow = function(r) {
|
|
273
|
+
return this.from(d(this), r);
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
}));
|
|
277
|
+
}));
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/locale/ru.js
|
|
280
|
+
var require_ru = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
281
|
+
(function(_, t) {
|
|
282
|
+
"object" == typeof exports && "undefined" != typeof module ? module.exports = t(__require("dayjs")) : "function" == typeof define && define.amd ? define(["dayjs"], t) : (_ = "undefined" != typeof globalThis ? globalThis : _ || self).dayjs_locale_ru = t(_.dayjs);
|
|
283
|
+
})(exports, (function(_) {
|
|
284
|
+
"use strict";
|
|
285
|
+
function t(_) {
|
|
286
|
+
return _ && "object" == typeof _ && "default" in _ ? _ : { default: _ };
|
|
287
|
+
}
|
|
288
|
+
var e = t(_), n = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"), s = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"), r = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"), o = "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_"), i = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
|
|
289
|
+
function d(_, t, e) {
|
|
290
|
+
var n, s;
|
|
291
|
+
return "m" === e ? t ? "минута" : "минуту" : _ + " " + (n = +_, s = {
|
|
292
|
+
mm: t ? "минута_минуты_минут" : "минуту_минуты_минут",
|
|
293
|
+
hh: "час_часа_часов",
|
|
294
|
+
dd: "день_дня_дней",
|
|
295
|
+
MM: "месяц_месяца_месяцев",
|
|
296
|
+
yy: "год_года_лет"
|
|
297
|
+
}[e].split("_"), n % 10 == 1 && n % 100 != 11 ? s[0] : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? s[1] : s[2]);
|
|
298
|
+
}
|
|
299
|
+
var u = function(_, t) {
|
|
300
|
+
return i.test(t) ? n[_.month()] : s[_.month()];
|
|
301
|
+
};
|
|
302
|
+
u.s = s, u.f = n;
|
|
303
|
+
var a = function(_, t) {
|
|
304
|
+
return i.test(t) ? r[_.month()] : o[_.month()];
|
|
305
|
+
};
|
|
306
|
+
a.s = o, a.f = r;
|
|
307
|
+
var m = {
|
|
308
|
+
name: "ru",
|
|
309
|
+
weekdays: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),
|
|
310
|
+
weekdaysShort: "вск_пнд_втр_срд_чтв_птн_сбт".split("_"),
|
|
311
|
+
weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"),
|
|
312
|
+
months: u,
|
|
313
|
+
monthsShort: a,
|
|
314
|
+
weekStart: 1,
|
|
315
|
+
yearStart: 4,
|
|
316
|
+
formats: {
|
|
317
|
+
LT: "H:mm",
|
|
318
|
+
LTS: "H:mm:ss",
|
|
319
|
+
L: "DD.MM.YYYY",
|
|
320
|
+
LL: "D MMMM YYYY г.",
|
|
321
|
+
LLL: "D MMMM YYYY г., H:mm",
|
|
322
|
+
LLLL: "dddd, D MMMM YYYY г., H:mm"
|
|
323
|
+
},
|
|
324
|
+
relativeTime: {
|
|
325
|
+
future: "через %s",
|
|
326
|
+
past: "%s назад",
|
|
327
|
+
s: "несколько секунд",
|
|
328
|
+
m: d,
|
|
329
|
+
mm: d,
|
|
330
|
+
h: "час",
|
|
331
|
+
hh: d,
|
|
332
|
+
d: "день",
|
|
333
|
+
dd: d,
|
|
334
|
+
M: "месяц",
|
|
335
|
+
MM: d,
|
|
336
|
+
y: "год",
|
|
337
|
+
yy: d
|
|
338
|
+
},
|
|
339
|
+
ordinal: function(_) {
|
|
340
|
+
return _;
|
|
341
|
+
},
|
|
342
|
+
meridiem: function(_) {
|
|
343
|
+
return _ < 4 ? "ночи" : _ < 12 ? "утра" : _ < 17 ? "дня" : "вечера";
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
return e.default.locale(m, null, !0), m;
|
|
347
|
+
}));
|
|
348
|
+
}));
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/date-time.ts
|
|
351
|
+
var import_duration = /* @__PURE__ */ __toESM(require_duration(), 1);
|
|
352
|
+
var import_relativeTime = /* @__PURE__ */ __toESM(require_relativeTime(), 1);
|
|
353
|
+
require_ru();
|
|
354
|
+
dayjs.extend(import_relativeTime.default);
|
|
355
|
+
dayjs.extend(import_duration.default);
|
|
238
356
|
dayjs.locale("ru");
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
if (!result?.isValid()) {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
return result;
|
|
357
|
+
var toLibFormat = (value) => {
|
|
358
|
+
let result = null;
|
|
359
|
+
if (dayjs.isDayjs(value)) result = value;
|
|
360
|
+
else if (value != null) result = dayjs(value);
|
|
361
|
+
if (!result?.isValid()) return null;
|
|
362
|
+
return result;
|
|
250
363
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return libDate.format("DD MMM HH:mm");
|
|
280
|
-
}
|
|
281
|
-
case "time": {
|
|
282
|
-
return libDate.format("HH:mm:ss");
|
|
283
|
-
}
|
|
284
|
-
case "time-short": {
|
|
285
|
-
return libDate.format("HH:mm");
|
|
286
|
-
}
|
|
287
|
-
case "day": {
|
|
288
|
-
return libDate.format("DD MMM YYYY");
|
|
289
|
-
}
|
|
290
|
-
case "month": {
|
|
291
|
-
return libDate.format("MMMM YYYY");
|
|
292
|
-
}
|
|
293
|
-
default: {
|
|
294
|
-
return libDate.format("DD.MM.YYYY");
|
|
295
|
-
}
|
|
296
|
-
}
|
|
364
|
+
/**
|
|
365
|
+
* Formats a date-like value using predefined presets or a custom pattern.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* formatDate('2024-03-15', { format: 'time-short' });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
var formatDate = (value, settings) => {
|
|
373
|
+
const dateFormat = settings?.format;
|
|
374
|
+
const datePattern = settings?.pattern;
|
|
375
|
+
const asTime = settings?.asTime;
|
|
376
|
+
let libDate = null;
|
|
377
|
+
if (asTime && typeGuard.isNumber(value)) libDate = dayjs.duration(value);
|
|
378
|
+
else libDate = toLibFormat(value);
|
|
379
|
+
if (!libDate) return format.NO_VALUE;
|
|
380
|
+
if (datePattern) return libDate.format(datePattern);
|
|
381
|
+
if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
|
|
382
|
+
else return format.NO_VALUE;
|
|
383
|
+
switch (dateFormat) {
|
|
384
|
+
case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
|
|
385
|
+
case "short": return libDate.format("DD MMM HH:mm");
|
|
386
|
+
case "time": return libDate.format("HH:mm:ss");
|
|
387
|
+
case "time-short": return libDate.format("HH:mm");
|
|
388
|
+
case "day": return libDate.format("DD MMM YYYY");
|
|
389
|
+
case "month": return libDate.format("MMMM YYYY");
|
|
390
|
+
default: return libDate.format("DD.MM.YYYY");
|
|
391
|
+
}
|
|
297
392
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
393
|
+
/**
|
|
394
|
+
* Splits a duration in milliseconds into day-based time parts.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* dayTimeDuration(ms(1, 'day') + ms(2, 'hour'));
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
var dayTimeDuration = (timeInMs) => {
|
|
402
|
+
let left = Math.max(timeInMs, 0);
|
|
403
|
+
const days = Math.floor(left / unitsToMs.day);
|
|
404
|
+
left = left % unitsToMs.day;
|
|
405
|
+
const hours = Math.floor(left / unitsToMs.hour);
|
|
406
|
+
left = left % unitsToMs.hour;
|
|
407
|
+
const minutes = Math.floor(left / unitsToMs.min);
|
|
408
|
+
left = left % unitsToMs.min;
|
|
409
|
+
const seconds = Math.floor(left / unitsToMs.sec);
|
|
410
|
+
left = left % unitsToMs.sec;
|
|
411
|
+
return {
|
|
412
|
+
days,
|
|
413
|
+
hours,
|
|
414
|
+
minutes,
|
|
415
|
+
seconds,
|
|
416
|
+
milliseconds: Math.floor(left)
|
|
417
|
+
};
|
|
316
418
|
};
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Applies one or more date adjustments and returns a new `Date` instance.
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```ts
|
|
424
|
+
* changeDate(new Date(), 1, 'day', 30, 'minute');
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
var changeDate = (date, ...args) => {
|
|
428
|
+
let wrappedDate = toLibFormat(date);
|
|
429
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
430
|
+
const amount = args[i];
|
|
431
|
+
const unit = args[i + 1];
|
|
432
|
+
if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
|
|
433
|
+
}
|
|
434
|
+
return wrappedDate.toDate();
|
|
327
435
|
};
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Converts milliseconds into hour-based time parts without keeping full days separately.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```ts
|
|
441
|
+
* timeDuration(ms(1, 'hour') + ms(30, 'min'));
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
var timeDuration = (timeInMs) => {
|
|
445
|
+
const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
|
|
446
|
+
return {
|
|
447
|
+
hours: hours + unitsToMs.day * days,
|
|
448
|
+
milliseconds,
|
|
449
|
+
minutes,
|
|
450
|
+
seconds
|
|
451
|
+
};
|
|
336
452
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
453
|
+
var durationFormatLabels = {
|
|
454
|
+
days: {
|
|
455
|
+
compact: "д",
|
|
456
|
+
full: [
|
|
457
|
+
"день",
|
|
458
|
+
"дня",
|
|
459
|
+
"дней"
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
hours: {
|
|
463
|
+
compact: "ч",
|
|
464
|
+
full: [
|
|
465
|
+
"час",
|
|
466
|
+
"часа",
|
|
467
|
+
"часов"
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
minutes: {
|
|
471
|
+
compact: "мин",
|
|
472
|
+
full: [
|
|
473
|
+
"минута",
|
|
474
|
+
"минуты",
|
|
475
|
+
"минут"
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
seconds: {
|
|
479
|
+
compact: "сек",
|
|
480
|
+
full: [
|
|
481
|
+
"секунда",
|
|
482
|
+
"секунды",
|
|
483
|
+
"секунд"
|
|
484
|
+
]
|
|
485
|
+
}
|
|
342
486
|
};
|
|
343
487
|
function getFormatDuration(...args) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
if (hours) {
|
|
367
|
-
if (compact) {
|
|
368
|
-
formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
|
|
369
|
-
} else {
|
|
370
|
-
formattedParts.push(
|
|
371
|
-
`${hours} ${declension(hours, durationFormatLabels.hours.full)}`
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (minutes) {
|
|
376
|
-
if (compact) {
|
|
377
|
-
formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
|
|
378
|
-
} else {
|
|
379
|
-
formattedParts.push(
|
|
380
|
-
`${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
if (seconds) {
|
|
385
|
-
if (compact) {
|
|
386
|
-
formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
|
|
387
|
-
} else {
|
|
388
|
-
formattedParts.push(
|
|
389
|
-
`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return formattedParts.join(" ");
|
|
488
|
+
let compact = false;
|
|
489
|
+
let diff = 0;
|
|
490
|
+
if (args[0] instanceof Date) {
|
|
491
|
+
const startedDate = dayjs(args[0]);
|
|
492
|
+
diff = dayjs(args[1]).diff(startedDate, "ms");
|
|
493
|
+
compact = args[2] === true;
|
|
494
|
+
} else {
|
|
495
|
+
diff = args[0];
|
|
496
|
+
compact = args[1] === true;
|
|
497
|
+
}
|
|
498
|
+
const { days, hours, minutes, seconds } = dayTimeDuration(diff);
|
|
499
|
+
const formattedParts = [];
|
|
500
|
+
if (days) if (compact) formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
|
|
501
|
+
else formattedParts.push(`${days} ${declension(days, durationFormatLabels.days.full)}`);
|
|
502
|
+
if (hours) if (compact) formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
|
|
503
|
+
else formattedParts.push(`${hours} ${declension(hours, durationFormatLabels.hours.full)}`);
|
|
504
|
+
if (minutes) if (compact) formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
|
|
505
|
+
else formattedParts.push(`${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`);
|
|
506
|
+
if (seconds) if (compact) formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
|
|
507
|
+
else formattedParts.push(`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`);
|
|
508
|
+
return formattedParts.join(" ");
|
|
394
509
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
changeDate,
|
|
424
|
-
dayTimeDuration,
|
|
425
|
-
formatDate,
|
|
426
|
-
getFormatDuration,
|
|
427
|
-
getTimeDiff,
|
|
428
|
-
setHours,
|
|
429
|
-
setMinutes,
|
|
430
|
-
subtractDays,
|
|
431
|
-
timeDuration
|
|
510
|
+
/**
|
|
511
|
+
* Calculates the difference between two dates in minutes, seconds and total units.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* getTimeDiff(new Date('2024-03-15T12:30:00'), new Date('2024-03-15T12:00:00'));
|
|
516
|
+
* ```
|
|
517
|
+
*/
|
|
518
|
+
var getTimeDiff = (dateA, dateB) => {
|
|
519
|
+
const leftDate = toLibFormat(dateA)?.toDate();
|
|
520
|
+
const rightDate = toLibFormat(dateB)?.toDate();
|
|
521
|
+
if (!leftDate || !rightDate) return {
|
|
522
|
+
minutes: 0,
|
|
523
|
+
seconds: 0,
|
|
524
|
+
total: {
|
|
525
|
+
ms: 0,
|
|
526
|
+
hours: 0
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
const msDiff = leftDate.getTime() - rightDate.getTime();
|
|
530
|
+
return {
|
|
531
|
+
minutes: Math.max(Math.floor(msDiff / ms(1, "min")), 0),
|
|
532
|
+
seconds: Math.max(Math.floor(msDiff % ms(1, "min") / 1e3), 0),
|
|
533
|
+
total: {
|
|
534
|
+
hours: Math.round(msDiff / ms(1, "hour")),
|
|
535
|
+
ms: msDiff
|
|
536
|
+
}
|
|
537
|
+
};
|
|
432
538
|
};
|
|
433
|
-
|
|
539
|
+
/**
|
|
540
|
+
* Returns a new date shifted forward by the provided number of days.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```ts
|
|
544
|
+
* addDays(new Date('2024-03-15'), 7);
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
|
|
548
|
+
/**
|
|
549
|
+
* Returns a new date shifted backward by the provided number of days.
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```ts
|
|
553
|
+
* subtractDays(new Date('2024-03-15'), 7);
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
|
|
557
|
+
/**
|
|
558
|
+
* Returns a new date shifted forward by the provided number of minutes.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts
|
|
562
|
+
* addMinutes(new Date('2024-03-15T12:00:00'), 15);
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
|
|
566
|
+
/**
|
|
567
|
+
* Returns a new date with the minutes field replaced.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* setMinutes(new Date('2024-03-15T12:00:00'), 45);
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
|
|
575
|
+
/**
|
|
576
|
+
* Returns a new date with the hours field replaced.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* setHours(new Date('2024-03-15T12:00:00'), 9);
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
|
|
584
|
+
//#endregion
|
|
585
|
+
export { addDays, addMinutes, changeDate, dayTimeDuration, formatDate, getFormatDuration, getTimeDiff, setHours, setMinutes, subtractDays, timeDuration };
|
|
586
|
+
|
|
587
|
+
//# sourceMappingURL=date-time.js.map
|