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.
Files changed (154) hide show
  1. package/async.cjs +162 -48
  2. package/async.cjs.map +1 -1
  3. package/async.d.ts +112 -13
  4. package/async.js +163 -54
  5. package/async.js.map +1 -1
  6. package/chunk-CVq3Gv4J.cjs +50 -0
  7. package/chunk-YKewjYmz.js +37 -0
  8. package/common.cjs +48 -8
  9. package/common.cjs.map +1 -1
  10. package/common.d.ts +35 -2
  11. package/common.js +49 -11
  12. package/common.js.map +1 -1
  13. package/complex.cjs +275 -104
  14. package/complex.cjs.map +1 -1
  15. package/complex.d.ts +133 -13
  16. package/complex.js +275 -109
  17. package/complex.js.map +1 -1
  18. package/cookie.cjs +17 -7
  19. package/cookie.cjs.map +1 -1
  20. package/cookie.d.ts +8 -0
  21. package/cookie.js +18 -9
  22. package/cookie.js.map +1 -1
  23. package/css.cjs +147 -39
  24. package/css.cjs.map +1 -1
  25. package/css.d.ts +98 -6
  26. package/css.js +143 -41
  27. package/css.js.map +1 -1
  28. package/data.cjs +90 -55
  29. package/data.cjs.map +1 -1
  30. package/data.d.ts +32 -0
  31. package/data.js +91 -61
  32. package/data.js.map +1 -1
  33. package/date-time.cjs +578 -412
  34. package/date-time.cjs.map +1 -1
  35. package/date-time.d.ts +88 -0
  36. package/date-time.js +575 -421
  37. package/date-time.js.map +1 -1
  38. package/device.cjs +48 -23
  39. package/device.cjs.map +1 -1
  40. package/device.d.ts +32 -0
  41. package/device.js +49 -31
  42. package/device.js.map +1 -1
  43. package/encodings.cjs +275 -266
  44. package/encodings.cjs.map +1 -1
  45. package/encodings.d.ts +8 -0
  46. package/encodings.js +276 -268
  47. package/encodings.js.map +1 -1
  48. package/errors.cjs +20 -18
  49. package/errors.cjs.map +1 -1
  50. package/errors.js +19 -19
  51. package/errors.js.map +1 -1
  52. package/file.cjs +42 -24
  53. package/file.cjs.map +1 -1
  54. package/file.d.ts +16 -0
  55. package/file.js +43 -27
  56. package/file.js.map +1 -1
  57. package/format.cjs +125 -83
  58. package/format.cjs.map +1 -1
  59. package/format.d.ts +89 -4
  60. package/format.js +118 -82
  61. package/format.js.map +1 -1
  62. package/html.cjs +226 -137
  63. package/html.cjs.map +1 -1
  64. package/html.d.ts +67 -3
  65. package/html.js +223 -150
  66. package/html.js.map +1 -1
  67. package/id.cjs +74 -17
  68. package/id.cjs.map +1 -1
  69. package/id.d.ts +10 -10
  70. package/id.js +73 -24
  71. package/id.js.map +1 -1
  72. package/imports.cjs +41 -29
  73. package/imports.cjs.map +1 -1
  74. package/imports.d.ts +13 -4
  75. package/imports.js +40 -31
  76. package/imports.js.map +1 -1
  77. package/math.cjs +32 -6
  78. package/math.cjs.map +1 -1
  79. package/math.d.ts +17 -1
  80. package/math.js +33 -10
  81. package/math.js.map +1 -1
  82. package/media.cjs +275 -84
  83. package/media.cjs.map +1 -1
  84. package/media.d.ts +188 -2
  85. package/media.js +274 -93
  86. package/media.js.map +1 -1
  87. package/mobx.cjs +353 -193
  88. package/mobx.cjs.map +1 -1
  89. package/mobx.d.ts +172 -6
  90. package/mobx.js +351 -200
  91. package/mobx.js.map +1 -1
  92. package/ms.cjs +21 -10
  93. package/ms.cjs.map +1 -1
  94. package/ms.d.ts +1 -1
  95. package/ms.js +22 -13
  96. package/ms.js.map +1 -1
  97. package/number.cjs +13 -7
  98. package/number.cjs.map +1 -1
  99. package/number.js +14 -9
  100. package/number.js.map +1 -1
  101. package/package.json +13 -5
  102. package/parser.cjs +117 -64
  103. package/parser.cjs.map +1 -1
  104. package/parser.d.ts +63 -0
  105. package/parser.js +111 -64
  106. package/parser.js.map +1 -1
  107. package/price.cjs +24 -18
  108. package/price.cjs.map +1 -1
  109. package/price.d.ts +8 -0
  110. package/price.js +25 -20
  111. package/price.js.map +1 -1
  112. package/random.cjs +79 -13
  113. package/random.cjs.map +1 -1
  114. package/random.d.ts +64 -0
  115. package/random.js +80 -22
  116. package/random.js.map +1 -1
  117. package/react.cjs +673 -214
  118. package/react.cjs.map +1 -1
  119. package/react.d.ts +428 -9
  120. package/react.js +674 -239
  121. package/react.js.map +1 -1
  122. package/sound.cjs +14 -9
  123. package/sound.cjs.map +1 -1
  124. package/sound.d.ts +1 -1
  125. package/sound.js +15 -11
  126. package/sound.js.map +1 -1
  127. package/storage.cjs +49 -50
  128. package/storage.cjs.map +1 -1
  129. package/storage.d.ts +15 -6
  130. package/storage.js +50 -53
  131. package/storage.js.map +1 -1
  132. package/text.cjs +51 -34
  133. package/text.cjs.map +1 -1
  134. package/text.d.ts +5 -5
  135. package/text.js +52 -37
  136. package/text.js.map +1 -1
  137. package/type-guard.cjs +292 -72
  138. package/type-guard.cjs.map +1 -1
  139. package/type-guard.d.ts +199 -42
  140. package/type-guard.js +288 -73
  141. package/type-guard.js.map +1 -1
  142. package/types.cjs +0 -2
  143. package/types.global.cjs +0 -2
  144. package/types.global.js +0 -2
  145. package/types.js +0 -2
  146. package/vibrate.cjs +31 -6
  147. package/vibrate.cjs.map +1 -1
  148. package/vibrate.d.ts +23 -1
  149. package/vibrate.js +32 -8
  150. package/vibrate.js.map +1 -1
  151. package/types.cjs.map +0 -1
  152. package/types.global.cjs.map +0 -1
  153. package/types.global.js.map +0 -1
  154. package/types.js.map +0 -1
