yummies 7.19.4 → 7.20.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 (162) hide show
  1. package/assert.cjs +1 -1
  2. package/assert.cjs.map +1 -1
  3. package/assert.js +1 -1
  4. package/assert.js.map +1 -1
  5. package/async.cjs +147 -137
  6. package/async.cjs.map +1 -1
  7. package/async.d.ts +98 -131
  8. package/async.js +147 -137
  9. package/async.js.map +1 -1
  10. package/common.cjs +3 -1
  11. package/common.cjs.map +1 -1
  12. package/common.d.ts +18 -24
  13. package/common.js +3 -1
  14. package/common.js.map +1 -1
  15. package/complex.cjs +1 -0
  16. package/complex.cjs.map +1 -1
  17. package/complex.js +1 -0
  18. package/complex.js.map +1 -1
  19. package/cookie.cjs +1 -1
  20. package/cookie.cjs.map +1 -1
  21. package/cookie.d.ts +0 -18
  22. package/cookie.js +1 -1
  23. package/cookie.js.map +1 -1
  24. package/css-cx.cjs +78 -0
  25. package/css-cx.cjs.map +1 -0
  26. package/css-cx.d.ts +69 -0
  27. package/css-cx.js +74 -0
  28. package/css-cx.js.map +1 -0
  29. package/css.cjs +32 -111
  30. package/css.cjs.map +1 -1
  31. package/css.d.ts +32 -42
  32. package/css.js +30 -107
  33. package/css.js.map +1 -1
  34. package/data.cjs +60 -50
  35. package/data.cjs.map +1 -1
  36. package/data.d.ts +21 -34
  37. package/data.js +60 -50
  38. package/data.js.map +1 -1
  39. package/date-time.cjs +104 -98
  40. package/date-time.cjs.map +1 -1
  41. package/date-time.d.ts +51 -57
  42. package/date-time.js +104 -97
  43. package/date-time.js.map +1 -1
  44. package/device.cjs +14 -19
  45. package/device.cjs.map +1 -1
  46. package/device.d.ts +15 -26
  47. package/device.js +14 -19
  48. package/device.js.map +1 -1
  49. package/encodings.cjs +1 -1
  50. package/encodings.cjs.map +1 -1
  51. package/encodings.d.ts +0 -17
  52. package/encodings.js +1 -1
  53. package/encodings.js.map +1 -1
  54. package/errors.cjs +1 -18
  55. package/errors.cjs.map +1 -1
  56. package/errors.d.ts +0 -17
  57. package/errors.js +1 -17
  58. package/errors.js.map +1 -1
  59. package/file.cjs +3 -17
  60. package/file.cjs.map +1 -1
  61. package/file.d.ts +1 -16
  62. package/file.js +3 -17
  63. package/file.js.map +1 -1
  64. package/format.cjs +1 -1
  65. package/format.cjs.map +1 -1
  66. package/format.js +1 -1
  67. package/format.js.map +1 -1
  68. package/html.cjs +112 -175
  69. package/html.cjs.map +1 -1
  70. package/html.d.ts +58 -57
  71. package/html.js +111 -172
  72. package/html.js.map +1 -1
  73. package/id-nanoid.cjs +36 -0
  74. package/id-nanoid.cjs.map +1 -0
  75. package/id-nanoid.d.ts +26 -0
  76. package/id-nanoid.js +32 -0
  77. package/id-nanoid.js.map +1 -0
  78. package/id.cjs +10 -45
  79. package/id.cjs.map +1 -1
  80. package/id.d.ts +27 -36
  81. package/id.js +6 -40
  82. package/id.js.map +1 -1
  83. package/imports.cjs +3 -18
  84. package/imports.cjs.map +1 -1
  85. package/imports.d.ts +1 -16
  86. package/imports.js +3 -17
  87. package/imports.js.map +1 -1
  88. package/math.cjs +16 -12
  89. package/math.cjs.map +1 -1
  90. package/math.d.ts +9 -24
  91. package/math.js +16 -12
  92. package/math.js.map +1 -1
  93. package/media.cjs +88 -89
  94. package/media.cjs.map +1 -1
  95. package/media.d.ts +72 -80
  96. package/media.js +88 -88
  97. package/media.js.map +1 -1
  98. package/mobx.cjs +0 -1
  99. package/mobx.cjs.map +1 -1
  100. package/mobx.js.map +1 -1
  101. package/ms.cjs +3 -17
  102. package/ms.cjs.map +1 -1
  103. package/ms.d.ts +1 -16
  104. package/ms.js +3 -17
  105. package/ms.js.map +1 -1
  106. package/number.cjs +1 -17
  107. package/number.cjs.map +1 -1
  108. package/number.d.ts +0 -16
  109. package/number.js +1 -17
  110. package/number.js.map +1 -1
  111. package/package.json +6 -6
  112. package/parser.cjs +1 -1
  113. package/parser.cjs.map +1 -1
  114. package/parser.js +1 -1
  115. package/parser.js.map +1 -1
  116. package/price.cjs +1 -1
  117. package/price.cjs.map +1 -1
  118. package/price.d.ts +0 -16
  119. package/price.js +1 -1
  120. package/price.js.map +1 -1
  121. package/random.cjs +37 -39
  122. package/random.cjs.map +1 -1
  123. package/random.d.ts +31 -40
  124. package/random.js +37 -39
  125. package/random.js.map +1 -1
  126. package/react.cjs +0 -1
  127. package/react.cjs.map +1 -1
  128. package/react.js.map +1 -1
  129. package/sanitize-html.cjs +82 -0
  130. package/sanitize-html.cjs.map +1 -0
  131. package/sanitize-html.d.ts +28 -0
  132. package/sanitize-html.js +79 -0
  133. package/sanitize-html.js.map +1 -0
  134. package/sound.cjs +1 -17
  135. package/sound.cjs.map +1 -1
  136. package/sound.d.ts +0 -16
  137. package/sound.js +1 -17
  138. package/sound.js.map +1 -1
  139. package/storage.cjs +7 -5
  140. package/storage.cjs.map +1 -1
  141. package/storage.d.ts +3 -17
  142. package/storage.js +7 -5
  143. package/storage.js.map +1 -1
  144. package/text.cjs +3 -17
  145. package/text.cjs.map +1 -1
  146. package/text.d.ts +1 -16
  147. package/text.js +3 -17
  148. package/text.js.map +1 -1
  149. package/type-guard.cjs +38 -1
  150. package/type-guard.cjs.map +1 -1
  151. package/type-guard.d.ts +38 -0
  152. package/type-guard.js +38 -1
  153. package/type-guard.js.map +1 -1
  154. package/types.d.ts +10 -1
  155. package/types.global.d.ts +9 -0
  156. package/vibrate.cjs +1 -17
  157. package/vibrate.cjs.map +1 -1
  158. package/vibrate.d.ts +0 -16
  159. package/vibrate.js +1 -17
  160. package/vibrate.js.map +1 -1
  161. /package/{chunk-pbuEa-1d.js → chunk-D7D4PA-g.js} +0 -0
  162. /package/{chunk-CZWwpsFl.cjs → chunk-DakpK96I.cjs} +0 -0
