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

"1 week" returns undefined #46

Closed
okor opened this issue Apr 8, 2015 · 5 comments
Closed

"1 week" returns undefined #46

okor opened this issue Apr 8, 2015 · 5 comments

Comments

@okor
Copy link

okor commented Apr 8, 2015

I would expect "1 week" to return a result.

> ~/Projects/voxmedia/tempo $ npm install ms
ms@0.7.0 node_modules/ms
~/Projects/voxmedia/tempo $ node
> var ms = require('ms')
undefined
> ms('5 minutes')
300000
> ms('15 minutes')
900000
> ms('2 hours')
7200000
> ms('2 hour')
7200000
> ms('2 h')
7200000
> ms('1 day')
86400000
> ms('1 week')
undefined
> ms('1 weeks')
undefined
> ms('1 month')
undefined
> ms('1 year')
31557600000

I would also expect "1 month" to return a result (though that one is slightly tricky) and sources seem to disagree.

month

^ I would probably just call it 30 days even and be done with it. Maybe include a note in the docs as to what the library considers 1 month.

Anyhow, weeks should probably work. Otherwise the lib is great. Thanks!

@okor
Copy link
Author

okor commented Apr 8, 2015

And perhaps it would be appropriate to throw an Error if no result can be returned.

@havenchyk
Copy link

@okor If the problem still exists, PR is welcomed!

@LinusU
Copy link

LinusU commented Aug 4, 2015

I would recommend throwing an error, that is what I'm doing in parse-iso-duration.

throw new Error('Ambiguous duration')

@yvele
Copy link

yvele commented May 1, 2016

The month unit is discussed in a dedicated issue: #57

@leo
Copy link
Contributor

leo commented Sep 3, 2016

#57

@leo leo closed this as completed Sep 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants