yummies 5.11.1 → 5.11.2
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 +1 -1
- package/async.cjs.map +1 -1
- package/async.js +38 -21
- package/async.js.map +1 -1
- package/common.cjs +1 -1
- package/common.cjs.map +1 -1
- package/common.js +9 -3
- package/common.js.map +1 -1
- package/complex.cjs +1 -1
- package/complex.cjs.map +1 -1
- package/complex.js +56 -33
- package/complex.js.map +1 -1
- package/cookie.cjs +1 -1
- package/cookie.cjs.map +1 -1
- package/cookie.js +7 -2
- package/cookie.js.map +1 -1
- package/css.cjs +1 -1
- package/css.cjs.map +1 -1
- package/css.js +41 -20
- package/css.js.map +1 -1
- package/data.cjs +1 -1
- package/data.cjs.map +1 -1
- package/data.js +35 -25
- package/data.js.map +1 -1
- package/date-time.cjs +1 -1
- package/date-time.cjs.map +1 -1
- package/date-time.js +332 -250
- package/date-time.js.map +1 -1
- package/device.cjs +1 -1
- package/device.cjs.map +1 -1
- package/device.js +27 -18
- package/device.js.map +1 -1
- package/encodings.cjs +1 -1
- package/encodings.cjs.map +1 -1
- package/encodings.js +10 -10
- package/encodings.js.map +1 -1
- package/errors.cjs +1 -1
- package/errors.cjs.map +1 -1
- package/errors.js +21 -6
- package/errors.js.map +1 -1
- package/file.cjs +1 -1
- package/file.cjs.map +1 -1
- package/file.js +26 -17
- package/file.js.map +1 -1
- package/format.cjs +1 -1
- package/format.cjs.map +1 -1
- package/format.js +66 -39
- package/format.js.map +1 -1
- package/html.cjs +1 -1
- package/html.cjs.map +1 -1
- package/html.d.ts +1 -1
- package/html.d.ts.map +1 -1
- package/html.js +111 -68
- package/html.js.map +1 -1
- package/id.cjs +1 -2
- package/id.cjs.map +1 -1
- package/id.js +23 -13
- package/id.js.map +1 -1
- package/imports.cjs +1 -1
- package/imports.cjs.map +1 -1
- package/imports.js +27 -18
- package/imports.js.map +1 -1
- package/math.cjs +1 -1
- package/math.cjs.map +1 -1
- package/math.js +10 -8
- package/math.js.map +1 -1
- package/media.cjs +1 -1
- package/media.cjs.map +1 -1
- package/media.js +94 -49
- package/media.js.map +1 -1
- package/mobx.cjs +1 -1
- package/mobx.cjs.map +1 -1
- package/mobx.js +123 -68
- package/mobx.js.map +1 -1
- package/ms.cjs +1 -1
- package/ms.cjs.map +1 -1
- package/ms.js +9 -8
- package/ms.js.map +1 -1
- package/number.cjs +1 -1
- package/number.cjs.map +1 -1
- package/number.js +7 -6
- package/number.js.map +1 -1
- package/package.json +28 -27
- package/parser.cjs +1 -1
- package/parser.cjs.map +1 -1
- package/parser.js +63 -28
- package/parser.js.map +1 -1
- package/price.cjs +1 -1
- package/price.cjs.map +1 -1
- package/price.js +14 -7
- package/price.js.map +1 -1
- package/random.cjs +1 -1
- package/random.cjs.map +1 -1
- package/random.js +22 -9
- package/random.js.map +1 -1
- package/react.cjs +1 -1
- package/react.cjs.map +1 -1
- package/react.js +195 -130
- package/react.js.map +1 -1
- package/sound.cjs +1 -1
- package/sound.cjs.map +1 -1
- package/sound.js +8 -4
- package/sound.js.map +1 -1
- package/text.cjs +1 -1
- package/text.cjs.map +1 -1
- package/text.js +30 -14
- package/text.js.map +1 -1
- package/type-guard.cjs +1 -1
- package/type-guard.cjs.map +1 -1
- package/type-guard.js +58 -38
- package/type-guard.js.map +1 -1
- package/utility-types.d.ts +4 -0
- package/utils/types.d.ts +4 -0
- package/utils/types.d.ts.map +1 -1
- package/vibrate.cjs +1 -1
- package/vibrate.cjs.map +1 -1
- package/vibrate.js +5 -3
- package/vibrate.js.map +1 -1
package/date-time.js
CHANGED
|
@@ -1,314 +1,396 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { format
|
|
3
|
-
import { unitsToMs
|
|
4
|
-
import { declension
|
|
5
|
-
import { typeGuard
|
|
6
|
-
function
|
|
7
|
-
return
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { format } from "yummies/format";
|
|
3
|
+
import { unitsToMs } from "yummies/ms";
|
|
4
|
+
import { declension } from "yummies/text";
|
|
5
|
+
import { typeGuard } from "yummies/type-guard";
|
|
6
|
+
function getDefaultExportFromCjs(x) {
|
|
7
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
8
8
|
}
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, M = function(
|
|
20
|
-
return
|
|
21
|
-
},
|
|
22
|
-
return
|
|
23
|
-
},
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
var duration$2 = { exports: {} };
|
|
10
|
+
var duration$1 = duration$2.exports;
|
|
11
|
+
var hasRequiredDuration;
|
|
12
|
+
function requireDuration() {
|
|
13
|
+
if (hasRequiredDuration) return duration$2.exports;
|
|
14
|
+
hasRequiredDuration = 1;
|
|
15
|
+
(function(module, exports) {
|
|
16
|
+
!function(t, s) {
|
|
17
|
+
module.exports = s();
|
|
18
|
+
}(duration$1, function() {
|
|
19
|
+
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 = { years: u, months: d, days: r, hours: e, minutes: i, seconds: n, milliseconds: 1, weeks: 6048e5 }, c = function(t2) {
|
|
20
|
+
return t2 instanceof g;
|
|
21
|
+
}, f = function(t2, s2, n2) {
|
|
22
|
+
return new g(t2, n2, s2.$l);
|
|
23
|
+
}, m = function(t2) {
|
|
24
|
+
return s.p(t2) + "s";
|
|
25
|
+
}, l = function(t2) {
|
|
26
|
+
return t2 < 0;
|
|
27
|
+
}, $ = function(t2) {
|
|
28
|
+
return l(t2) ? Math.ceil(t2) : Math.floor(t2);
|
|
29
|
+
}, y = function(t2) {
|
|
30
|
+
return Math.abs(t2);
|
|
31
|
+
}, v = function(t2, s2) {
|
|
32
|
+
return t2 ? l(t2) ? { negative: true, format: "" + y(t2) + s2 } : { negative: false, format: "" + t2 + s2 } : { negative: false, format: "" };
|
|
33
|
+
}, g = function() {
|
|
34
|
+
function l2(t2, s2, n2) {
|
|
35
|
+
var i2 = this;
|
|
36
|
+
if (this.$d = {}, this.$l = n2, void 0 === t2 && (this.$ms = 0, this.parseFromMilliseconds()), s2) return f(t2 * h[m(s2)], this);
|
|
37
|
+
if ("number" == typeof t2) return this.$ms = t2, this.parseFromMilliseconds(), this;
|
|
38
|
+
if ("object" == typeof t2) return Object.keys(t2).forEach(function(s3) {
|
|
39
|
+
i2.$d[m(s3)] = t2[s3];
|
|
36
40
|
}), this.calMilliseconds(), this;
|
|
37
|
-
if (
|
|
38
|
-
var
|
|
39
|
-
if (
|
|
40
|
-
var
|
|
41
|
-
return
|
|
41
|
+
if ("string" == typeof t2) {
|
|
42
|
+
var e2 = t2.match(a);
|
|
43
|
+
if (e2) {
|
|
44
|
+
var r2 = e2.slice(2).map(function(t3) {
|
|
45
|
+
return null != t3 ? Number(t3) : 0;
|
|
42
46
|
});
|
|
43
|
-
return this.$d.years =
|
|
47
|
+
return this.$d.years = r2[0], this.$d.months = r2[1], this.$d.weeks = r2[2], this.$d.days = r2[3], this.$d.hours = r2[4], this.$d.minutes = r2[5], this.$d.seconds = r2[6], this.calMilliseconds(), this;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
return this;
|
|
47
51
|
}
|
|
48
|
-
var
|
|
49
|
-
return
|
|
50
|
-
var
|
|
51
|
-
this.$ms = Object.keys(this.$d).reduce(function(
|
|
52
|
-
return
|
|
52
|
+
var y2 = l2.prototype;
|
|
53
|
+
return y2.calMilliseconds = function() {
|
|
54
|
+
var t2 = this;
|
|
55
|
+
this.$ms = Object.keys(this.$d).reduce(function(s2, n2) {
|
|
56
|
+
return s2 + (t2.$d[n2] || 0) * h[n2];
|
|
53
57
|
}, 0);
|
|
54
|
-
},
|
|
55
|
-
var
|
|
56
|
-
this.$d.years =
|
|
57
|
-
},
|
|
58
|
-
var
|
|
59
|
-
this.$d.weeks && (
|
|
60
|
-
var
|
|
61
|
-
this.$d.milliseconds && (
|
|
62
|
-
var
|
|
63
|
-
return
|
|
64
|
-
},
|
|
58
|
+
}, y2.parseFromMilliseconds = function() {
|
|
59
|
+
var t2 = this.$ms;
|
|
60
|
+
this.$d.years = $(t2 / u), t2 %= u, this.$d.months = $(t2 / d), t2 %= d, this.$d.days = $(t2 / r), t2 %= r, this.$d.hours = $(t2 / e), t2 %= e, this.$d.minutes = $(t2 / i), t2 %= i, this.$d.seconds = $(t2 / n), t2 %= n, this.$d.milliseconds = t2;
|
|
61
|
+
}, y2.toISOString = function() {
|
|
62
|
+
var t2 = v(this.$d.years, "Y"), s2 = v(this.$d.months, "M"), n2 = +this.$d.days || 0;
|
|
63
|
+
this.$d.weeks && (n2 += 7 * this.$d.weeks);
|
|
64
|
+
var i2 = v(n2, "D"), e2 = v(this.$d.hours, "H"), r2 = v(this.$d.minutes, "M"), o2 = this.$d.seconds || 0;
|
|
65
|
+
this.$d.milliseconds && (o2 += this.$d.milliseconds / 1e3, o2 = Math.round(1e3 * o2) / 1e3);
|
|
66
|
+
var u2 = v(o2, "S"), d2 = t2.negative || s2.negative || i2.negative || e2.negative || r2.negative || u2.negative, a2 = e2.format || r2.format || u2.format ? "T" : "", h2 = (d2 ? "-" : "") + "P" + t2.format + s2.format + i2.format + a2 + e2.format + r2.format + u2.format;
|
|
67
|
+
return "P" === h2 || "-P" === h2 ? "P0D" : h2;
|
|
68
|
+
}, y2.toJSON = function() {
|
|
65
69
|
return this.toISOString();
|
|
66
|
-
},
|
|
67
|
-
var
|
|
68
|
-
return
|
|
69
|
-
return
|
|
70
|
+
}, y2.format = function(t2) {
|
|
71
|
+
var n2 = t2 || "YYYY-MM-DDTHH:mm:ss", i2 = { Y: this.$d.years, YY: s.s(this.$d.years, 2, "0"), YYYY: s.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s.s(this.$d.seconds, 2, "0"), SSS: s.s(this.$d.milliseconds, 3, "0") };
|
|
72
|
+
return n2.replace(o, function(t3, s2) {
|
|
73
|
+
return s2 || String(i2[t3]);
|
|
70
74
|
});
|
|
71
|
-
},
|
|
72
|
-
return this.$ms /
|
|
73
|
-
},
|
|
74
|
-
var
|
|
75
|
-
return
|
|
76
|
-
},
|
|
77
|
-
var
|
|
78
|
-
return
|
|
79
|
-
},
|
|
80
|
-
return this.add(
|
|
81
|
-
},
|
|
82
|
-
var
|
|
83
|
-
return
|
|
84
|
-
},
|
|
85
|
-
return
|
|
86
|
-
},
|
|
87
|
-
return
|
|
88
|
-
},
|
|
75
|
+
}, y2.as = function(t2) {
|
|
76
|
+
return this.$ms / h[m(t2)];
|
|
77
|
+
}, y2.get = function(t2) {
|
|
78
|
+
var s2 = this.$ms, n2 = m(t2);
|
|
79
|
+
return "milliseconds" === n2 ? s2 %= 1e3 : s2 = "weeks" === n2 ? $(s2 / h[n2]) : this.$d[n2], s2 || 0;
|
|
80
|
+
}, y2.add = function(t2, s2, n2) {
|
|
81
|
+
var i2;
|
|
82
|
+
return i2 = s2 ? t2 * h[m(s2)] : c(t2) ? t2.$ms : f(t2, this).$ms, f(this.$ms + i2 * (n2 ? -1 : 1), this);
|
|
83
|
+
}, y2.subtract = function(t2, s2) {
|
|
84
|
+
return this.add(t2, s2, true);
|
|
85
|
+
}, y2.locale = function(t2) {
|
|
86
|
+
var s2 = this.clone();
|
|
87
|
+
return s2.$l = t2, s2;
|
|
88
|
+
}, y2.clone = function() {
|
|
89
|
+
return f(this.$ms, this);
|
|
90
|
+
}, y2.humanize = function(s2) {
|
|
91
|
+
return t().add(this.$ms, "ms").locale(this.$l).fromNow(!s2);
|
|
92
|
+
}, y2.valueOf = function() {
|
|
89
93
|
return this.asMilliseconds();
|
|
90
|
-
},
|
|
94
|
+
}, y2.milliseconds = function() {
|
|
91
95
|
return this.get("milliseconds");
|
|
92
|
-
},
|
|
96
|
+
}, y2.asMilliseconds = function() {
|
|
93
97
|
return this.as("milliseconds");
|
|
94
|
-
},
|
|
98
|
+
}, y2.seconds = function() {
|
|
95
99
|
return this.get("seconds");
|
|
96
|
-
},
|
|
100
|
+
}, y2.asSeconds = function() {
|
|
97
101
|
return this.as("seconds");
|
|
98
|
-
},
|
|
102
|
+
}, y2.minutes = function() {
|
|
99
103
|
return this.get("minutes");
|
|
100
|
-
},
|
|
104
|
+
}, y2.asMinutes = function() {
|
|
101
105
|
return this.as("minutes");
|
|
102
|
-
},
|
|
106
|
+
}, y2.hours = function() {
|
|
103
107
|
return this.get("hours");
|
|
104
|
-
},
|
|
108
|
+
}, y2.asHours = function() {
|
|
105
109
|
return this.as("hours");
|
|
106
|
-
},
|
|
110
|
+
}, y2.days = function() {
|
|
107
111
|
return this.get("days");
|
|
108
|
-
},
|
|
112
|
+
}, y2.asDays = function() {
|
|
109
113
|
return this.as("days");
|
|
110
|
-
},
|
|
114
|
+
}, y2.weeks = function() {
|
|
111
115
|
return this.get("weeks");
|
|
112
|
-
},
|
|
116
|
+
}, y2.asWeeks = function() {
|
|
113
117
|
return this.as("weeks");
|
|
114
|
-
},
|
|
118
|
+
}, y2.months = function() {
|
|
115
119
|
return this.get("months");
|
|
116
|
-
},
|
|
120
|
+
}, y2.asMonths = function() {
|
|
117
121
|
return this.as("months");
|
|
118
|
-
},
|
|
122
|
+
}, y2.years = function() {
|
|
119
123
|
return this.get("years");
|
|
120
|
-
},
|
|
124
|
+
}, y2.asYears = function() {
|
|
121
125
|
return this.as("years");
|
|
122
|
-
},
|
|
123
|
-
}(),
|
|
124
|
-
return
|
|
126
|
+
}, l2;
|
|
127
|
+
}(), p = function(t2, s2, n2) {
|
|
128
|
+
return t2.add(s2.years() * n2, "y").add(s2.months() * n2, "M").add(s2.days() * n2, "d").add(s2.hours() * n2, "h").add(s2.minutes() * n2, "m").add(s2.seconds() * n2, "s").add(s2.milliseconds() * n2, "ms");
|
|
125
129
|
};
|
|
126
|
-
return function(
|
|
127
|
-
|
|
128
|
-
var
|
|
129
|
-
return
|
|
130
|
-
},
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
},
|
|
135
|
-
return
|
|
130
|
+
return function(n2, i2, e2) {
|
|
131
|
+
t = e2, s = e2().$utils(), e2.duration = function(t2, s2) {
|
|
132
|
+
var n3 = e2.locale();
|
|
133
|
+
return f(t2, { $l: n3 }, s2);
|
|
134
|
+
}, e2.isDuration = c;
|
|
135
|
+
var r2 = i2.prototype.add, o2 = i2.prototype.subtract;
|
|
136
|
+
i2.prototype.add = function(t2, s2) {
|
|
137
|
+
return c(t2) ? p(this, t2, 1) : r2.bind(this)(t2, s2);
|
|
138
|
+
}, i2.prototype.subtract = function(t2, s2) {
|
|
139
|
+
return c(t2) ? p(this, t2, -1) : o2.bind(this)(t2, s2);
|
|
136
140
|
};
|
|
137
141
|
};
|
|
138
142
|
});
|
|
139
|
-
}(
|
|
143
|
+
})(duration$2);
|
|
144
|
+
return duration$2.exports;
|
|
140
145
|
}
|
|
141
|
-
var
|
|
142
|
-
const
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
var durationExports = requireDuration();
|
|
147
|
+
const duration = /* @__PURE__ */ getDefaultExportFromCjs(durationExports);
|
|
148
|
+
var relativeTime$2 = { exports: {} };
|
|
149
|
+
var relativeTime$1 = relativeTime$2.exports;
|
|
150
|
+
var hasRequiredRelativeTime;
|
|
151
|
+
function requireRelativeTime() {
|
|
152
|
+
if (hasRequiredRelativeTime) return relativeTime$2.exports;
|
|
153
|
+
hasRequiredRelativeTime = 1;
|
|
154
|
+
(function(module, exports) {
|
|
155
|
+
!function(r, e) {
|
|
156
|
+
module.exports = e();
|
|
157
|
+
}(relativeTime$1, function() {
|
|
158
|
+
return function(r, e, t) {
|
|
159
|
+
r = r || {};
|
|
160
|
+
var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
|
|
161
|
+
function i(r2, e2, t2, o2) {
|
|
162
|
+
return n.fromToBase(r2, e2, t2, o2);
|
|
154
163
|
}
|
|
155
|
-
|
|
156
|
-
for (var
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
+
t.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
|
|
165
|
+
for (var f, a, s, l = i2.$locale().relativeTime || o, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h.length, c = 0; c < m; c += 1) {
|
|
166
|
+
var y = h[c];
|
|
167
|
+
y.d && (f = d2 ? t(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
|
|
168
|
+
var p = (r.rounding || Math.round)(Math.abs(f));
|
|
169
|
+
if (s = f > 0, p <= y.r || !y.r) {
|
|
170
|
+
p <= 1 && c > 0 && (y = h[c - 1]);
|
|
171
|
+
var v = l[y.l];
|
|
172
|
+
u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
|
|
164
173
|
break;
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
|
-
if (
|
|
168
|
-
var
|
|
169
|
-
return
|
|
170
|
-
},
|
|
171
|
-
return
|
|
172
|
-
},
|
|
173
|
-
return
|
|
176
|
+
if (n2) return a;
|
|
177
|
+
var M = s ? l.future : l.past;
|
|
178
|
+
return "function" == typeof M ? M(a) : M.replace("%s", a);
|
|
179
|
+
}, n.to = function(r2, e2) {
|
|
180
|
+
return i(r2, e2, this, true);
|
|
181
|
+
}, n.from = function(r2, e2) {
|
|
182
|
+
return i(r2, e2, this);
|
|
174
183
|
};
|
|
175
|
-
var
|
|
176
|
-
return
|
|
184
|
+
var d = function(r2) {
|
|
185
|
+
return r2.$u ? t.utc() : t();
|
|
177
186
|
};
|
|
178
|
-
|
|
179
|
-
return this.to(
|
|
180
|
-
},
|
|
181
|
-
return this.from(
|
|
187
|
+
n.toNow = function(r2) {
|
|
188
|
+
return this.to(d(this), r2);
|
|
189
|
+
}, n.fromNow = function(r2) {
|
|
190
|
+
return this.from(d(this), r2);
|
|
182
191
|
};
|
|
183
192
|
};
|
|
184
193
|
});
|
|
185
|
-
}(
|
|
194
|
+
})(relativeTime$2);
|
|
195
|
+
return relativeTime$2.exports;
|
|
186
196
|
}
|
|
187
|
-
var
|
|
188
|
-
const
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
var relativeTimeExports = requireRelativeTime();
|
|
198
|
+
const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
|
|
199
|
+
var ru$1 = { exports: {} };
|
|
200
|
+
var ru = ru$1.exports;
|
|
201
|
+
var hasRequiredRu;
|
|
202
|
+
function requireRu() {
|
|
203
|
+
if (hasRequiredRu) return ru$1.exports;
|
|
204
|
+
hasRequiredRu = 1;
|
|
205
|
+
(function(module, exports) {
|
|
206
|
+
!function(_, t) {
|
|
207
|
+
module.exports = t(dayjs);
|
|
208
|
+
}(ru, function(_) {
|
|
209
|
+
function t(_2) {
|
|
210
|
+
return _2 && "object" == typeof _2 && "default" in _2 ? _2 : { default: _2 };
|
|
197
211
|
}
|
|
198
|
-
var
|
|
199
|
-
function
|
|
200
|
-
var
|
|
201
|
-
return
|
|
212
|
+
var e = t(_), n = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"), s = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"), r = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"), o = "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_"), i = /D[oD]?(\[[^[\]]*\]|\s)+MMMM?/;
|
|
213
|
+
function d(_2, t2, e2) {
|
|
214
|
+
var n2, s2;
|
|
215
|
+
return "m" === e2 ? t2 ? "минута" : "минуту" : _2 + " " + (n2 = +_2, s2 = { mm: t2 ? "минута_минуты_минут" : "минуту_минуты_минут", hh: "час_часа_часов", dd: "день_дня_дней", MM: "месяц_месяца_месяцев", yy: "год_года_лет" }[e2].split("_"), n2 % 10 == 1 && n2 % 100 != 11 ? s2[0] : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? s2[1] : s2[2]);
|
|
202
216
|
}
|
|
203
|
-
var
|
|
204
|
-
return
|
|
217
|
+
var u = function(_2, t2) {
|
|
218
|
+
return i.test(t2) ? n[_2.month()] : s[_2.month()];
|
|
205
219
|
};
|
|
206
|
-
|
|
207
|
-
var
|
|
208
|
-
return
|
|
220
|
+
u.s = s, u.f = n;
|
|
221
|
+
var a = function(_2, t2) {
|
|
222
|
+
return i.test(t2) ? r[_2.month()] : o[_2.month()];
|
|
209
223
|
};
|
|
210
|
-
|
|
211
|
-
var
|
|
212
|
-
return
|
|
213
|
-
}, meridiem: function(
|
|
214
|
-
return
|
|
224
|
+
a.s = o, a.f = r;
|
|
225
|
+
var m = { name: "ru", weekdays: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"), weekdaysShort: "вск_пнд_втр_срд_чтв_птн_сбт".split("_"), weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"), months: u, monthsShort: a, weekStart: 1, yearStart: 4, formats: { LT: "H:mm", LTS: "H:mm:ss", L: "DD.MM.YYYY", LL: "D MMMM YYYY г.", LLL: "D MMMM YYYY г., H:mm", LLLL: "dddd, D MMMM YYYY г., H:mm" }, relativeTime: { future: "через %s", past: "%s назад", s: "несколько секунд", m: d, mm: d, h: "час", hh: d, d: "день", dd: d, M: "месяц", MM: d, y: "год", yy: d }, ordinal: function(_2) {
|
|
226
|
+
return _2;
|
|
227
|
+
}, meridiem: function(_2) {
|
|
228
|
+
return _2 < 4 ? "ночи" : _2 < 12 ? "утра" : _2 < 17 ? "дня" : "вечера";
|
|
215
229
|
} };
|
|
216
|
-
return
|
|
230
|
+
return e.default.locale(m, null, true), m;
|
|
217
231
|
});
|
|
218
|
-
}(
|
|
232
|
+
})(ru$1);
|
|
233
|
+
return ru$1.exports;
|
|
219
234
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return r.fromNow(!0);
|
|
235
|
-
case "full":
|
|
236
|
-
return r.format("DD MMM YYYY HH:mm:ss");
|
|
237
|
-
case "short":
|
|
238
|
-
return r.format("DD MMM HH:mm");
|
|
239
|
-
case "time":
|
|
240
|
-
return r.format("HH:mm:ss");
|
|
241
|
-
case "time-short":
|
|
242
|
-
return r.format("HH:mm");
|
|
243
|
-
case "day":
|
|
244
|
-
return r.format("DD MMM YYYY");
|
|
245
|
-
case "month":
|
|
246
|
-
return r.format("MMMM YYYY");
|
|
247
|
-
default:
|
|
248
|
-
return r.format("DD.MM.YYYY");
|
|
235
|
+
requireRu();
|
|
236
|
+
dayjs.extend(relativeTime);
|
|
237
|
+
dayjs.extend(duration);
|
|
238
|
+
dayjs.locale("ru");
|
|
239
|
+
const toLibFormat = (value, asTime) => {
|
|
240
|
+
if (typeGuard.isNumber(value)) {
|
|
241
|
+
if (asTime) {
|
|
242
|
+
return dayjs.duration(value);
|
|
243
|
+
}
|
|
244
|
+
return dayjs(value);
|
|
245
|
+
} else if (dayjs.isDayjs(value)) {
|
|
246
|
+
return value;
|
|
247
|
+
} else {
|
|
248
|
+
return dayjs(value);
|
|
249
249
|
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
250
|
+
};
|
|
251
|
+
const formatDate = (value, settings) => {
|
|
252
|
+
const dateFormat = settings?.format;
|
|
253
|
+
const datePattern = settings?.pattern;
|
|
254
|
+
const asTime = settings?.asTime;
|
|
255
|
+
value = toLibFormat(value, asTime);
|
|
256
|
+
if (typeGuard.isUndefined(value) || !value.isValid()) {
|
|
257
|
+
return format.NO_VALUE;
|
|
258
|
+
}
|
|
259
|
+
if (datePattern) {
|
|
260
|
+
return value.format(datePattern);
|
|
261
|
+
}
|
|
262
|
+
switch (dateFormat) {
|
|
263
|
+
case "human": {
|
|
264
|
+
return value.fromNow();
|
|
265
|
+
}
|
|
266
|
+
case "spent-time": {
|
|
267
|
+
return value.fromNow(true);
|
|
268
|
+
}
|
|
269
|
+
case "full": {
|
|
270
|
+
return value.format("DD MMM YYYY HH:mm:ss");
|
|
271
|
+
}
|
|
272
|
+
case "short": {
|
|
273
|
+
return value.format("DD MMM HH:mm");
|
|
274
|
+
}
|
|
275
|
+
case "time": {
|
|
276
|
+
return value.format("HH:mm:ss");
|
|
277
|
+
}
|
|
278
|
+
case "time-short": {
|
|
279
|
+
return value.format("HH:mm");
|
|
280
|
+
}
|
|
281
|
+
case "day": {
|
|
282
|
+
return value.format("DD MMM YYYY");
|
|
283
|
+
}
|
|
284
|
+
case "month": {
|
|
285
|
+
return value.format("MMMM YYYY");
|
|
286
|
+
}
|
|
287
|
+
default: {
|
|
288
|
+
return value.format("DD.MM.YYYY");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const dayTimeDuration = (timeInMs) => {
|
|
293
|
+
let left = Math.max(timeInMs, 0);
|
|
294
|
+
const days = Math.floor(left / unitsToMs.day);
|
|
295
|
+
left = left % unitsToMs.day;
|
|
296
|
+
const hours = Math.floor(left / unitsToMs.hour);
|
|
297
|
+
left = left % unitsToMs.hour;
|
|
298
|
+
const minutes = Math.floor(left / unitsToMs.min);
|
|
299
|
+
left = left % unitsToMs.min;
|
|
300
|
+
const seconds = Math.floor(left / unitsToMs.sec);
|
|
301
|
+
left = left % unitsToMs.sec;
|
|
302
|
+
const milliseconds = Math.floor(left);
|
|
261
303
|
return {
|
|
262
|
-
days
|
|
263
|
-
hours
|
|
264
|
-
minutes
|
|
265
|
-
seconds
|
|
266
|
-
milliseconds
|
|
304
|
+
days,
|
|
305
|
+
hours,
|
|
306
|
+
minutes,
|
|
307
|
+
seconds,
|
|
308
|
+
milliseconds
|
|
267
309
|
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
310
|
+
};
|
|
311
|
+
const changeDate = (date, ...args) => {
|
|
312
|
+
let wrappedDate = toLibFormat(date);
|
|
313
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
314
|
+
const amount = args[i];
|
|
315
|
+
const unit = args[i + 1];
|
|
316
|
+
if (unit != null) {
|
|
317
|
+
wrappedDate = wrappedDate.add(amount, unit);
|
|
318
|
+
}
|
|
273
319
|
}
|
|
274
|
-
return
|
|
275
|
-
}
|
|
276
|
-
|
|
320
|
+
return wrappedDate.toDate();
|
|
321
|
+
};
|
|
322
|
+
const timeDuration = (timeInMs) => {
|
|
323
|
+
const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
|
|
277
324
|
return {
|
|
278
|
-
hours:
|
|
279
|
-
milliseconds
|
|
280
|
-
minutes
|
|
281
|
-
seconds
|
|
325
|
+
hours: hours + unitsToMs.day * days,
|
|
326
|
+
milliseconds,
|
|
327
|
+
minutes,
|
|
328
|
+
seconds
|
|
282
329
|
};
|
|
283
|
-
}
|
|
330
|
+
};
|
|
331
|
+
const durationFormatLabels = {
|
|
284
332
|
days: { compact: "д", full: ["день", "дня", "дней"] },
|
|
285
333
|
hours: { compact: "ч", full: ["час", "часа", "часов"] },
|
|
286
334
|
minutes: { compact: "мин", full: ["минута", "минуты", "минут"] },
|
|
287
335
|
seconds: { compact: "сек", full: ["секунда", "секунды", "секунд"] }
|
|
288
336
|
};
|
|
289
|
-
function
|
|
290
|
-
let
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
337
|
+
function getFormatDuration(...args) {
|
|
338
|
+
let compact = false;
|
|
339
|
+
let diff = 0;
|
|
340
|
+
if (args[0] instanceof Date) {
|
|
341
|
+
const startedDate = dayjs(args[0]);
|
|
342
|
+
const endedDate = dayjs(args[1]);
|
|
343
|
+
diff = endedDate.diff(startedDate, "ms");
|
|
344
|
+
compact = args[2] === true;
|
|
345
|
+
} else {
|
|
346
|
+
diff = args[0];
|
|
347
|
+
compact = args[1] === true;
|
|
348
|
+
}
|
|
349
|
+
const { days, hours, minutes, seconds } = dayTimeDuration(diff);
|
|
350
|
+
const formattedParts = [];
|
|
351
|
+
if (days) {
|
|
352
|
+
if (compact) {
|
|
353
|
+
formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
|
|
354
|
+
} else {
|
|
355
|
+
formattedParts.push(
|
|
356
|
+
`${days} ${declension(days, durationFormatLabels.days.full)}`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (hours) {
|
|
361
|
+
if (compact) {
|
|
362
|
+
formattedParts.push(`${hours} ${durationFormatLabels.hours.compact}`);
|
|
363
|
+
} else {
|
|
364
|
+
formattedParts.push(
|
|
365
|
+
`${hours} ${declension(hours, durationFormatLabels.hours.full)}`
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (minutes) {
|
|
370
|
+
if (compact) {
|
|
371
|
+
formattedParts.push(`${minutes} ${durationFormatLabels.minutes.compact}`);
|
|
372
|
+
} else {
|
|
373
|
+
formattedParts.push(
|
|
374
|
+
`${minutes} ${declension(minutes, durationFormatLabels.minutes.full)}`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (seconds) {
|
|
379
|
+
if (compact) {
|
|
380
|
+
formattedParts.push(`${seconds} ${durationFormatLabels.seconds.compact}`);
|
|
381
|
+
} else {
|
|
382
|
+
formattedParts.push(
|
|
383
|
+
`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return formattedParts.join(" ");
|
|
306
388
|
}
|
|
307
389
|
export {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
390
|
+
changeDate,
|
|
391
|
+
dayTimeDuration,
|
|
392
|
+
formatDate,
|
|
393
|
+
getFormatDuration,
|
|
394
|
+
timeDuration
|
|
313
395
|
};
|
|
314
396
|
//# sourceMappingURL=date-time.js.map
|