package/date-time.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./chunk-CZWwpsFl.cjs");
3
2
  let yummies_type_guard = require("yummies/type-guard");
4
3
  let yummies_format = require("yummies/format");
5
4
  let yummies_ms = require("yummies/ms");
@@ -23,9 +22,9 @@ var Y = "year";
23
22
  var DATE = "date";
24
23
  var INVALID_DATE_STRING = "Invalid Date";
25
24
  var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
26
- var REGEX_FORMAT = /\[([^\]]+)]|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;
25
+ var REGEX_FORMAT = /\[([^\]]+)]|YYYY|YY|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;
27
26
  //#endregion
28
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/en.js
27
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/locale/en.js
29
28
  var en_default = {
30
29
  name: "en",
31
30
  weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
@@ -42,7 +41,7 @@ var en_default = {
42
41
  }
43
42
  };
44
43
  //#endregion
45
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/utils.js
44
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/utils.js
46
45
  var padStart = function padStart(string, length, pad) {
47
46
  var s = String(string);
48
47
  if (!s || s.length >= length) return string;
@@ -87,7 +86,7 @@ var utils_default = {
87
86
  }
88
87
  };
89
88
  //#endregion
90
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/index.js
89
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/index.js
91
90
  var L = "en";
92
91
  var Ls = {};
93
92
  Ls[L] = en_default;
@@ -150,7 +149,7 @@ var parseDate = function parseDate(cfg) {
150
149
  }
151
150
  return new Date(date);
152
151
  };
