You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add more units with configurable durations (e.g.: how long a year should actually be - 365 days exactly, or 365.25 days, or just use from option to calculate from):
months ('month', 'months')
quarters ('q', 'qrt', 'quarter', 'quarters')
years ('y', 'yr', 'year', 'years')
For example, if 1 year is given, by default, calculate a year from the time of calling the function, e.g.: duration('1 year') is called on 2020-01-30 12:00:00, in this case 1 yearwon't be~365.25 days, but calculate the actual milliseconds between 2020-01-30 12:00:00 and 2021-01-30 12:00:00 - (in this case it's 366 days === 31622400000 milliseconds).
Also consider providing a calculate duration from option, e.g.:
// default valueduration('1 year',{from: 'now'})// custom date (string as human-readable date)duration('1 year',{from: '2020-01-30 12:00:00'})// custom date (a number in milliseconds? or seconds? from epoch) - consider ? laterduration('1 year',{from: 1580385600000})// 2020-01-30 12:00:00 GMT in epoch milliseconds
The text was updated successfully, but these errors were encountered:
Add more units with configurable durations (e.g.: how long a
year
should actually be -365
days exactly, or365.25
days, or just usefrom
option to calculate from):'month'
,'months'
)'q'
,'qrt'
,'quarter'
,'quarters'
)'y'
,'yr'
,'year'
,'years'
)For example, if
1 year
is given, by default, calculate a year from the time of calling the function, e.g.:duration('1 year')
is called on2020-01-30 12:00:00
, in this case1 year
won't be~365.25 days
, but calculate the actual milliseconds between2020-01-30 12:00:00
and2021-01-30 12:00:00
- (in this case it's366 days === 31622400000 milliseconds
).Also consider providing a calculate duration from option, e.g.:
The text was updated successfully, but these errors were encountered: