chronic_duration icon indicating copy to clipboard operation
chronic_duration copied to clipboard

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

Open AdrianoFerrari opened this issue 13 years ago • 3 comments

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.

AdrianoFerrari avatar Dec 21 '10 22:12 AdrianoFerrari

+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).

stevenbedrick avatar Nov 30 '11 18:11 stevenbedrick

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

mreinsch avatar Jan 08 '13 08:01 mreinsch

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.

pdf avatar Feb 24 '13 01:02 pdf