Skip to content
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

Fix pytz conversion error #254

Merged
merged 1 commit into from
Aug 7, 2015
Merged

Fix pytz conversion error #254

merged 1 commit into from
Aug 7, 2015

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Aug 3, 2015

I have an issue to report and not sure if it is related #154 .

I have the issue that arrow.to() return wrong offset as well.
According to pytz's README, caller should call zone_instance.localize() instead of just passing zone_instance to standard python datetime.

From arrow.to()'s internal implementation, we should assign new arrow instance with astimezone() returned timezone which is correct from zone.localize().

Tested with #154 's case: ( arrow==0.5.4 , pytz==2015.4 )

In [1]: import arrow

In [2]: import pytz

In [3]: str(arrow.utcnow().to(pytz.timezone("America/Los_Angeles")).datetime)
Out[3]: '2015-08-03 03:00:50.856870-07:00'

In [4]: str(arrow.utcnow().to(pytz.timezone("America/Los_Angeles")))
Out[4]: '2015-08-03T03:01:47.165010-07:00'

In [5]: str(arrow.utcnow().to("America/Los_Angeles").datetime)
Out[5]: '2015-08-03 03:01:57.318926-07:00'

In [6]: str(arrow.utcnow().to("America/Los_Angeles"))
Out[6]: '2015-08-03T03:02:02.303030-07:00'

andrewelkins added a commit that referenced this pull request Aug 7, 2015
Fix pytz conversion error Thanks @Kudo
@andrewelkins andrewelkins merged commit cb652c8 into arrow-py:master Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants