@thi.ng/timestamp 1.1.14 → 1.1.16

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-06-09T17:24:08Z
3
+ - **Last updated**: 2025-07-20T14:56:01Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -11,6 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ ### [1.1.16](https://github.com/thi-ng/umbrella/tree/@thi.ng/timestamp@1.1.16) (2025-07-20)
15
+
16
+ #### 🩹 Bug fixes
17
+
18
+ - update timeDiff() type coercions, add tests, fix [#536](https://github.com/thi-ng/umbrella/issues/536) ([c426413](https://github.com/thi-ng/umbrella/commit/c426413))
19
+ - also fixes downstream issue with [@thi.ng/transducers](https://github.com/thi-ng/umbrella/tree/main/packages/transducers) partitionTime()
20
+
14
21
  ## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/timestamp@1.1.0) (2024-12-27)
15
22
 
16
23
  #### 🚀 Features
package/README.md CHANGED
@@ -79,7 +79,7 @@ For Node.js REPL:
79
79
  const tim = await import("@thi.ng/timestamp");
80
80
  ```
81
81
 
82
- Package sizes (brotli'd, pre-treeshake): ESM: 214 bytes
82
+ Package sizes (brotli'd, pre-treeshake): ESM: 213 bytes
83
83
 
84
84
  ## Dependencies
85
85
 
package/index.d.ts CHANGED
@@ -6,8 +6,9 @@ export type Timestamp = number | bigint;
6
6
  */
7
7
  export declare const now: () => Timestamp;
8
8
  /**
9
- * Returns the difference in milliseconds between 2 given {@link Timestamp}s
10
- * obtained via {@link now}. `b` defaults to result of {@link now}.
9
+ * Returns the difference in milliseconds between 2 given {@link Timestamp}s,
10
+ * e.g. obtained via {@link now}. `a` is assumed to be older than `b`, the
11
+ * latter defaults to result of {@link now}.
11
12
  *
12
13
  * @param a
13
14
  * @param b
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const now = typeof BigInt !== "undefined" ? typeof process !== "undefined" && typeof process.hrtime !== "undefined" && typeof process.hrtime.bigint === "function" ? () => process.hrtime.bigint() : typeof performance !== "undefined" ? () => BigInt(Math.floor(performance.now() * 1e6)) : () => BigInt(Date.now() * 1e6) : typeof performance !== "undefined" ? () => performance.now() * 1e6 : () => Date.now() * 1e6;
2
- const timeDiff = (a, b = now()) => (typeof BigInt !== "undefined" ? Number(b - a) : b - a) * 1e-6;
2
+ const timeDiff = (a, b = now()) => (typeof BigInt !== "undefined" ? Number(BigInt(b) - BigInt(a)) : Number(b) - Number(a)) * 1e-6;
3
3
  const asMillis = (t) => (typeof t === "bigint" ? Number(t) : t) * 1e-6;
4
4
  export {
5
5
  asMillis,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/timestamp",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Timestamp getter wrapping (in order of preference) `process.hrtime.bigint()`, `performance.now()` or `Date.now()`",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -39,8 +39,8 @@
39
39
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "esbuild": "^0.25.5",
43
- "typedoc": "^0.28.5",
42
+ "esbuild": "^0.25.8",
43
+ "typedoc": "^0.28.7",
44
44
  "typescript": "^5.8.3"
45
45
  },
46
46
  "keywords": [
@@ -75,5 +75,5 @@
75
75
  "thi.ng": {
76
76
  "year": 2018
77
77
  },
78
- "gitHead": "93cdcd8db4d4669561a7f0ebc47697bdbfd04214\n"
78
+ "gitHead": "3cd1bea8b2bf6b859609f6d5c14b4eb64745681f\n"
79
79
  }