nhb-toolbox 4.31.1 → 4.31.2
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
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
All notable changes to the package will be documented here.
|
|
6
6
|
|
|
7
|
+
## [4.31.2] - 2026-06-28
|
|
8
|
+
|
|
9
|
+
- **Updated** tsdoc for `relativeTimePlugin` `Chronos` instance methods.
|
|
10
|
+
|
|
7
11
|
## [4.31.1] - 2026-06-28
|
|
8
12
|
|
|
9
13
|
- **Fixed** immutability issue with conversion to `Date` object for all the *date utilities* including `Chronos` constructor and plugins.
|
|
@@ -2,60 +2,55 @@ import type { $Chronos, ChronosInput, TimeUnit } from '../types';
|
|
|
2
2
|
declare module '../Chronos' {
|
|
3
3
|
interface Chronos {
|
|
4
4
|
/**
|
|
5
|
-
* @instance Returns the number of full years between the input date and
|
|
5
|
+
* @instance Returns the number of full years between the input date and the current instance.
|
|
6
6
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
7
|
-
* @returns The difference in number, negative
|
|
7
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
8
8
|
*/
|
|
9
9
|
getRelativeYear(time?: ChronosInput): number;
|
|
10
10
|
/**
|
|
11
|
-
* @instance Returns the number of full months between the input date and
|
|
11
|
+
* @instance Returns the number of full months between the input date and the current instance.
|
|
12
12
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
13
|
-
* @returns The difference in number, negative
|
|
13
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
14
14
|
*/
|
|
15
15
|
getRelativeMonth(time?: ChronosInput): number;
|
|
16
16
|
/**
|
|
17
|
-
* @instance Determines
|
|
18
|
-
* @param date - The date to compare (Date object).
|
|
17
|
+
* @instance Determines how many full weeks apart the input date is from the `Chronos` instance.
|
|
19
18
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
20
|
-
* @returns
|
|
21
|
-
* - `-1` if the date is yesterday.
|
|
22
|
-
* - `0` if the date is today.
|
|
23
|
-
* - `1` if the date is tomorrow.
|
|
24
|
-
* - Other positive or negative numbers for other relative days (e.g., `-2` for two days ago, `2` for two days ahead).
|
|
19
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
25
20
|
*/
|
|
26
21
|
getRelativeWeek(time?: ChronosInput): number;
|
|
27
22
|
/**
|
|
28
|
-
* @instance Returns the number of full
|
|
23
|
+
* @instance Returns the number of full days between the input date and the current instance.
|
|
29
24
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
30
|
-
* @returns The difference in number, negative
|
|
25
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
31
26
|
*/
|
|
32
27
|
getRelativeDay(time?: ChronosInput): number;
|
|
33
28
|
/**
|
|
34
|
-
* @instance Determines how many full
|
|
29
|
+
* @instance Determines how many full hours apart the input date is from the `Chronos` instance.
|
|
35
30
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
36
|
-
* @returns
|
|
31
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
37
32
|
*/
|
|
38
33
|
getRelativeHour(time?: ChronosInput): number;
|
|
39
34
|
/**
|
|
40
|
-
* @instance Returns the number of full minutes between the input date and
|
|
35
|
+
* @instance Returns the number of full minutes between the input date and the current instance.
|
|
41
36
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
42
|
-
* @returns The difference in number, negative
|
|
37
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
43
38
|
*/
|
|
44
39
|
getRelativeMinute(time?: ChronosInput): number;
|
|
45
40
|
/**
|
|
46
|
-
* @instance Returns the number of full seconds between the input date and
|
|
41
|
+
* @instance Returns the number of full seconds between the input date and the current instance.
|
|
47
42
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
48
|
-
* @returns The difference in number, negative
|
|
43
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
49
44
|
*/
|
|
50
45
|
getRelativeSecond(time?: ChronosInput): number;
|
|
51
46
|
/**
|
|
52
|
-
* @instance Returns the number of milliseconds between the input date and
|
|
47
|
+
* @instance Returns the number of milliseconds between the input date and the current instance.
|
|
53
48
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
54
|
-
* @returns The difference in number, negative
|
|
49
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
55
50
|
*/
|
|
56
51
|
getRelativeMilliSecond(time?: ChronosInput): number;
|
|
57
52
|
/**
|
|
58
|
-
* @instance Compares the stored date with
|
|
53
|
+
* @instance Compares the stored date with the current instance, returning the relative difference in the specified unit.
|
|
59
54
|
*
|
|
60
55
|
* @remarks
|
|
61
56
|
* - Internally uses {@link getRelativeYear}, {@link getRelativeMonth}, {@link getRelativeWeek}, {@link getRelativeDay}, {@link getRelativeHour}, {@link getRelativeMinute}, {@link getRelativeSecond} and {@link getRelativeMilliSecond} and rounds the result.
|
|
@@ -63,7 +58,7 @@ declare module '../Chronos' {
|
|
|
63
58
|
*
|
|
64
59
|
* @param unit The time unit to compare by. Defaults to `'minute'`.
|
|
65
60
|
* @param time Optional time to compare with the `Chronos` date/time. Defaults to current time.
|
|
66
|
-
* @returns The difference in number, negative
|
|
61
|
+
* @returns The difference in number, negative if past, positive if future.
|
|
67
62
|
*/
|
|
68
63
|
compare(unit?: TimeUnit, time?: ChronosInput): number;
|
|
69
64
|
/** @instance Checks if the current date is today. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.31.
|
|
3
|
+
"version": "4.31.2",
|
|
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",
|