@naturalcycles/js-lib
Advanced tools
Comparing version 14.237.0 to 14.238.0
@@ -108,2 +108,14 @@ import { _assert } from '../error/assert'; | ||
} | ||
getAgeInYears(today) { | ||
return this.getAgeIn('year', today); | ||
} | ||
getAgeInMonths(today) { | ||
return this.getAgeIn('month', today); | ||
} | ||
getAgeInDays(today) { | ||
return this.getAgeIn('day', today); | ||
} | ||
getAgeIn(unit, today) { | ||
return localDate.of(today || new Date()).diff(this, unit); | ||
} | ||
/** | ||
@@ -110,0 +122,0 @@ * Returns 1 if this > d |
@@ -418,2 +418,23 @@ import { _assert } from '../error/assert'; | ||
} | ||
getAgeInYears(now) { | ||
return this.getAgeIn('year', now); | ||
} | ||
getAgeInMonths(now) { | ||
return this.getAgeIn('month', now); | ||
} | ||
getAgeInDays(now) { | ||
return this.getAgeIn('day', now); | ||
} | ||
getAgeInHours(now) { | ||
return this.getAgeIn('hour', now); | ||
} | ||
getAgeInMinutes(now) { | ||
return this.getAgeIn('minute', now); | ||
} | ||
getAgeInSeconds(now) { | ||
return this.getAgeIn('second', now); | ||
} | ||
getAgeIn(unit, now) { | ||
return localTime.of(now ?? new Date()).diff(this, unit); | ||
} | ||
/** | ||
@@ -420,0 +441,0 @@ * Returns 1 if this > d |
@@ -60,2 +60,6 @@ import { Iterable2 } from '../iter/iterable2'; | ||
isSameOrYoungerThan(n: number, unit: LocalDateUnit, today?: LocalDateInput): boolean; | ||
getAgeInYears(today?: LocalDateInput): number; | ||
getAgeInMonths(today?: LocalDateInput): number; | ||
getAgeInDays(today?: LocalDateInput): number; | ||
getAgeIn(unit: LocalDateUnit, today?: LocalDateInput): number; | ||
/** | ||
@@ -62,0 +66,0 @@ * Returns 1 if this > d |
@@ -111,2 +111,14 @@ "use strict"; | ||
} | ||
getAgeInYears(today) { | ||
return this.getAgeIn('year', today); | ||
} | ||
getAgeInMonths(today) { | ||
return this.getAgeIn('month', today); | ||
} | ||
getAgeInDays(today) { | ||
return this.getAgeIn('day', today); | ||
} | ||
getAgeIn(unit, today) { | ||
return exports.localDate.of(today || new Date()).diff(this, unit); | ||
} | ||
/** | ||
@@ -113,0 +125,0 @@ * Returns 1 if this > d |
@@ -166,2 +166,9 @@ import type { Inclusiveness, IsoDateString, IsoDateTimeString, MonthId, NumberOfHours, NumberOfMinutes, SortDirection, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types'; | ||
isSameOrYoungerThan(n: number, unit: LocalTimeUnit, now?: LocalTimeInput): boolean; | ||
getAgeInYears(now?: LocalTimeInput): number; | ||
getAgeInMonths(now?: LocalTimeInput): number; | ||
getAgeInDays(now?: LocalTimeInput): number; | ||
getAgeInHours(now?: LocalTimeInput): number; | ||
getAgeInMinutes(now?: LocalTimeInput): number; | ||
getAgeInSeconds(now?: LocalTimeInput): number; | ||
getAgeIn(unit: LocalTimeUnit, now?: LocalTimeInput): number; | ||
/** | ||
@@ -168,0 +175,0 @@ * Returns 1 if this > d |
@@ -421,2 +421,23 @@ "use strict"; | ||
} | ||
getAgeInYears(now) { | ||
return this.getAgeIn('year', now); | ||
} | ||
getAgeInMonths(now) { | ||
return this.getAgeIn('month', now); | ||
} | ||
getAgeInDays(now) { | ||
return this.getAgeIn('day', now); | ||
} | ||
getAgeInHours(now) { | ||
return this.getAgeIn('hour', now); | ||
} | ||
getAgeInMinutes(now) { | ||
return this.getAgeIn('minute', now); | ||
} | ||
getAgeInSeconds(now) { | ||
return this.getAgeIn('second', now); | ||
} | ||
getAgeIn(unit, now) { | ||
return exports.localTime.of(now ?? new Date()).diff(this, unit); | ||
} | ||
/** | ||
@@ -423,0 +444,0 @@ * Returns 1 if this > d |
{ | ||
"name": "@naturalcycles/js-lib", | ||
"version": "14.237.0", | ||
"version": "14.238.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "prepare": "husky", |
@@ -144,2 +144,15 @@ import { _assert } from '../error/assert' | ||
getAgeInYears(today?: LocalDateInput): number { | ||
return this.getAgeIn('year', today) | ||
} | ||
getAgeInMonths(today?: LocalDateInput): number { | ||
return this.getAgeIn('month', today) | ||
} | ||
getAgeInDays(today?: LocalDateInput): number { | ||
return this.getAgeIn('day', today) | ||
} | ||
getAgeIn(unit: LocalDateUnit, today?: LocalDateInput): number { | ||
return localDate.of(today || new Date()).diff(this, unit) | ||
} | ||
/** | ||
@@ -146,0 +159,0 @@ * Returns 1 if this > d |
@@ -503,2 +503,24 @@ import { _assert } from '../error/assert' | ||
getAgeInYears(now?: LocalTimeInput): number { | ||
return this.getAgeIn('year', now) | ||
} | ||
getAgeInMonths(now?: LocalTimeInput): number { | ||
return this.getAgeIn('month', now) | ||
} | ||
getAgeInDays(now?: LocalTimeInput): number { | ||
return this.getAgeIn('day', now) | ||
} | ||
getAgeInHours(now?: LocalTimeInput): number { | ||
return this.getAgeIn('hour', now) | ||
} | ||
getAgeInMinutes(now?: LocalTimeInput): number { | ||
return this.getAgeIn('minute', now) | ||
} | ||
getAgeInSeconds(now?: LocalTimeInput): number { | ||
return this.getAgeIn('second', now) | ||
} | ||
getAgeIn(unit: LocalTimeUnit, now?: LocalTimeInput): number { | ||
return localTime.of(now ?? new Date()).diff(this, unit) | ||
} | ||
/** | ||
@@ -505,0 +527,0 @@ * Returns 1 if this > d |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1044181
31435