-
Notifications
You must be signed in to change notification settings - Fork 128
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
Delorean object from aware datetimes #22
Comments
I initially made this the default behaviour in order to help people from making mistakes with passing in localized datetime objects forcing them to take into account what they were actually doing. I can see how this can be annoying for currently existing systems. I will definitely try to get this in an upcoming release. Are there any other examples of usage? That are inconvenient to use it with that I may have missed? |
I have a lot of code that also uses pytz for setting the tzinfo, so another nice feature would be to have the constructor accept as a single argument a datetime that has a pytz timezone: e.g.
|
@myusuf3 No I've not come across anything else that's inconvenient, I'm really enjoying using Delorean. If it had a kwarg that took an aware datetime (ensuring anyone that used it is doing it intentionally) then that would be perfect! |
@mwaterfall @fawce I have added support for dealing with already localized datetime objects. c6f4185 Hope this alleviates some pain with the library. I would reread this section for the new functionality. http://delorean.readthedocs.org/en/latest/quickstart.html#making-some-time |
Since my most common use is shift, I would prefer the time zone parameter to shift an aware date time rather than be ignored. |
@fawce you can still shift after the object is created, but I guess I can update that caveat in an upcoming release. |
@myusuf3 Awesome, thanks for incorporating this feature. Much appreciated :-) |
There seems to be no way to create a
Delorean
object from an awaredatetime
object.Is there a reason for this?
I tend to work with fully aware
datetime
objects in UTC, but with them being passed around and used everywhere, it's not particularly easy to create aDelorean
object from them, without having to do:Which is a bit tedious for an awesome library like Delorean!
I might be a little naive though (excuse the pun!) so I wanted to ask!
The text was updated successfully, but these errors were encountered: