pytimeparse icon indicating copy to clipboard operation
pytimeparse copied to clipboard

Doesn't have a default time unit when given just a number

Open baadal-bharosa opened this issue 6 years ago • 3 comments

If we do parse("10"), it returns None. Maybe the module should define (or have a setting) for a default time unit. That way we get a predictable output.

baadal-bharosa avatar Mar 12 '19 01:03 baadal-bharosa

I feel that returning None is a predictable output.

cackovic avatar Mar 12 '19 01:03 cackovic

Sorry for not expressing the thought fully. By "predictable output" what I implied was to get an output that is still a function of the input. Instead of None which is invariant.

The module addresses most of the issues with respect to processing various possible formats of specifying the time. Only thing I found missing was what I mentioned above - when we give it a number without any format hints.

To overcome this, the user will have to check the input and add some default format hint.

I felt that adding this support makes the module more comprehensive.

baadal-bharosa avatar Mar 12 '19 06:03 baadal-bharosa

Yeah I feel like a simple number should be parsed as plain seconds.

markusressel avatar Aug 31 '19 10:08 markusressel