Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(additional-units): add additional units #6

Open
richrdkng opened this issue Oct 5, 2019 · 0 comments
Open

feat(additional-units): add additional units #6

richrdkng opened this issue Oct 5, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request
Projects
Milestone

Comments

@richrdkng
Copy link
Member

richrdkng commented Oct 5, 2019

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 year won'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 value
duration('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 ? later
duration('1 year', { from: 1580385600000 }) // 2020-01-30 12:00:00 GMT in epoch milliseconds
@richrdkng richrdkng added the enhancement New feature or request label Oct 5, 2019
@richrdkng richrdkng added this to the 2.x.x milestone Oct 5, 2019
@richrdkng richrdkng self-assigned this Oct 5, 2019
@richrdkng richrdkng added this to To do in duration via automation Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
duration
  
To do
Development

No branches or pull requests

1 participant