nhb-toolbox 4.20.90 → 4.20.92

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
@@ -6,10 +6,18 @@ All notable changes to the package will be documented here.
6
6
 
7
7
  ---
8
8
 
9
+ ## [4.20.92] - 2025-10-12
10
+
11
+ - **Fixed** `RomanNumeralCap` type and **added** _@remarks_ section.
12
+
13
+ ## [4.20.91] - 2025-10-12
14
+
15
+ - **Updated** _tsdoc_ for `fromNow()` `Chronos` method: modified _@remarks_ section.
16
+
9
17
  ## [4.20.90] - 2025-10-12
10
18
 
11
19
  - **Updated** `formatUnitWithPlural` utility: now returns _singular unit_ for both `0` and `1`.
12
- - **Update** `fromNow()` `Chronos` method: fixed issues related to 0 value for provided unit level.
20
+ - **Updated** `fromNow()` `Chronos` method: **fixed** issues when provided unit level value is `0`.
13
21
 
14
22
  ## [4.20.89] - 2025-10-12
15
23
 
@@ -5,7 +5,7 @@ const convert_1 = require("../../string/convert");
5
5
  const constants_1 = require("../constants");
6
6
  const fromNowPlugin = (ChronosClass) => {
7
7
  const internal = ChronosClass[constants_1.INTERNALS];
8
- ChronosClass.prototype.fromNow = function (level = 'minute', withSuffixPrefix = true, time) {
8
+ ChronosClass.prototype.fromNow = function (level = 'second', withSuffixPrefix = true, time) {
9
9
  const now = internal.toNewDate(this, time);
10
10
  const target = internal.internalDate(this);
11
11
  const isFuture = target > now;
@@ -5,14 +5,14 @@ declare module '../Chronos' {
5
5
  /**
6
6
  * @instance Returns full time difference from now (or a specified time) down to a given level.
7
7
  *
8
- * @param level Determines the smallest unit to include in the output (e.g., 'minute' will show up to minutes, ignoring seconds). Defaults to `minute`.
8
+ * @param level Determines the smallest unit to include in the output (e.g., 'minute' will show up to minutes, ignoring seconds). Defaults to `second`.
9
9
  * @param withSuffixPrefix If `true`, adds `"in"` or `"ago"` depending on whether the time is in the future or past. Defaults to `true`.
10
10
  * @param time An optional time value to compare with (`string`, `number`, `Date`, or `Chronos` instance). Defaults to `now`.
11
11
  * @returns The difference as a human-readable string, e.g., `2 years 1 month 9 days 18 hours 56 minutes ago`.
12
12
  *
13
13
  * @remarks
14
14
  * - This method calculates the **elapsed time difference** (exclusive of the end day), consistent with libraries like `Day.js` and `Luxon`.
15
- * - If you need an *inclusive calendar-style* difference (counting both start and end days), add one day manually to the result.
15
+ * - If you need an *inclusive calendar-style* difference (counting both start and end days), adjust one day manually before calling `fromNow()`.
16
16
  */
17
17
  fromNow(level?: FromNowUnit, withSuffixPrefix?: boolean, time?: ChronosInput): string;
18
18
  }
@@ -200,8 +200,13 @@ export type $RomanBase = 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';
200
200
  * - Designed purely for **editor IntelliSense**, not runtime validation.
201
201
  */
202
202
  export type $RomanNumeralCap = $RomanBase | Repeat<$RomanBase, 2> | Repeat<$RomanBase, 3> | Repeat<$RomanBase, 4> | Repeat<$RomanBase, 5>;
203
- /** * Represents repeated Roman numeral sequences (1–5 characters long) in uppercase letters and any string */
204
- export type RomanNumeralCap = Uppercase<LooseLiteral<$RomanNumeralCap>>;
203
+ /**
204
+ * * Represents repeated Roman numeral sequences (1–5 characters long, not always a valid roman numeral) in uppercase letters and any string
205
+ *
206
+ * @remarks
207
+ * - The {@link LooseLiteral} wrapper allows non-literal strings (e.g., variables) without losing IntelliSense for {@link $RomanNumeralCap} literals.
208
+ * - Does not enforce valid Roman numeral formation. */
209
+ export type RomanNumeralCap = LooseLiteral<$RomanNumeralCap>;
205
210
  /**
206
211
  * * Comprehensive Roman numeral string type.
207
212
  *
@@ -2,7 +2,7 @@ import { formatUnitWithPlural } from '../../string/convert.js';
2
2
  import { INTERNALS } from '../constants.js';
3
3
  export const fromNowPlugin = (ChronosClass) => {
4
4
  const internal = ChronosClass[INTERNALS];
5
- ChronosClass.prototype.fromNow = function (level = 'minute', withSuffixPrefix = true, time) {
5
+ ChronosClass.prototype.fromNow = function (level = 'second', withSuffixPrefix = true, time) {
6
6
  const now = internal.toNewDate(this, time);
7
7
  const target = internal.internalDate(this);
8
8
  const isFuture = target > now;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.20.90",
3
+ "version": "4.20.92",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",