delorean
delorean copied to clipboard
parse method does not allow specifying timezone
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')
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?
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).
I've got a working fix for this in a branch I think will be released as 0.6.0.
@mlew I will be taking a look at it tonight.
[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.
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 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.
@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.