package/date-time.js CHANGED
@@ -1,433 +1,587 @@
1
- import dayjs from "dayjs";
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 { unitsToMs, ms } from "yummies/ms";
4
+ import dayjs from "dayjs";
5
+ import { ms, unitsToMs } from "yummies/ms";
4
6
  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
- }
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];
40
- })), this.calMilliseconds(), this;
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;
46
- }));
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;
48
- }
49
- }
50
- return this;
51
- }
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];
57
- }), 0);
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() {
69
- return this.toISOString();
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]);
74
- }));
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() {
93
- return this.asMilliseconds();
94
- }, y2.milliseconds = function() {
95
- return this.get("milliseconds");
96
- }, y2.asMilliseconds = function() {
97
- return this.as("milliseconds");
98
- }, y2.seconds = function() {
99
- return this.get("seconds");
100
- }, y2.asSeconds = function() {
101
- return this.as("seconds");
102
- }, y2.minutes = function() {
103
- return this.get("minutes");
104
- }, y2.asMinutes = function() {
105
- return this.as("minutes");
106
- }, y2.hours = function() {
107
- return this.get("hours");
108
- }, y2.asHours = function() {
109
- return this.as("hours");
110
- }, y2.days = function() {
111
- return this.get("days");
112
- }, y2.asDays = function() {
113
- return this.as("days");
114
- }, y2.weeks = function() {
115
- return this.get("weeks");
116
- }, y2.asWeeks = function() {
117
- return this.as("weeks");
118
- }, y2.months = function() {
119
- return this.get("months");
120
- }, y2.asMonths = function() {
121
- return this.as("months");
122
- }, y2.years = function() {
123
- return this.get("years");
124
- }, y2.asYears = function() {
125
- return this.as("years");
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");
129
- };
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);
140
- };
141
- };
142
- }));
143
- })(duration$2);
144
- return duration$2.exports;
145
- }
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);
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);
173
- break;
174
- }
175
- }
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);
183
- };
184
- var d = function(r2) {
185
- return r2.$u ? t.utc() : t();
186
- };
187
- n.toNow = function(r2) {
188
- return this.to(d(this), r2);
189
- }, n.fromNow = function(r2) {
190
- return this.from(d(this), r2);
191
- };
192
- };
193
- }));
194
- })(relativeTime$2);
195
- return relativeTime$2.exports;
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 };
211
- }
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]);
216
- }
217
- var u = function(_2, t2) {
218
- return i.test(t2) ? n[_2.month()] : s[_2.month()];
219
- };
220
- u.s = s, u.f = n;
221
- var a = function(_2, t2) {
222
- return i.test(t2) ? r[_2.month()] : o[_2.month()];
223
- };
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 ? "дня" : "вечера";
229
- } };
230
- return e.default.locale(m, null, true), m;
231
- }));
232
- })(ru$1);
233
- return ru$1.exports;
234
- }
235
- requireRu();
236
- dayjs.extend(relativeTime);
237
- dayjs.extend(duration);
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
- const toLibFormat = (value) => {
240
- let result = null;
241
- if (dayjs.isDayjs(value)) {
242
- result = value;
243
- } else if (value != null) {
244
- result = dayjs(value);
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
- const formatDate = (value, settings) => {
252
- const dateFormat = settings?.format;
253
- const datePattern = settings?.pattern;
254
- const asTime = settings?.asTime;
255
- let libDate = null;
256
- if (asTime && typeGuard.isNumber(value)) {
257
- libDate = dayjs.duration(value);
258
- } else {
259
- libDate = toLibFormat(value);
260
- }
261
- if (!libDate) {
262
- return format.NO_VALUE;
263
- }
264
- if (datePattern) {
265
- return libDate.format(datePattern);
266
- }
267
- if (dateFormat === "human" || dateFormat === "spent-time") {
268
- if ("fromNow" in libDate) {
269
- return libDate.fromNow(dateFormat === "spent-time");
270
- } else {
271
- return format.NO_VALUE;
272
- }
273
- }
274
- switch (dateFormat) {
275
- case "full": {
276
- return libDate.format("DD MMM YYYY HH:mm:ss");
277
- }
278
- case "short": {
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
- const dayTimeDuration = (timeInMs) => {
299
- let left = Math.max(timeInMs, 0);
300
- const days = Math.floor(left / unitsToMs.day);
301
- left = left % unitsToMs.day;
302
- const hours = Math.floor(left / unitsToMs.hour);
303
- left = left % unitsToMs.hour;
304
- const minutes = Math.floor(left / unitsToMs.min);
305
- left = left % unitsToMs.min;
306
- const seconds = Math.floor(left / unitsToMs.sec);
307
- left = left % unitsToMs.sec;
308
- const milliseconds = Math.floor(left);
309
- return {
310
- days,
311
- hours,
312
- minutes,
313
- seconds,
314
- milliseconds
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
- const changeDate = (date, ...args) => {
318
- let wrappedDate = toLibFormat(date);
319
- for (let i = 0; i < args.length; i += 2) {
320
- const amount = args[i];
321
- const unit = args[i + 1];
322
- if (unit != null) {
323
- wrappedDate = wrappedDate.add(amount, unit);
324
- }
325
- }
326
- return wrappedDate.toDate();
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
- const timeDuration = (timeInMs) => {
329
- const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
330
- return {
331
- hours: hours + unitsToMs.day * days,
332
- milliseconds,
333
- minutes,
334
- seconds
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
- const durationFormatLabels = {
338
- days: { compact: "д", full: ["день", "дня", "дней"] },
339
- hours: { compact: "ч", full: ["час", "часа", "часов"] },
340
- minutes: { compact: "мин", full: ["минута", "минуты", "минут"] },
341
- seconds: { compact: "сек", full: ["секунда", "секунды", "секунд"] }
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
- let compact = false;
345
- let diff = 0;
346
- if (args[0] instanceof Date) {
347
- const startedDate = dayjs(args[0]);
348
- const endedDate = dayjs(args[1]);
349
- diff = endedDate.diff(startedDate, "ms");
350
- compact = args[2] === true;
351
- } else {
352
- diff = args[0];
353
- compact = args[1] === true;
354
- }
355
- const { days, hours, minutes, seconds } = dayTimeDuration(diff);
356
- const formattedParts = [];
357
- if (days) {
358
- if (compact) {
359
- formattedParts.push(`${days} ${durationFormatLabels.days.compact}`);
360
- } else {
361
- formattedParts.push(
362
- `${days} ${declension(days, durationFormatLabels.days.full)}`
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
- const getTimeDiff = (dateA, dateB) => {
396
- const leftDate = toLibFormat(dateA)?.toDate();
397
- const rightDate = toLibFormat(dateB)?.toDate();
398
- if (!leftDate || !rightDate) {
399
- return {
400
- minutes: 0,
401
- seconds: 0,
402
- total: { ms: 0, hours: 0 }
403
- };
404
- }
405
- const msDiff = leftDate.getTime() - rightDate.getTime();
406
- return {
407
- minutes: Math.max(Math.floor(msDiff / ms(1, "min")), 0),
408
- seconds: Math.max(Math.floor(msDiff % ms(1, "min") / 1e3), 0),
409
- total: {
410
- hours: Math.round(msDiff / ms(1, "hour")),
411
- ms: msDiff
412
- }
413
- };
414
- };
415
- const addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
416
- const subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
417
- const addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
418
- const setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
419
- const setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
420
- export {
421
- addDays,
422
- addMinutes,
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
- //# sourceMappingURL=date-time.js.map
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