153
- var Dayjs = /* @__PURE__ */ function() {
152
+ var Dayjs = /*#__PURE__*/ function() {
154
153
  function Dayjs(cfg) {
155
154
  this.$L = parseLocale(cfg.locale, null, true);
156
155
  this.parse(cfg);
@@ -438,10 +437,11 @@ dayjs.en = Ls[L];
438
437
  dayjs.Ls = Ls;
439
438
  dayjs.p = {};
440
439
  //#endregion
441
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/duration/index.js
440
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/plugin/duration/index.js
442
441
  var MILLISECONDS_A_YEAR = MILLISECONDS_A_DAY * 365;
443
442
  var MILLISECONDS_A_MONTH = MILLISECONDS_A_YEAR / 12;
444
- var durationRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
443
+ var DURATION_REGEX_PARSE = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
444
+ var DURATION_REGEX_FORMAT = /\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g;
445
445
  var unitToMS = {
446
446
  years: MILLISECONDS_A_YEAR,
447
447
  months: MILLISECONDS_A_MONTH,
@@ -486,7 +486,7 @@ var getNumberUnitFormat = function getNumberUnitFormat(number, unit) {
486
486
  format: "" + number + unit
487
487
  };
488
488
  };
489
- var Duration = /* @__PURE__ */ function() {
489
+ var Duration = /*#__PURE__*/ function() {
490
490
  function Duration(input, unit, locale) {
491
491
  var _this = this;
492
492
  this.$d = {};
@@ -509,7 +509,7 @@ var Duration = /* @__PURE__ */ function() {
509
509
  return this;
510
510
  }
511
511
  if (typeof input === "string") {
512
- var d = input.match(durationRegex);
512
+ var d = input.match(DURATION_REGEX_PARSE);
513
513
  if (d) {
514
514
  var numberD = d.slice(2).map(function(value) {
515
515
  return value != null ? Number(value) : 0;
@@ -590,7 +590,7 @@ var Duration = /* @__PURE__ */ function() {
590
590
  ss: $u.s(this.$d.seconds, 2, "0"),
591
591
  SSS: $u.s(this.$d.milliseconds, 3, "0")
592
592
  };
593
- return str.replace(REGEX_FORMAT, function(match, $1) {
593
+ return str.replace(DURATION_REGEX_FORMAT, function(match, $1) {
594
594
  return $1 || String(matches[match]);
595
595
  });
596
596
  };
@@ -701,7 +701,7 @@ var duration_default = (function(option, Dayjs, dayjs) {
701
701
  };
702
702
  });
703
703
  //#endregion
704
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/relativeTime/index.js
704
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/plugin/relativeTime/index.js
705
705
  var relativeTime_default = (function(o, c, d) {
706
706
  o = o || {};
707
707
  var proto = c.prototype;
@@ -817,7 +817,7 @@ var relativeTime_default = (function(o, c, d) {
817
817
  };
818
818
  });
819
819
  //#endregion
820
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/ru.js
820
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/locale/ru.js
821
821
  var monthFormat = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_");
822
822
  var monthStandalone = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_");
823
823
  var monthShortFormat = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_");
@@ -894,23 +894,7 @@ var locale = {
894
894
  };
895
895
  dayjs.locale(locale, null, true);
896
896
  //#endregion
897
- //#region src/date-time.ts
898
- /**
899
- * ---header-docs-section---
900
- * # yummies/date-time
901
- *
902
- * ## Description
903
- *
904
- * Date and time formatting built on **dayjs** with locale plugins, human-readable presets, relative
905
- * phrases, and duration helpers tailored to UI copy. It composes with `yummies/format`, `yummies/ms`,
906
- * and `yummies/text` for declensions so timestamps read naturally in Russian-facing apps.
907
- *
908
- * ## Usage
909
- *
910
- * ```ts
911
- * import { formatDate } from "yummies/date-time";
912
- * ```
913
- */
897
+ //#region src/date-time/_shared.ts
914
898
  dayjs.extend(relativeTime_default);
915
899
  dayjs.extend(duration_default);
916
900
  dayjs.locale("ru");
@@ -921,35 +905,49 @@ var toLibFormat = (value) => {
921
905
  if (!result?.isValid()) return null;
922
906
  return result;
923
907
  };
908
+ //#endregion
909
+ //#region src/date-time/add-days.ts
924
910
  /**
925
- * Formats a date-like value using predefined presets or a custom pattern.
911
+ * Returns a new date shifted forward by the provided number of days.
926
912
  *
927
913
  * @example
928
914
  * ```ts
929
- * formatDate('2024-03-15', { format: 'time-short' });
915
+ * addDays(new Date('2024-03-15'), 7);
930
916
  * ```
931
917
  */
932
- var formatDate = (value, settings) => {
933
- const dateFormat = settings?.format;
934
- const datePattern = settings?.pattern;
935
- const asTime = settings?.asTime;
936
- let libDate = null;
937
- if (asTime && yummies_type_guard.typeGuard.isNumber(value)) libDate = dayjs.duration(value);
938
- else libDate = toLibFormat(value);
939
- if (!libDate) return yummies_format.format.NO_VALUE;
940
- if (datePattern) return libDate.format(datePattern);
941
- if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
942
- else return yummies_format.format.NO_VALUE;
943
- switch (dateFormat) {
944
- case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
945
- case "short": return libDate.format("DD MMM HH:mm");
946
- case "time": return libDate.format("HH:mm:ss");
947
- case "time-short": return libDate.format("HH:mm");
948
- case "day": return libDate.format("DD MMM YYYY");
949
- case "month": return libDate.format("MMMM YYYY");
950
- default: return libDate.format("DD.MM.YYYY");
918
+ var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
919
+ //#endregion
920
+ //#region src/date-time/add-minutes.ts
921
+ /**
922
+ * Returns a new date shifted forward by the provided number of minutes.
923
+ *
924
+ * @example
925
+ * ```ts
926
+ * addMinutes(new Date('2024-03-15T12:00:00'), 15);
927
+ * ```
928
+ */
929
+ var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
930
+ //#endregion
931
+ //#region src/date-time/change-date.ts
932
+ /**
933
+ * Applies one or more date adjustments and returns a new `Date` instance.
934
+ *
935
+ * @example
936
+ * ```ts
937
+ * changeDate(new Date(), 1, 'day', 30, 'minute');
938
+ * ```
939
+ */
940
+ var changeDate = (date, ...args) => {
941
+ let wrappedDate = toLibFormat(date);
942
+ for (let i = 0; i < args.length; i += 2) {
943
+ const amount = args[i];
944
+ const unit = args[i + 1];
945
+ if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
951
946
  }
947
+ return wrappedDate.toDate();
952
948
  };
949
+ //#endregion
950
+ //#region src/date-time/day-time-duration.ts
953
951
  /**
954
952
  * Splits a duration in milliseconds into day-based time parts.
955
953
  *
@@ -976,40 +974,39 @@ var dayTimeDuration = (timeInMs) => {
976
974
  milliseconds: Math.floor(left)
977
975
  };
978
976
  };
977
+ //#endregion
978
+ //#region src/date-time/format-date.ts
979
979
  /**
980
- * Applies one or more date adjustments and returns a new `Date` instance.
980
+ * Formats a date-like value using predefined presets or a custom pattern.
981
981
  *
982
982
  * @example
983
983
  * ```ts
984
- * changeDate(new Date(), 1, 'day', 30, 'minute');
984
+ * formatDate('2024-03-15', { format: 'time-short' });
985
985
  * ```
986
986
  */
987
- var changeDate = (date, ...args) => {
988
- let wrappedDate = toLibFormat(date);
989
- for (let i = 0; i < args.length; i += 2) {
990
- const amount = args[i];
991
- const unit = args[i + 1];
992
- if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
987
+ var formatDate = (value, settings) => {
988
+ const dateFormat = settings?.format;
989
+ const datePattern = settings?.pattern;
990
+ const asTime = settings?.asTime;
991
+ let libDate = null;
992
+ if (asTime && yummies_type_guard.typeGuard.isNumber(value)) libDate = dayjs.duration(value);
993
+ else libDate = toLibFormat(value);
994
+ if (!libDate) return yummies_format.format.NO_VALUE;
995
+ if (datePattern) return libDate.format(datePattern);
996
+ if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
997
+ else return yummies_format.format.NO_VALUE;
998
+ switch (dateFormat) {
999
+ case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
1000
+ case "short": return libDate.format("DD MMM HH:mm");
1001
+ case "time": return libDate.format("HH:mm:ss");
1002
+ case "time-short": return libDate.format("HH:mm");
1003
+ case "day": return libDate.format("DD MMM YYYY");
1004
+ case "month": return libDate.format("MMMM YYYY");
1005
+ default: return libDate.format("DD.MM.YYYY");
993
1006
  }
994
- return wrappedDate.toDate();
995
- };
996
- /**
997
- * Converts milliseconds into hour-based time parts without keeping full days separately.
998
- *
999
- * @example
1000
- * ```ts
1001
- * timeDuration(ms(1, 'hour') + ms(30, 'min'));
1002
- * ```
1003
- */
1004
- var timeDuration = (timeInMs) => {
1005
- const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
1006
- return {
1007
- hours: hours + yummies_ms.unitsToMs.day * days,
1008
- milliseconds,
1009
- minutes,
1010
- seconds
1011
- };
1012
1007
  };
1008
+ //#endregion
1009
+ //#region src/date-time/get-format-duration.ts
1013
1010
  var durationFormatLabels = {
1014
1011
  days: {
1015
1012
  compact: "д",
@@ -1067,6 +1064,8 @@ function getFormatDuration(...args) {
1067
1064
  else formattedParts.push(`${seconds} ${(0, yummies_text.declension)(seconds, durationFormatLabels.seconds.full)}`);
1068
1065
  return formattedParts.join(" ");
1069
1066
  }
1067
+ //#endregion
1068
+ //#region src/date-time/get-time-diff.ts
1070
1069
  /**
1071
1070
  * Calculates the difference between two dates in minutes, seconds and total units.
1072
1071
  *
@@ -1096,51 +1095,58 @@ var getTimeDiff = (dateA, dateB) => {
1096
1095
  }
1097
1096
  };
1098
1097
  };
1098
+ //#endregion
1099
+ //#region src/date-time/set-hours.ts
1099
1100
  /**
1100
- * Returns a new date shifted forward by the provided number of days.
1101
- *
1102
- * @example
1103
- * ```ts
1104
- * addDays(new Date('2024-03-15'), 7);
1105
- * ```
1106
- */
1107
- var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
1108
- /**
1109
- * Returns a new date shifted backward by the provided number of days.
1101
+ * Returns a new date with the hours field replaced.
1110
1102
  *
1111
1103
  * @example
1112
1104
  * ```ts
1113
- * subtractDays(new Date('2024-03-15'), 7);
1105
+ * setHours(new Date('2024-03-15T12:00:00'), 9);
1114
1106
  * ```
1115
1107
  */
1116
- var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
1108
+ var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
1109
+ //#endregion
1110
+ //#region src/date-time/set-minutes.ts
1117
1111
  /**
1118
- * Returns a new date shifted forward by the provided number of minutes.
1112
+ * Returns a new date with the minutes field replaced.
1119
1113
  *
1120
1114
  * @example
1121
1115
  * ```ts
1122
- * addMinutes(new Date('2024-03-15T12:00:00'), 15);
1116
+ * setMinutes(new Date('2024-03-15T12:00:00'), 45);
1123
1117
  * ```
1124
1118
  */
1125
- var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
1119
+ var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
1120
+ //#endregion
1121
+ //#region src/date-time/subtract-days.ts
1126
1122
  /**
1127
- * Returns a new date with the minutes field replaced.
1123
+ * Returns a new date shifted backward by the provided number of days.
1128
1124
  *
1129
1125
  * @example
1130
1126
  * ```ts
1131
- * setMinutes(new Date('2024-03-15T12:00:00'), 45);
1127
+ * subtractDays(new Date('2024-03-15'), 7);
1132
1128
  * ```
1133
1129
  */
1134
- var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
1130
+ var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
1131
+ //#endregion
1132
+ //#region src/date-time/time-duration.ts
1135
1133
  /**
1136
- * Returns a new date with the hours field replaced.
1134
+ * Converts milliseconds into hour-based time parts without keeping full days separately.
1137
1135
  *
1138
1136
  * @example
1139
1137
  * ```ts
1140
- * setHours(new Date('2024-03-15T12:00:00'), 9);
1138
+ * timeDuration(ms(1, 'hour') + ms(30, 'min'));
1141
1139
  * ```
1142
1140
  */
1143
- var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
1141
+ var timeDuration = (timeInMs) => {
1142
+ const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
1143
+ return {
1144
+ hours: hours + yummies_ms.unitsToMs.day * days,
1145
+ milliseconds,
1146
+ minutes,
1147
+ seconds
1148
+ };
1149
+ };
1144
1150
  //#endregion
1145
1151
  exports.addDays = addDays;
1146
1152
  exports.addMinutes = addMinutes;