nhb-toolbox 3.6.1 → 3.6.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/dist/date/Chronos.d.ts +18 -14
- package/dist/date/Chronos.d.ts.map +1 -1
- package/dist/date/Chronos.js +19 -15
- package/package.json +1 -1
package/dist/date/Chronos.d.ts
CHANGED
|
@@ -109,20 +109,20 @@ export declare class Chronos {
|
|
|
109
109
|
fromNow(time?: string | number | Date | Chronos): string;
|
|
110
110
|
/**
|
|
111
111
|
* * Returns the number of full years between the input date and now.
|
|
112
|
-
* @param time Optional time to compare with the date/time.
|
|
113
|
-
* @returns The difference in number.
|
|
112
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
113
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
114
114
|
*/
|
|
115
115
|
getRelativeYear(time?: string | number | Date | Chronos): number;
|
|
116
116
|
/**
|
|
117
117
|
* * Returns the number of full months between the input date and now.
|
|
118
|
-
* @param time Optional time to compare with the date/time.
|
|
119
|
-
* @returns The difference in number.
|
|
118
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
119
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
120
120
|
*/
|
|
121
121
|
getRelativeMonth(time?: string | number | Date | Chronos): number;
|
|
122
122
|
/**
|
|
123
123
|
* * Determines if the given date is today, tomorrow, yesterday or any relative day.
|
|
124
124
|
* @param date - The date to compare (Date object).
|
|
125
|
-
* @param time Optional time to compare with the date/time.
|
|
125
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
126
126
|
* @returns
|
|
127
127
|
* - `-1` if the date is yesterday.
|
|
128
128
|
* - `0` if the date is today.
|
|
@@ -132,30 +132,34 @@ export declare class Chronos {
|
|
|
132
132
|
getRelativeDay(time?: string | number | Date | Chronos): number;
|
|
133
133
|
/**
|
|
134
134
|
* * Returns the number of full hours between the input date and now.
|
|
135
|
-
* @param time Optional time to compare with the date/time.
|
|
136
|
-
* @returns The difference in number.
|
|
135
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
136
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
137
137
|
*/
|
|
138
138
|
getRelativeHour(time?: string | number | Date | Chronos): number;
|
|
139
139
|
/**
|
|
140
140
|
* * Returns the number of full minutes between the input date and now.
|
|
141
|
-
* @param time Optional time to compare with the date/time.
|
|
142
|
-
* @returns The difference in number.
|
|
141
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
142
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
143
143
|
*/
|
|
144
144
|
getRelativeMinute(time?: string | number | Date | Chronos): number;
|
|
145
145
|
/**
|
|
146
146
|
* * Returns the number of full seconds between the input date and now.
|
|
147
|
-
* @param time Optional time to compare with the date/time.
|
|
148
|
-
* @returns The difference in number.
|
|
147
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
148
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
149
149
|
*/
|
|
150
150
|
getRelativeSecond(time?: string | number | Date | Chronos): number;
|
|
151
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* * Returns the number of milliseconds between the input date and now.
|
|
153
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
154
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
155
|
+
*/
|
|
152
156
|
getRelativeMilliSecond(time?: string | number | Date | Chronos): number;
|
|
153
157
|
/**
|
|
154
158
|
* * Compares the stored date with now, returning the difference in the specified unit.
|
|
155
159
|
*
|
|
156
160
|
* @param unit The time unit to compare by. Defaults to 'minute'.
|
|
157
|
-
* @param time Optional time to compare with the date/time.
|
|
158
|
-
* @returns The difference in number.
|
|
161
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
162
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
159
163
|
*/
|
|
160
164
|
compare(unit?: TimeUnit, time?: string | number | Date | Chron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between the input date and now.
|
|
312
|
-
* @param time Optional time to compare with the date/time.
|
|
313
|
-
* @returns The difference in number.
|
|
312
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
313
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
314
314
|
*/
|
|
315
315
|
getRelativeYear(time) {
|
|
316
316
|
const now = this.#toNewDate(time);
|
|
@@ -325,8 +325,8 @@ export class Chronos {
|
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* * Returns the number of full months between the input date and now.
|
|
328
|
-
* @param time Optional time to compare with the date/time.
|
|
329
|
-
* @returns The difference in number.
|
|
328
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
329
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
330
330
|
*/
|
|
331
331
|
getRelativeMonth(time) {
|
|
332
332
|
const now = this.#toNewDate(time);
|
|
@@ -341,7 +341,7 @@ export class Chronos {
|
|
|
341
341
|
/**
|
|
342
342
|
* * Determines if the given date is today, tomorrow, yesterday or any relative day.
|
|
343
343
|
* @param date - The date to compare (Date object).
|
|
344
|
-
* @param time Optional time to compare with the date/time.
|
|
344
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
345
345
|
* @returns
|
|
346
346
|
* - `-1` if the date is yesterday.
|
|
347
347
|
* - `0` if the date is today.
|
|
@@ -353,7 +353,7 @@ export class Chronos {
|
|
|
353
353
|
// Set the time of today to 00:00:00 for comparison purposes
|
|
354
354
|
today.setHours(0, 0, 0, 0);
|
|
355
355
|
// Normalize the input date to 00:00:00
|
|
356
|
-
const inputDate =
|
|
356
|
+
const inputDate = this.#date;
|
|
357
357
|
inputDate.setHours(0, 0, 0, 0);
|
|
358
358
|
const diffTime = inputDate.getTime() - today.getTime();
|
|
359
359
|
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
|
@@ -361,8 +361,8 @@ export class Chronos {
|
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
363
363
|
* * Returns the number of full hours between the input date and now.
|
|
364
|
-
* @param time Optional time to compare with the date/time.
|
|
365
|
-
* @returns The difference in number.
|
|
364
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
365
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
366
366
|
*/
|
|
367
367
|
getRelativeHour(time) {
|
|
368
368
|
const diff = this.#date.getTime() - this.#toNewDate(time).getTime();
|
|
@@ -370,8 +370,8 @@ export class Chronos {
|
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
372
372
|
* * Returns the number of full minutes between the input date and now.
|
|
373
|
-
* @param time Optional time to compare with the date/time.
|
|
374
|
-
* @returns The difference in number.
|
|
373
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
374
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
375
375
|
*/
|
|
376
376
|
getRelativeMinute(time) {
|
|
377
377
|
const diff = this.#date.getTime() - this.#toNewDate(time).getTime();
|
|
@@ -379,14 +379,18 @@ export class Chronos {
|
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* * Returns the number of full seconds between the input date and now.
|
|
382
|
-
* @param time Optional time to compare with the date/time.
|
|
383
|
-
* @returns The difference in number.
|
|
382
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
383
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
384
384
|
*/
|
|
385
385
|
getRelativeSecond(time) {
|
|
386
386
|
const diff = this.#date.getTime() - this.#toNewDate(time).getTime();
|
|
387
387
|
return Math.floor(diff / 1000);
|
|
388
388
|
}
|
|
389
|
-
/**
|
|
389
|
+
/**
|
|
390
|
+
* * Returns the number of milliseconds between the input date and now.
|
|
391
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
392
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
393
|
+
*/
|
|
390
394
|
getRelativeMilliSecond(time) {
|
|
391
395
|
return this.#date.getTime() - this.#toNewDate(time).getTime();
|
|
392
396
|
}
|
|
@@ -394,8 +398,8 @@ export class Chronos {
|
|
|
394
398
|
* * Compares the stored date with now, returning the difference in the specified unit.
|
|
395
399
|
*
|
|
396
400
|
* @param unit The time unit to compare by. Defaults to 'minute'.
|
|
397
|
-
* @param time Optional time to compare with the date/time.
|
|
398
|
-
* @returns The difference in number.
|
|
401
|
+
* @param time Optional time to compare with the `Chronos` date/time.
|
|
402
|
+
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
399
403
|
*/
|
|
400
404
|
compare(unit = 'minute', time) {
|
|
401
405
|
switch (unit) {
|
package/package.json
CHANGED