@naturalcycles/js-lib 14.188.1 → 14.188.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/datetime/localDate.d.ts +6 -2
- package/dist/datetime/localDate.js +6 -0
- package/dist/datetime/localTime.d.ts +4 -0
- package/dist/datetime/localTime.js +6 -0
- package/dist-esm/datetime/localDate.js +6 -0
- package/dist-esm/datetime/localTime.js +6 -0
- package/package.json +1 -1
- package/src/datetime/localDate.ts +9 -2
- package/src/datetime/localTime.ts +7 -0
|
@@ -58,7 +58,7 @@ export declare class LocalDate {
|
|
|
58
58
|
*
|
|
59
59
|
* Third argument allows to override "today".
|
|
60
60
|
*/
|
|
61
|
-
isOlderThan(n: number, unit:
|
|
61
|
+
isOlderThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean;
|
|
62
62
|
/**
|
|
63
63
|
* Checks if this localDate is younger than "today" by X units.
|
|
64
64
|
*
|
|
@@ -68,7 +68,7 @@ export declare class LocalDate {
|
|
|
68
68
|
*
|
|
69
69
|
* Third argument allows to override "today".
|
|
70
70
|
*/
|
|
71
|
-
isYoungerThan(n: number, unit:
|
|
71
|
+
isYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean;
|
|
72
72
|
/**
|
|
73
73
|
* Returns 1 if this > d
|
|
74
74
|
* returns 0 if they are equal
|
|
@@ -91,6 +91,10 @@ export declare class LocalDate {
|
|
|
91
91
|
* Alias to subtract
|
|
92
92
|
*/
|
|
93
93
|
minus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
|
|
94
|
+
/**
|
|
95
|
+
* Alias to add
|
|
96
|
+
*/
|
|
97
|
+
plus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
|
|
94
98
|
startOf(unit: LocalDateUnitStrict): LocalDate;
|
|
95
99
|
endOf(unit: LocalDateUnitStrict): LocalDate;
|
|
96
100
|
static getYearLength(year: number): number;
|
|
@@ -358,6 +358,12 @@ class LocalDate {
|
|
|
358
358
|
minus(num, unit, mutate = false) {
|
|
359
359
|
return this.add(-num, unit, mutate);
|
|
360
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Alias to add
|
|
363
|
+
*/
|
|
364
|
+
plus(num, unit, mutate = false) {
|
|
365
|
+
return this.add(num, unit, mutate);
|
|
366
|
+
}
|
|
361
367
|
startOf(unit) {
|
|
362
368
|
if (unit === 'day')
|
|
363
369
|
return this;
|
|
@@ -76,6 +76,10 @@ export declare class LocalTime {
|
|
|
76
76
|
* Alias to subtract.
|
|
77
77
|
*/
|
|
78
78
|
minus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
79
|
+
/**
|
|
80
|
+
* Alias to add.
|
|
81
|
+
*/
|
|
82
|
+
plus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
79
83
|
absDiff(other: LocalTimeInput, unit: LocalTimeUnit): number;
|
|
80
84
|
diff(other: LocalTimeInput, unit: LocalTimeUnit): number;
|
|
81
85
|
startOf(unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
@@ -220,6 +220,12 @@ class LocalTime {
|
|
|
220
220
|
minus(num, unit, mutate = false) {
|
|
221
221
|
return this.add(num * -1, unit, mutate);
|
|
222
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Alias to add.
|
|
225
|
+
*/
|
|
226
|
+
plus(num, unit, mutate = false) {
|
|
227
|
+
return this.add(num, unit, mutate);
|
|
228
|
+
}
|
|
223
229
|
absDiff(other, unit) {
|
|
224
230
|
return Math.abs(this.diff(other, unit));
|
|
225
231
|
}
|
|
@@ -355,6 +355,12 @@ export class LocalDate {
|
|
|
355
355
|
minus(num, unit, mutate = false) {
|
|
356
356
|
return this.add(-num, unit, mutate);
|
|
357
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Alias to add
|
|
360
|
+
*/
|
|
361
|
+
plus(num, unit, mutate = false) {
|
|
362
|
+
return this.add(num, unit, mutate);
|
|
363
|
+
}
|
|
358
364
|
startOf(unit) {
|
|
359
365
|
if (unit === 'day')
|
|
360
366
|
return this;
|
|
@@ -218,6 +218,12 @@ export class LocalTime {
|
|
|
218
218
|
minus(num, unit, mutate = false) {
|
|
219
219
|
return this.add(num * -1, unit, mutate);
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Alias to add.
|
|
223
|
+
*/
|
|
224
|
+
plus(num, unit, mutate = false) {
|
|
225
|
+
return this.add(num, unit, mutate);
|
|
226
|
+
}
|
|
221
227
|
absDiff(other, unit) {
|
|
222
228
|
return Math.abs(this.diff(other, unit));
|
|
223
229
|
}
|
package/package.json
CHANGED
|
@@ -249,7 +249,7 @@ export class LocalDate {
|
|
|
249
249
|
*
|
|
250
250
|
* Third argument allows to override "today".
|
|
251
251
|
*/
|
|
252
|
-
isOlderThan(n: number, unit:
|
|
252
|
+
isOlderThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
|
|
253
253
|
return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit))
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -262,7 +262,7 @@ export class LocalDate {
|
|
|
262
262
|
*
|
|
263
263
|
* Third argument allows to override "today".
|
|
264
264
|
*/
|
|
265
|
-
isYoungerThan(n: number, unit:
|
|
265
|
+
isYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
|
|
266
266
|
return !this.isOlderThan(n, unit, today)
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -439,6 +439,13 @@ export class LocalDate {
|
|
|
439
439
|
return this.add(-num, unit, mutate)
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Alias to add
|
|
444
|
+
*/
|
|
445
|
+
plus(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
|
|
446
|
+
return this.add(num, unit, mutate)
|
|
447
|
+
}
|
|
448
|
+
|
|
442
449
|
startOf(unit: LocalDateUnitStrict): LocalDate {
|
|
443
450
|
if (unit === 'day') return this
|
|
444
451
|
if (unit === 'month') return LocalDate.create(this.$year, this.$month, 1)
|
|
@@ -291,6 +291,13 @@ export class LocalTime {
|
|
|
291
291
|
return this.add(num * -1, unit, mutate)
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Alias to add.
|
|
296
|
+
*/
|
|
297
|
+
plus(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
|
|
298
|
+
return this.add(num, unit, mutate)
|
|
299
|
+
}
|
|
300
|
+
|
|
294
301
|
absDiff(other: LocalTimeInput, unit: LocalTimeUnit): number {
|
|
295
302
|
return Math.abs(this.diff(other, unit))
|
|
296
303
|
}
|