@naturalcycles/js-lib 14.246.2 → 14.247.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.
@@ -55,6 +55,11 @@ export declare class LocalDate {
55
55
  * Checks if this localDate is same or younger (>=) than "today" by X units.
56
56
  */
57
57
  isSameOrYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean;
58
+ isToday(): boolean;
59
+ isAfterToday(): boolean;
60
+ isSameOrAfterToday(): boolean;
61
+ isBeforeToday(): boolean;
62
+ isSameOrBeforeToday(): boolean;
58
63
  getAgeInYears(today?: LocalDateInput): number;
59
64
  getAgeInMonths(today?: LocalDateInput): number;
60
65
  getAgeInDays(today?: LocalDateInput): number;
@@ -113,6 +113,21 @@ class LocalDate {
113
113
  isSameOrYoungerThan(n, unit, today) {
114
114
  return this.isSameOrAfter(exports.localDate.fromInput(today || new Date()).plus(-n, unit));
115
115
  }
116
+ isToday() {
117
+ return this.isSame(exports.localDate.today());
118
+ }
119
+ isAfterToday() {
120
+ return this.isAfter(exports.localDate.today());
121
+ }
122
+ isSameOrAfterToday() {
123
+ return this.isSameOrAfter(exports.localDate.today());
124
+ }
125
+ isBeforeToday() {
126
+ return this.isBefore(exports.localDate.today());
127
+ }
128
+ isSameOrBeforeToday() {
129
+ return this.isSameOrBefore(exports.localDate.today());
130
+ }
116
131
  getAgeInYears(today) {
117
132
  return this.getAgeIn('year', today);
118
133
  }
@@ -172,6 +172,8 @@ export declare class LocalTime {
172
172
  getAgeInMinutes(now?: LocalTimeInput): number;
173
173
  getAgeInSeconds(now?: LocalTimeInput): number;
174
174
  getAgeIn(unit: LocalTimeUnit, now?: LocalTimeInput): number;
175
+ isAfterNow(): boolean;
176
+ isBeforeNow(): boolean;
175
177
  /**
176
178
  * Returns 1 if this > d
177
179
  * returns 0 if they are equal
@@ -479,6 +479,12 @@ class LocalTime {
479
479
  getAgeIn(unit, now) {
480
480
  return exports.localTime.fromInput(now ?? new Date()).diff(this, unit);
481
481
  }
482
+ isAfterNow() {
483
+ return this.$date.valueOf() > Date.now();
484
+ }
485
+ isBeforeNow() {
486
+ return this.$date.valueOf() < Date.now();
487
+ }
482
488
  /**
483
489
  * Returns 1 if this > d
484
490
  * returns 0 if they are equal
@@ -110,6 +110,21 @@ export class LocalDate {
110
110
  isSameOrYoungerThan(n, unit, today) {
111
111
  return this.isSameOrAfter(localDate.fromInput(today || new Date()).plus(-n, unit));
112
112
  }
113
+ isToday() {
114
+ return this.isSame(localDate.today());
115
+ }
116
+ isAfterToday() {
117
+ return this.isAfter(localDate.today());
118
+ }
119
+ isSameOrAfterToday() {
120
+ return this.isSameOrAfter(localDate.today());
121
+ }
122
+ isBeforeToday() {
123
+ return this.isBefore(localDate.today());
124
+ }
125
+ isSameOrBeforeToday() {
126
+ return this.isSameOrBefore(localDate.today());
127
+ }
113
128
  getAgeInYears(today) {
114
129
  return this.getAgeIn('year', today);
115
130
  }
@@ -476,6 +476,12 @@ export class LocalTime {
476
476
  getAgeIn(unit, now) {
477
477
  return localTime.fromInput(now ?? new Date()).diff(this, unit);
478
478
  }
479
+ isAfterNow() {
480
+ return this.$date.valueOf() > Date.now();
481
+ }
482
+ isBeforeNow() {
483
+ return this.$date.valueOf() < Date.now();
484
+ }
479
485
  /**
480
486
  * Returns 1 if this > d
481
487
  * returns 0 if they are equal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.246.2",
3
+ "version": "14.247.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -141,6 +141,22 @@ export class LocalDate {
141
141
  return this.isSameOrAfter(localDate.fromInput(today || new Date()).plus(-n, unit))
142
142
  }
143
143
 
144
+ isToday(): boolean {
145
+ return this.isSame(localDate.today())
146
+ }
147
+ isAfterToday(): boolean {
148
+ return this.isAfter(localDate.today())
149
+ }
150
+ isSameOrAfterToday(): boolean {
151
+ return this.isSameOrAfter(localDate.today())
152
+ }
153
+ isBeforeToday(): boolean {
154
+ return this.isBefore(localDate.today())
155
+ }
156
+ isSameOrBeforeToday(): boolean {
157
+ return this.isSameOrBefore(localDate.today())
158
+ }
159
+
144
160
  getAgeInYears(today?: LocalDateInput): number {
145
161
  return this.getAgeIn('year', today)
146
162
  }
@@ -538,6 +538,13 @@ export class LocalTime {
538
538
  return localTime.fromInput(now ?? new Date()).diff(this, unit)
539
539
  }
540
540
 
541
+ isAfterNow(): boolean {
542
+ return this.$date.valueOf() > Date.now()
543
+ }
544
+ isBeforeNow(): boolean {
545
+ return this.$date.valueOf() < Date.now()
546
+ }
547
+
541
548
  /**
542
549
  * Returns 1 if this > d
543
550
  * returns 0 if they are equal