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.js CHANGED
@@ -21,9 +21,9 @@ var Y = "year";
21
21
  var DATE = "date";
22
22
  var INVALID_DATE_STRING = "Invalid Date";
23
23
  var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
24
- 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;
24
+ 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;
25
25
  //#endregion
26
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/en.js
26
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/locale/en.js
27
27
  var en_default = {
28
28
  name: "en",
29
29
  weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
@@ -40,7 +40,7 @@ var en_default = {
40
40
  }
41
41
  };
42
42
  //#endregion
43
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/utils.js
43
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/utils.js
44
44
  var padStart = function padStart(string, length, pad) {
45
45
  var s = String(string);
46
46
  if (!s || s.length >= length) return string;
@@ -85,7 +85,7 @@ var utils_default = {
85
85
  }
86
86
  };
87
87
  //#endregion
88
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/index.js
88
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/index.js
89
89
  var L = "en";
90
90
  var Ls = {};
91
91
  Ls[L] = en_default;
@@ -148,7 +148,7 @@ var parseDate = function parseDate(cfg) {
148
148
  }
149
149
  return new Date(date);
150
150
  };
151
- var Dayjs = /* @__PURE__ */ function() {
151
+ var Dayjs = /*#__PURE__*/ function() {
152
152
  function Dayjs(cfg) {
153
153
  this.$L = parseLocale(cfg.locale, null, true);
154
154
  this.parse(cfg);
@@ -436,10 +436,11 @@ dayjs.en = Ls[L];
436
436
  dayjs.Ls = Ls;
437
437
  dayjs.p = {};
438
438
  //#endregion
439
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/duration/index.js
439
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/plugin/duration/index.js
440
440
  var MILLISECONDS_A_YEAR = MILLISECONDS_A_DAY * 365;
441
441
  var MILLISECONDS_A_MONTH = MILLISECONDS_A_YEAR / 12;
442
- 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)?)?$/;
442
+ 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)?)?$/;
443
+ var DURATION_REGEX_FORMAT = /\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g;
443
444
  var unitToMS = {
444
445
  years: MILLISECONDS_A_YEAR,
445
446
  months: MILLISECONDS_A_MONTH,
@@ -484,7 +485,7 @@ var getNumberUnitFormat = function getNumberUnitFormat(number, unit) {
484
485
  format: "" + number + unit
485
486
  };
486
487
  };
