qznt 2.2.0 → 2.2.1

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/dist/index.cjs CHANGED
@@ -829,7 +829,7 @@ function formatDuration(target, style = "hms", options = {}) {
829
829
  if (diff === 0) return style === "digital" ? "00:00" : "now";
830
830
  const s = Math.floor(diff / 1e3) % 60;
831
831
  const m = Math.floor(diff / 6e4) % 60;
832
- const h = Math.floor(diff / 36e5) % 24;
832
+ const h = style === "hms" ? Math.floor(diff / 36e5) : Math.floor(diff / 36e5) % 24;
833
833
  const d = Math.floor(diff / 864e5);
834
834
  if (style === "digital") {
835
835
  const parts = [m, s].map((v) => String(v).padStart(2, "0"));
package/dist/index.d.cts CHANGED
@@ -394,9 +394,9 @@ declare function FormatNumberCompact(num: number, locale?: Intl.LocalesArgument)
394
394
  * Duration formatter.
395
395
  *
396
396
  * Available styles:
397
- * - Digital (00:00)
398
- * - HMS
399
- * - YMDHMS.
397
+ * - "digital": MM:SS, HH:MM:SS, or D:HH:MM:SS.
398
+ * - "hms": hours, minutes, and seconds, with total hours that can exceed 23.
399
+ * - "ymdhms": days, hours, minutes, and seconds, with hours capped at 23.
400
400
  * @param target The target time to calculate from
401
401
  * @param style The output style to use
402
402
  * @param options Formatting options
package/dist/index.d.ts CHANGED
@@ -394,9 +394,9 @@ declare function FormatNumberCompact(num: number, locale?: Intl.LocalesArgument)
394
394
  * Duration formatter.
395
395
  *
396
396
  * Available styles:
397
- * - Digital (00:00)
398
- * - HMS
399
- * - YMDHMS.
397
+ * - "digital": MM:SS, HH:MM:SS, or D:HH:MM:SS.
398
+ * - "hms": hours, minutes, and seconds, with total hours that can exceed 23.
399
+ * - "ymdhms": days, hours, minutes, and seconds, with hours capped at 23.
400
400
  * @param target The target time to calculate from
401
401
  * @param style The output style to use
402
402
  * @param options Formatting options
package/dist/index.js CHANGED
@@ -728,7 +728,7 @@ function formatDuration(target, style = "hms", options = {}) {
728
728
  if (diff === 0) return style === "digital" ? "00:00" : "now";
729
729
  const s = Math.floor(diff / 1e3) % 60;
730
730
  const m = Math.floor(diff / 6e4) % 60;
731
- const h = Math.floor(diff / 36e5) % 24;
731
+ const h = style === "hms" ? Math.floor(diff / 36e5) : Math.floor(diff / 36e5) % 24;
732
732
  const d = Math.floor(diff / 864e5);
733
733
  if (style === "digital") {
734
734
  const parts = [m, s].map((v) => String(v).padStart(2, "0"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qznt",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A lightweight typed utility toolkit for modern TypeScript environments.",
5
5
  "license": "MIT",
6
6
  "author": "xsqu1znt",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsup",
30
+ "test": "pnpm build && node --test tests/*.test.mjs",
30
31
  "check": "tsc --noEmit",
31
32
  "format": "prettier --write \"./**/*.{ts,json}\""
32
33
  }