delorean icon indicating copy to clipboard operation
delorean copied to clipboard

parse method does not allow specifying timezone

Open victorhooi opened this issue 9 years ago • 8 comments

It would be useful if the parse method allowed specifying a timezone.

For example, I'm trying to parse datetime strings from iostat output. They look like this:

08/18/15 16:51:36

Note that there is no timezone information specified. However, I know the timezone based on the timezone of the host system.

Hence, it would be nice if I could use Delorean's parse method, whilst also specifying a timezone. For example:

Delorean.parse('08/18/15 16:51:36', timezone='US/Pacific')

victorhooi avatar Aug 19 '15 04:08 victorhooi

This seems like a good request. How would you want to handle the case where an offset/timezone is provided in the parse string and as an argument? For example:

delorean.parse('08/18/15 16:51:36 -0800', timezone='US/Pacific')

It seems like the timezone parameter should override whatever is in the string. Thoughts?

mlew avatar Aug 19 '15 21:08 mlew

I agree, any passed in parameter should override the timezone in the parsed string. (One possible use case is if you are taking the string to parse from somewhere else, and you want to override the timezone).

victorhooi avatar Aug 20 '15 01:08 victorhooi

I've got a working fix for this in a branch I think will be released as 0.6.0.

mlew avatar Aug 21 '15 05:08 mlew

@mlew I will be taking a look at it tonight.

myusuf3 avatar Aug 21 '15 19:08 myusuf3

[Solved] I have had to upgrade from github "sudo pip install git+git://github.com/myusuf3/delorean.git -U" because on pip repository the last version is 0.5.0

Hi @myusuf3 First Deloeran is an awesome tool but i have a problem with parse method currently im using the version Delorean==0.5.0 and parse method doesn't allow set the timezone yet.

This Exception is show it: TypeError: parse() got an unexpected keyword argument 'timezone'

I have to upgrade from github ?? or from pip because in the master branch i can see the change.

dhararon avatar Nov 12 '15 16:11 dhararon

Looks like 0.6 hasn't been uploaded to cheeseshop. @myusurf3, can you take care of that?

On Thu, Nov 12, 2015 at 8:49 AM, Dharwin Perez [email protected] wrote:

Hi @myusuf3 https://github.com/myusuf3 First Deloeran is an awesome tool but i have a problem with parse method currently im using the version Delorean==0.5.0 and parse method doesn't allow set the timezone yet.

This Exception is show it: TypeError: parse() got an unexpected keyword argument 'timezone'

I have to upgrade from github ?? or from pip because in the master branch i can see the change.

— Reply to this email directly or view it on GitHub https://github.com/myusuf3/delorean/issues/72#issuecomment-156163002.

mlew avatar Nov 12 '15 17:11 mlew

@mlew yeah where there some breaking api changes in 0.6? I was waiting to chat with you! I can release if there are no breaking changes.

@dhararon give a second to sort this out! If there are no breaking changes i will cut a release.

myusuf3 avatar Nov 12 '15 19:11 myusuf3

@mlew lets double check docs when you get a chance i want to cut a release, you think its stable enough to cut 1.0. Lets chat.

myusuf3 avatar Nov 18 '15 00:11 myusuf3