@naturalcycles/js-lib 14.189.0 → 14.190.0

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.
@@ -93,16 +93,16 @@ export declare class LocalDate {
93
93
  * a.diff(b) means "a minus b"
94
94
  */
95
95
  diff(d: LocalDateInput, unit: LocalDateUnit): number;
96
- add(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
97
- subtract(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
96
+ plus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
98
97
  /**
99
- * Alias to subtract
98
+ * @deprecated use `minus` instead
100
99
  */
100
+ subtract(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
101
101
  minus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
102
102
  /**
103
- * Alias to add
103
+ * @deprecated use `plus` instead
104
104
  */
105
- plus(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
105
+ add(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
106
106
  startOf(unit: LocalDateUnitStrict): LocalDate;
107
107
  endOf(unit: LocalDateUnitStrict): LocalDate;
108
108
  static getYearLength(year: number): number;
@@ -117,12 +117,12 @@ class LocalDate {
117
117
  // ok
118
118
  }
119
119
  else {
120
- current.add(1, stepUnit, true);
120
+ current.plus(1, stepUnit, true);
121
121
  }
122
122
  const incl2 = incl[1] === ']';
123
123
  while (current.isBefore($max, incl2)) {
124
124
  dates.push(current);
125
- current = current.add(step, stepUnit);
125
+ current = current.plus(step, stepUnit);
126
126
  }
127
127
  return dates;
128
128
  }
@@ -189,13 +189,13 @@ class LocalDate {
189
189
  * Third argument allows to override "today".
190
190
  */
191
191
  isOlderThan(n, unit, today) {
192
- return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit));
192
+ return this.isBefore(LocalDate.of(today || new Date()).plus(-n, unit));
193
193
  }
194
194
  /**
195
195
  * Checks if this localDate is same or older (<=) than "today" by X units.
196
196
  */
197
197
  isSameOrOlderThan(n, unit, today) {
198
- return this.isSameOrBefore(LocalDate.of(today || new Date()).add(-n, unit));
198
+ return this.isSameOrBefore(LocalDate.of(today || new Date()).plus(-n, unit));
199
199
  }
200
200
  /**
201
201
  * Checks if this localDate is younger (>) than "today" by X units.
@@ -207,13 +207,13 @@ class LocalDate {
207
207
  * Third argument allows to override "today".
208
208
  */
209
209
  isYoungerThan(n, unit, today) {
210
- return this.isAfter(LocalDate.of(today || new Date()).add(-n, unit));
210
+ return this.isAfter(LocalDate.of(today || new Date()).plus(-n, unit));
211
211
  }
212
212
  /**
213
213
  * Checks if this localDate is same or younger (>=) than "today" by X units.
214
214
  */
215
215
  isSameOrYoungerThan(n, unit, today) {
216
- return this.isSameOrAfter(LocalDate.of(today || new Date()).add(-n, unit));
216
+ return this.isSameOrAfter(LocalDate.of(today || new Date()).plus(-n, unit));
217
217
  }
218
218
  /**
219
219
  * Returns 1 if this > d
@@ -297,7 +297,7 @@ class LocalDate {
297
297
  }
298
298
  return days * sign || 0;
299
299
  }
300
- add(num, unit, mutate = false) {
300
+ plus(num, unit, mutate = false) {
301
301
  let { $day, $month, $year } = this;
302
302
  if (unit === 'week') {
303
303
  num *= 7;
@@ -361,20 +361,20 @@ class LocalDate {
361
361
  }
362
362
  return new LocalDate($year, $month, $day);
363
363
  }
364
- subtract(num, unit, mutate = false) {
365
- return this.add(-num, unit, mutate);
366
- }
367
364
  /**
368
- * Alias to subtract
365
+ * @deprecated use `minus` instead
369
366
  */
367
+ subtract(num, unit, mutate = false) {
368
+ return this.plus(-num, unit, mutate);
369
+ }
370
370
  minus(num, unit, mutate = false) {
371
- return this.add(-num, unit, mutate);
371
+ return this.plus(-num, unit, mutate);
372
372
  }
373
373
  /**
374
- * Alias to add
374
+ * @deprecated use `plus` instead
375
375
  */
376
- plus(num, unit, mutate = false) {
377
- return this.add(num, unit, mutate);
376
+ add(num, unit, mutate = false) {
377
+ return this.plus(num, unit, mutate);
378
378
  }
379
379
  startOf(unit) {
380
380
  if (unit === 'day')
@@ -70,16 +70,16 @@ export declare class LocalTime {
70
70
  second(): number;
71
71
  second(v: number): LocalTime;
72
72
  setComponents(c: Partial<LocalTimeComponents>, mutate?: boolean): LocalTime;
73
- add(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
74
- subtract(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
73
+ plus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
75
74
  /**
76
- * Alias to subtract.
75
+ * @deprecated use `minus` instead
77
76
  */
77
+ subtract(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
78
78
  minus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
79
79
  /**
80
- * Alias to add.
80
+ * @deprecated use `plus` instead
81
81
  */
82
- plus(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
82
+ add(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
83
83
  absDiff(other: LocalTimeInput, unit: LocalTimeUnit): number;
84
84
  diff(other: LocalTimeInput, unit: LocalTimeUnit): number;
85
85
  startOf(unit: LocalTimeUnit, mutate?: boolean): LocalTime;
@@ -172,7 +172,7 @@ class LocalTime {
172
172
  return dow;
173
173
  }
174
174
  (0, assert_1._assert)(VALID_DAYS_OF_WEEK.has(v), `Invalid dayOfWeek: ${v}`);
175
- return this.add(v - dow, 'day');
175
+ return this.plus(v - dow, 'day');
176
176
  }
177
177
  hour(v) {
178
178
  return v === undefined ? this.get('hour') : this.set('hour', v);
@@ -200,7 +200,7 @@ class LocalTime {
200
200
  }
201
201
  return mutate ? this : new LocalTime(d);
202
202
  }
203
- add(num, unit, mutate = false) {
203
+ plus(num, unit, mutate = false) {
204
204
  if (unit === 'week') {
205
205
  num *= 7;
206
206
  unit = 'day';
@@ -211,20 +211,20 @@ class LocalTime {
211
211
  }
212
212
  return this.set(unit, this.get(unit) + num, mutate);
213
213
  }
214
- subtract(num, unit, mutate = false) {
215
- return this.add(num * -1, unit, mutate);
216
- }
217
214
  /**
218
- * Alias to subtract.
215
+ * @deprecated use `minus` instead
219
216
  */
217
+ subtract(num, unit, mutate = false) {
218
+ return this.plus(num * -1, unit, mutate);
219
+ }
220
220
  minus(num, unit, mutate = false) {
221
- return this.add(num * -1, unit, mutate);
221
+ return this.plus(num * -1, unit, mutate);
222
222
  }
223
223
  /**
224
- * Alias to add.
224
+ * @deprecated use `plus` instead
225
225
  */
226
- plus(num, unit, mutate = false) {
227
- return this.add(num, unit, mutate);
226
+ add(num, unit, mutate = false) {
227
+ return this.plus(num, unit, mutate);
228
228
  }
229
229
  absDiff(other, unit) {
230
230
  return Math.abs(this.diff(other, unit));
@@ -379,13 +379,13 @@ class LocalTime {
379
379
  * Third argument allows to override "now".
380
380
  */
381
381
  isOlderThan(n, unit, now) {
382
- return this.isBefore(LocalTime.of(now ?? new Date()).add(-n, unit));
382
+ return this.isBefore(LocalTime.of(now ?? new Date()).plus(-n, unit));
383
383
  }
384
384
  /**
385
385
  * Checks if this localTime is same or older (<=) than "now" by X units.
386
386
  */
387
387
  isSameOrOlderThan(n, unit, now) {
388
- return this.isSameOrBefore(LocalTime.of(now ?? new Date()).add(-n, unit));
388
+ return this.isSameOrBefore(LocalTime.of(now ?? new Date()).plus(-n, unit));
389
389
  }
390
390
  /**
391
391
  * Checks if this localTime is younger (>) than "now" by X units.
@@ -397,13 +397,13 @@ class LocalTime {
397
397
  * Third argument allows to override "now".
398
398
  */
399
399
  isYoungerThan(n, unit, now) {
400
- return this.isAfter(LocalTime.of(now ?? new Date()).add(-n, unit));
400
+ return this.isAfter(LocalTime.of(now ?? new Date()).plus(-n, unit));
401
401
  }
402
402
  /**
403
403
  * Checks if this localTime is same or younger (>=) than "now" by X units.
404
404
  */
405
405
  isSameOrYoungerThan(n, unit, now) {
406
- return this.isSameOrAfter(LocalTime.of(now ?? new Date()).add(-n, unit));
406
+ return this.isSameOrAfter(LocalTime.of(now ?? new Date()).plus(-n, unit));
407
407
  }
408
408
  /**
409
409
  * Returns 1 if this > d
@@ -114,12 +114,12 @@ export class LocalDate {
114
114
  // ok
115
115
  }
116
116
  else {
117
- current.add(1, stepUnit, true);
117
+ current.plus(1, stepUnit, true);
118
118
  }
119
119
  const incl2 = incl[1] === ']';
120
120
  while (current.isBefore($max, incl2)) {
121
121
  dates.push(current);
122
- current = current.add(step, stepUnit);
122
+ current = current.plus(step, stepUnit);
123
123
  }
124
124
  return dates;
125
125
  }
@@ -186,13 +186,13 @@ export class LocalDate {
186
186
  * Third argument allows to override "today".
187
187
  */
188
188
  isOlderThan(n, unit, today) {
189
- return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit));
189
+ return this.isBefore(LocalDate.of(today || new Date()).plus(-n, unit));
190
190
  }
191
191
  /**
192
192
  * Checks if this localDate is same or older (<=) than "today" by X units.
193
193
  */
194
194
  isSameOrOlderThan(n, unit, today) {
195
- return this.isSameOrBefore(LocalDate.of(today || new Date()).add(-n, unit));
195
+ return this.isSameOrBefore(LocalDate.of(today || new Date()).plus(-n, unit));
196
196
  }
197
197
  /**
198
198
  * Checks if this localDate is younger (>) than "today" by X units.
@@ -204,13 +204,13 @@ export class LocalDate {
204
204
  * Third argument allows to override "today".
205
205
  */
206
206
  isYoungerThan(n, unit, today) {
207
- return this.isAfter(LocalDate.of(today || new Date()).add(-n, unit));
207
+ return this.isAfter(LocalDate.of(today || new Date()).plus(-n, unit));
208
208
  }
209
209
  /**
210
210
  * Checks if this localDate is same or younger (>=) than "today" by X units.
211
211
  */
212
212
  isSameOrYoungerThan(n, unit, today) {
213
- return this.isSameOrAfter(LocalDate.of(today || new Date()).add(-n, unit));
213
+ return this.isSameOrAfter(LocalDate.of(today || new Date()).plus(-n, unit));
214
214
  }
215
215
  /**
216
216
  * Returns 1 if this > d
@@ -294,7 +294,7 @@ export class LocalDate {
294
294
  }
295
295
  return days * sign || 0;
296
296
  }
297
- add(num, unit, mutate = false) {
297
+ plus(num, unit, mutate = false) {
298
298
  let { $day, $month, $year } = this;
299
299
  if (unit === 'week') {
300
300
  num *= 7;
@@ -358,20 +358,20 @@ export class LocalDate {
358
358
  }
359
359
  return new LocalDate($year, $month, $day);
360
360
  }
361
- subtract(num, unit, mutate = false) {
362
- return this.add(-num, unit, mutate);
363
- }
364
361
  /**
365
- * Alias to subtract
362
+ * @deprecated use `minus` instead
366
363
  */
364
+ subtract(num, unit, mutate = false) {
365
+ return this.plus(-num, unit, mutate);
366
+ }
367
367
  minus(num, unit, mutate = false) {
368
- return this.add(-num, unit, mutate);
368
+ return this.plus(-num, unit, mutate);
369
369
  }
370
370
  /**
371
- * Alias to add
371
+ * @deprecated use `plus` instead
372
372
  */
373
- plus(num, unit, mutate = false) {
374
- return this.add(num, unit, mutate);
373
+ add(num, unit, mutate = false) {
374
+ return this.plus(num, unit, mutate);
375
375
  }
376
376
  startOf(unit) {
377
377
  if (unit === 'day')
@@ -169,7 +169,7 @@ export class LocalTime {
169
169
  return dow;
170
170
  }
171
171
  _assert(VALID_DAYS_OF_WEEK.has(v), `Invalid dayOfWeek: ${v}`);
172
- return this.add(v - dow, 'day');
172
+ return this.plus(v - dow, 'day');
173
173
  }
174
174
  hour(v) {
175
175
  return v === undefined ? this.get('hour') : this.set('hour', v);
@@ -198,7 +198,7 @@ export class LocalTime {
198
198
  }
199
199
  return mutate ? this : new LocalTime(d);
200
200
  }
201
- add(num, unit, mutate = false) {
201
+ plus(num, unit, mutate = false) {
202
202
  if (unit === 'week') {
203
203
  num *= 7;
204
204
  unit = 'day';
@@ -209,20 +209,20 @@ export class LocalTime {
209
209
  }
210
210
  return this.set(unit, this.get(unit) + num, mutate);
211
211
  }
212
- subtract(num, unit, mutate = false) {
213
- return this.add(num * -1, unit, mutate);
214
- }
215
212
  /**
216
- * Alias to subtract.
213
+ * @deprecated use `minus` instead
217
214
  */
215
+ subtract(num, unit, mutate = false) {
216
+ return this.plus(num * -1, unit, mutate);
217
+ }
218
218
  minus(num, unit, mutate = false) {
219
- return this.add(num * -1, unit, mutate);
219
+ return this.plus(num * -1, unit, mutate);
220
220
  }
221
221
  /**
222
- * Alias to add.
222
+ * @deprecated use `plus` instead
223
223
  */
224
- plus(num, unit, mutate = false) {
225
- return this.add(num, unit, mutate);
224
+ add(num, unit, mutate = false) {
225
+ return this.plus(num, unit, mutate);
226
226
  }
227
227
  absDiff(other, unit) {
228
228
  return Math.abs(this.diff(other, unit));
@@ -377,13 +377,13 @@ export class LocalTime {
377
377
  * Third argument allows to override "now".
378
378
  */
379
379
  isOlderThan(n, unit, now) {
380
- return this.isBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
380
+ return this.isBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
381
381
  }
382
382
  /**
383
383
  * Checks if this localTime is same or older (<=) than "now" by X units.
384
384
  */
385
385
  isSameOrOlderThan(n, unit, now) {
386
- return this.isSameOrBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
386
+ return this.isSameOrBefore(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
387
387
  }
388
388
  /**
389
389
  * Checks if this localTime is younger (>) than "now" by X units.
@@ -395,13 +395,13 @@ export class LocalTime {
395
395
  * Third argument allows to override "now".
396
396
  */
397
397
  isYoungerThan(n, unit, now) {
398
- return this.isAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
398
+ return this.isAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
399
399
  }
400
400
  /**
401
401
  * Checks if this localTime is same or younger (>=) than "now" by X units.
402
402
  */
403
403
  isSameOrYoungerThan(n, unit, now) {
404
- return this.isSameOrAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).add(-n, unit));
404
+ return this.isSameOrAfter(LocalTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
405
405
  }
406
406
  /**
407
407
  * Returns 1 if this > d
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.189.0",
3
+ "version": "14.190.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -22,7 +22,7 @@
22
22
  "crypto-js": "^4.1.1",
23
23
  "jest": "^29.0.0",
24
24
  "prettier": "^3.0.0",
25
- "vitepress": "^1.0.0-rc.12",
25
+ "vitepress": "^1.0.0-rc.22",
26
26
  "vue": "^3.2.45"
27
27
  },
28
28
  "resolutions": {
@@ -163,13 +163,13 @@ export class LocalDate {
163
163
  if (current.isAfter($min, incl[0] === '[')) {
164
164
  // ok
165
165
  } else {
166
- current.add(1, stepUnit, true)
166
+ current.plus(1, stepUnit, true)
167
167
  }
168
168
 
169
169
  const incl2 = incl[1] === ']'
170
170
  while (current.isBefore($max, incl2)) {
171
171
  dates.push(current)
172
- current = current.add(step, stepUnit)
172
+ current = current.plus(step, stepUnit)
173
173
  }
174
174
 
175
175
  return dates
@@ -251,14 +251,14 @@ export class LocalDate {
251
251
  * Third argument allows to override "today".
252
252
  */
253
253
  isOlderThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
254
- return this.isBefore(LocalDate.of(today || new Date()).add(-n, unit))
254
+ return this.isBefore(LocalDate.of(today || new Date()).plus(-n, unit))
255
255
  }
256
256
 
257
257
  /**
258
258
  * Checks if this localDate is same or older (<=) than "today" by X units.
259
259
  */
260
260
  isSameOrOlderThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
261
- return this.isSameOrBefore(LocalDate.of(today || new Date()).add(-n, unit))
261
+ return this.isSameOrBefore(LocalDate.of(today || new Date()).plus(-n, unit))
262
262
  }
263
263
 
264
264
  /**
@@ -271,14 +271,14 @@ export class LocalDate {
271
271
  * Third argument allows to override "today".
272
272
  */
273
273
  isYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
274
- return this.isAfter(LocalDate.of(today || new Date()).add(-n, unit))
274
+ return this.isAfter(LocalDate.of(today || new Date()).plus(-n, unit))
275
275
  }
276
276
 
277
277
  /**
278
278
  * Checks if this localDate is same or younger (>=) than "today" by X units.
279
279
  */
280
280
  isSameOrYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean {
281
- return this.isSameOrAfter(LocalDate.of(today || new Date()).add(-n, unit))
281
+ return this.isSameOrAfter(LocalDate.of(today || new Date()).plus(-n, unit))
282
282
  }
283
283
 
284
284
  /**
@@ -373,7 +373,7 @@ export class LocalDate {
373
373
  return days * sign || 0
374
374
  }
375
375
 
376
- add(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
376
+ plus(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
377
377
  let { $day, $month, $year } = this
378
378
 
379
379
  if (unit === 'week') {
@@ -443,22 +443,22 @@ export class LocalDate {
443
443
  return new LocalDate($year, $month, $day)
444
444
  }
445
445
 
446
+ /**
447
+ * @deprecated use `minus` instead
448
+ */
446
449
  subtract(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
447
- return this.add(-num, unit, mutate)
450
+ return this.plus(-num, unit, mutate)
448
451
  }
449
452
 
450
- /**
451
- * Alias to subtract
452
- */
453
453
  minus(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
454
- return this.add(-num, unit, mutate)
454
+ return this.plus(-num, unit, mutate)
455
455
  }
456
456
 
457
457
  /**
458
- * Alias to add
458
+ * @deprecated use `plus` instead
459
459
  */
460
- plus(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
461
- return this.add(num, unit, mutate)
460
+ add(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
461
+ return this.plus(num, unit, mutate)
462
462
  }
463
463
 
464
464
  startOf(unit: LocalDateUnitStrict): LocalDate {
@@ -224,7 +224,7 @@ export class LocalTime {
224
224
 
225
225
  _assert(VALID_DAYS_OF_WEEK.has(v), `Invalid dayOfWeek: ${v}`)
226
226
 
227
- return this.add(v - dow, 'day')
227
+ return this.plus(v - dow, 'day')
228
228
  }
229
229
  hour(): number
230
230
  hour(v: number): LocalTime
@@ -267,7 +267,7 @@ export class LocalTime {
267
267
  return mutate ? this : new LocalTime(d)
268
268
  }
269
269
 
270
- add(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
270
+ plus(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
271
271
  if (unit === 'week') {
272
272
  num *= 7
273
273
  unit = 'day'
@@ -281,22 +281,22 @@ export class LocalTime {
281
281
  return this.set(unit, this.get(unit) + num, mutate)
282
282
  }
283
283
 
284
+ /**
285
+ * @deprecated use `minus` instead
286
+ */
284
287
  subtract(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
285
- return this.add(num * -1, unit, mutate)
288
+ return this.plus(num * -1, unit, mutate)
286
289
  }
287
290
 
288
- /**
289
- * Alias to subtract.
290
- */
291
291
  minus(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
292
- return this.add(num * -1, unit, mutate)
292
+ return this.plus(num * -1, unit, mutate)
293
293
  }
294
294
 
295
295
  /**
296
- * Alias to add.
296
+ * @deprecated use `plus` instead
297
297
  */
298
- plus(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
299
- return this.add(num, unit, mutate)
298
+ add(num: number, unit: LocalTimeUnit, mutate = false): LocalTime {
299
+ return this.plus(num, unit, mutate)
300
300
  }
301
301
 
302
302
  absDiff(other: LocalTimeInput, unit: LocalTimeUnit): number {
@@ -465,14 +465,14 @@ export class LocalTime {
465
465
  * Third argument allows to override "now".
466
466
  */
467
467
  isOlderThan(n: number, unit: LocalTimeUnit, now?: LocalTimeInput): boolean {
468
- return this.isBefore(LocalTime.of(now ?? new Date()).add(-n, unit))
468
+ return this.isBefore(LocalTime.of(now ?? new Date()).plus(-n, unit))
469
469
  }
470
470
 
471
471
  /**
472
472
  * Checks if this localTime is same or older (<=) than "now" by X units.
473
473
  */
474
474
  isSameOrOlderThan(n: number, unit: LocalTimeUnit, now?: LocalTimeInput): boolean {
475
- return this.isSameOrBefore(LocalTime.of(now ?? new Date()).add(-n, unit))
475
+ return this.isSameOrBefore(LocalTime.of(now ?? new Date()).plus(-n, unit))
476
476
  }
477
477
 
478
478
  /**
@@ -485,14 +485,14 @@ export class LocalTime {
485
485
  * Third argument allows to override "now".
486
486
  */
487
487
  isYoungerThan(n: number, unit: LocalTimeUnit, now?: LocalTimeInput): boolean {
488
- return this.isAfter(LocalTime.of(now ?? new Date()).add(-n, unit))
488
+ return this.isAfter(LocalTime.of(now ?? new Date()).plus(-n, unit))
489
489
  }
490
490
 
491
491
  /**
492
492
  * Checks if this localTime is same or younger (>=) than "now" by X units.
493
493
  */
494
494
  isSameOrYoungerThan(n: number, unit: LocalTimeUnit, now?: LocalTimeInput): boolean {
495
- return this.isSameOrAfter(LocalTime.of(now ?? new Date()).add(-n, unit))
495
+ return this.isSameOrAfter(LocalTime.of(now ?? new Date()).plus(-n, unit))
496
496
  }
497
497
 
498
498
  /**