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

ChronicDuration::parse("0min") returns nil, not 0 #3

Open
AdrianoFerrari opened this issue Dec 21, 2010 · 3 comments
Open

ChronicDuration::parse("0min") returns nil, not 0 #3

AdrianoFerrari opened this issue Dec 21, 2010 · 3 comments

Comments

@AdrianoFerrari
Copy link

ChronicDuration::parse("0") returns nil, not 0.
ChronicDuration::parse("0s") returns nil, not 0.
ChronicDuration::parse("0min") returns nil, not 0.

This is unexpected behavior, since those are valid strings that represent a time duration of zero.

@stevenbedrick
Copy link

+1 for this; there should if nothing else be a configuration option. I'm happy to add it, but just in case am wondering if there's any particular reason that ChronicDuration::parse() has this behavior (so I can avoid breaking it with my patch).

@mreinsch
Copy link

mreinsch commented Jan 8, 2013

same here, we were trying ChronicDuration.parse("00:00") and it returned quite unexpectedly nil instead of 0.

@pdf
Copy link
Contributor

pdf commented Feb 24, 2013

This can be closed per #23 - if you want zeros from parse or output, use the option :keep_zero => true, as per the updated readme.

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

Successfully merging a pull request may close this issue.

4 participants