487
- var Duration = /* @__PURE__ */ function() {
488
+ var Duration = /*#__PURE__*/ function() {
488
489
  function Duration(input, unit, locale) {
489
490
  var _this = this;
490
491
  this.$d = {};
@@ -507,7 +508,7 @@ var Duration = /* @__PURE__ */ function() {
507
508
  return this;
508
509
  }
509
510
  if (typeof input === "string") {
510
- var d = input.match(durationRegex);
511
+ var d = input.match(DURATION_REGEX_PARSE);
511
512
  if (d) {
512
513
  var numberD = d.slice(2).map(function(value) {
513
514
  return value != null ? Number(value) : 0;
@@ -588,7 +589,7 @@ var Duration = /* @__PURE__ */ function() {
588
589
  ss: $u.s(this.$d.seconds, 2, "0"),
589
590
  SSS: $u.s(this.$d.milliseconds, 3, "0")
590
591
  };
591
- return str.replace(REGEX_FORMAT, function(match, $1) {
592
+ return str.replace(DURATION_REGEX_FORMAT, function(match, $1) {
592
593
  return $1 || String(matches[match]);
593
594
  });
594
595
  };
@@ -699,7 +700,7 @@ var duration_default = (function(option, Dayjs, dayjs) {
699
700
  };
700
701
  });
701
702
  //#endregion
702
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/plugin/relativeTime/index.js
703
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/plugin/relativeTime/index.js
703
704
  var relativeTime_default = (function(o, c, d) {
704
705
  o = o || {};
705
706
  var proto = c.prototype;
@@ -815,7 +816,7 @@ var relativeTime_default = (function(o, c, d) {
815
816
  };
816
817
  });
817
818
  //#endregion
818
- //#region node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/esm/locale/ru.js
819
+ //#region node_modules/.pnpm/dayjs@1.11.21/node_modules/dayjs/esm/locale/ru.js
819
820
  var monthFormat = "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_");
820
821
  var monthStandalone = "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_");
821
822
  var monthShortFormat = "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_");
@@ -892,23 +893,7 @@ var locale = {
892
893
  };
893
894
  dayjs.locale(locale, null, true);
894
895
  //#endregion
895
- //#region src/date-time.ts
896
- /**
897
- * ---header-docs-section---
898
- * # yummies/date-time
899
- *
900
- * ## Description
901
- *
902
- * Date and time formatting built on **dayjs** with locale plugins, human-readable presets, relative
903
- * phrases, and duration helpers tailored to UI copy. It composes with `yummies/format`, `yummies/ms`,
904
- * and `yummies/text` for declensions so timestamps read naturally in Russian-facing apps.
905
- *
906
- * ## Usage
907
- *
908
- * ```ts
909
- * import { formatDate } from "yummies/date-time";
910
- * ```
911
- */
896
+ //#region src/date-time/_shared.ts
912
897
  dayjs.extend(relativeTime_default);
913
898
  dayjs.extend(duration_default);
914
899
  dayjs.locale("ru");
@@ -919,35 +904,49 @@ var toLibFormat = (value) => {
919
904
  if (!result?.isValid()) return null;
920
905
  return result;
921
906
  };
907
+ //#endregion
908
+ //#region src/date-time/add-days.ts
922
909
  /**
923
- * Formats a date-like value using predefined presets or a custom pattern.
910
+ * Returns a new date shifted forward by the provided number of days.
924
911
  *
925
912
  * @example
926
913
  * ```ts
927
- * formatDate('2024-03-15', { format: 'time-short' });
914
+ * addDays(new Date('2024-03-15'), 7);
928
915
  * ```
929
916
  */
930
- var formatDate = (value, settings) => {
931
- const dateFormat = settings?.format;
932
- const datePattern = settings?.pattern;
933
- const asTime = settings?.asTime;
934
- let libDate = null;
935
- if (asTime && typeGuard.isNumber(value)) libDate = dayjs.duration(value);
936
- else libDate = toLibFormat(value);
937
- if (!libDate) return format.NO_VALUE;
938
- if (datePattern) return libDate.format(datePattern);
939
- if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
940
- else return format.NO_VALUE;
941
- switch (dateFormat) {
942
- case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
943
- case "short": return libDate.format("DD MMM HH:mm");
944
- case "time": return libDate.format("HH:mm:ss");
945
- case "time-short": return libDate.format("HH:mm");
946
- case "day": return libDate.format("DD MMM YYYY");
947
- case "month": return libDate.format("MMMM YYYY");
948
- default: return libDate.format("DD.MM.YYYY");
917
+ var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
918
+ //#endregion
919
+ //#region src/date-time/add-minutes.ts
920
+ /**
921
+ * Returns a new date shifted forward by the provided number of minutes.
922
+ *
923
+ * @example
924
+ * ```ts
925
+ * addMinutes(new Date('2024-03-15T12:00:00'), 15);
926
+ * ```
927
+ */
928
+ var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
929
+ //#endregion
930
+ //#region src/date-time/change-date.ts
931
+ /**
932
+ * Applies one or more date adjustments and returns a new `Date` instance.
933
+ *
934
+ * @example
935
+ * ```ts
936
+ * changeDate(new Date(), 1, 'day', 30, 'minute');
937
+ * ```
938
+ */
939
+ var changeDate = (date, ...args) => {
940
+ let wrappedDate = toLibFormat(date);
941
+ for (let i = 0; i < args.length; i += 2) {
942
+ const amount = args[i];
943
+ const unit = args[i + 1];
944
+ if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
949
945
  }
946
+ return wrappedDate.toDate();
950
947
  };
948
+ //#endregion
949
+ //#region src/date-time/day-time-duration.ts
951
950
  /**
952
951
  * Splits a duration in milliseconds into day-based time parts.
953
952
  *
@@ -974,40 +973,39 @@ var dayTimeDuration = (timeInMs) => {
974
973
  milliseconds: Math.floor(left)
975
974
  };
976
975
  };
976
+ //#endregion
977
+ //#region src/date-time/format-date.ts
977
978
  /**
978
- * Applies one or more date adjustments and returns a new `Date` instance.
979
+ * Formats a date-like value using predefined presets or a custom pattern.
979
980
  *
980
981
  * @example
981
982
  * ```ts
982
- * changeDate(new Date(), 1, 'day', 30, 'minute');
983
+ * formatDate('2024-03-15', { format: 'time-short' });
983
984
  * ```
984
985
  */
985
- var changeDate = (date, ...args) => {
986
- let wrappedDate = toLibFormat(date);
987
- for (let i = 0; i < args.length; i += 2) {
988
- const amount = args[i];
989
- const unit = args[i + 1];
990
- if (unit != null) wrappedDate = wrappedDate.add(amount, unit);
986
+ var formatDate = (value, settings) => {
987
+ const dateFormat = settings?.format;
988
+ const datePattern = settings?.pattern;
989
+ const asTime = settings?.asTime;
990
+ let libDate = null;
991
+ if (asTime && typeGuard.isNumber(value)) libDate = dayjs.duration(value);
992
+ else libDate = toLibFormat(value);
993
+ if (!libDate) return format.NO_VALUE;
994
+ if (datePattern) return libDate.format(datePattern);
995
+ if (dateFormat === "human" || dateFormat === "spent-time") if ("fromNow" in libDate) return libDate.fromNow(dateFormat === "spent-time");
996
+ else return format.NO_VALUE;
997
+ switch (dateFormat) {
998
+ case "full": return libDate.format("DD MMM YYYY HH:mm:ss");
999
+ case "short": return libDate.format("DD MMM HH:mm");
1000
+ case "time": return libDate.format("HH:mm:ss");
1001
+ case "time-short": return libDate.format("HH:mm");
1002
+ case "day": return libDate.format("DD MMM YYYY");
1003
+ case "month": return libDate.format("MMMM YYYY");
1004
+ default: return libDate.format("DD.MM.YYYY");
991
1005
  }
992
- return wrappedDate.toDate();
993
- };
994
- /**
995
- * Converts milliseconds into hour-based time parts without keeping full days separately.
996
- *
997
- * @example
998
- * ```ts
999
- * timeDuration(ms(1, 'hour') + ms(30, 'min'));
1000
- * ```
1001
- */
1002
- var timeDuration = (timeInMs) => {
1003
- const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
1004
- return {
1005
- hours: hours + unitsToMs.day * days,
1006
- milliseconds,
1007
- minutes,
1008
- seconds
1009
- };
1010
1006
  };
1007
+ //#endregion
1008
+ //#region src/date-time/get-format-duration.ts
1011
1009
  var durationFormatLabels = {
1012
1010
  days: {
1013
1011
  compact: "д",
@@ -1065,6 +1063,8 @@ function getFormatDuration(...args) {
1065
1063
  else formattedParts.push(`${seconds} ${declension(seconds, durationFormatLabels.seconds.full)}`);
1066
1064
  return formattedParts.join(" ");
1067
1065
  }
1066
+ //#endregion
1067
+ //#region src/date-time/get-time-diff.ts
1068
1068
  /**
1069
1069
  * Calculates the difference between two dates in minutes, seconds and total units.
1070
1070
  *
@@ -1094,51 +1094,58 @@ var getTimeDiff = (dateA, dateB) => {
1094
1094
  }
1095
1095
  };
1096
1096
  };
1097
+ //#endregion
1098
+ //#region src/date-time/set-hours.ts
1097
1099
  /**
1098
- * Returns a new date shifted forward by the provided number of days.
1099
- *
1100
- * @example
1101
- * ```ts
1102
- * addDays(new Date('2024-03-15'), 7);
1103
- * ```
1104
- */
1105
- var addDays = (date, count) => toLibFormat(date)?.add(count, "d").toDate();
1106
- /**
1107
- * Returns a new date shifted backward by the provided number of days.
1100
+ * Returns a new date with the hours field replaced.
1108
1101
  *
1109
1102
  * @example
1110
1103
  * ```ts
1111
- * subtractDays(new Date('2024-03-15'), 7);
1104
+ * setHours(new Date('2024-03-15T12:00:00'), 9);
1112
1105
  * ```
1113
1106
  */
1114
- var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
1107
+ var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
1108
+ //#endregion
1109
+ //#region src/date-time/set-minutes.ts
1115
1110
  /**
1116
- * Returns a new date shifted forward by the provided number of minutes.
1111
+ * Returns a new date with the minutes field replaced.
1117
1112
  *
1118
1113
  * @example
1119
1114
  * ```ts
1120
- * addMinutes(new Date('2024-03-15T12:00:00'), 15);
1115
+ * setMinutes(new Date('2024-03-15T12:00:00'), 45);
1121
1116
  * ```
1122
1117
  */
1123
- var addMinutes = (date, count) => toLibFormat(date)?.add(count, "m").toDate();
1118
+ var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
1119
+ //#endregion
1120
+ //#region src/date-time/subtract-days.ts
1124
1121
  /**
1125
- * Returns a new date with the minutes field replaced.
1122
+ * Returns a new date shifted backward by the provided number of days.
1126
1123
  *
1127
1124
  * @example
1128
1125
  * ```ts
1129
- * setMinutes(new Date('2024-03-15T12:00:00'), 45);
1126
+ * subtractDays(new Date('2024-03-15'), 7);
1130
1127
  * ```
1131
1128
  */
1132
- var setMinutes = (date, minutes) => toLibFormat(date)?.set("m", minutes).toDate();
1129
+ var subtractDays = (date, count) => toLibFormat(date)?.subtract(count, "d").toDate();
1130
+ //#endregion
1131
+ //#region src/date-time/time-duration.ts
1133
1132
  /**
1134
- * Returns a new date with the hours field replaced.
1133
+ * Converts milliseconds into hour-based time parts without keeping full days separately.
1135
1134
  *
1136
1135
  * @example
1137
1136
  * ```ts
1138
- * setHours(new Date('2024-03-15T12:00:00'), 9);
1137
+ * timeDuration(ms(1, 'hour') + ms(30, 'min'));
1139
1138
  * ```
1140
1139
  */
1141
- var setHours = (date, hours) => toLibFormat(date)?.set("h", hours).toDate();
1140
+ var timeDuration = (timeInMs) => {
1141
+ const { days, hours, milliseconds, minutes, seconds } = dayTimeDuration(timeInMs);
1142
+ return {
1143
+ hours: hours + unitsToMs.day * days,
1144
+ milliseconds,
1145
+ minutes,
1146
+ seconds
1147
+ };
1148
+ };
1142
1149
  //#endregion
1143
1150
  export { addDays, addMinutes, changeDate, dayTimeDuration, formatDate, getFormatDuration, getTimeDiff, setHours, setMinutes, subtractDays, timeDuration };
1144
1151