Skip to content

fix #272 #273

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

Merged
merged 1 commit into from
Mar 1, 2016
Merged

fix #272 #273

merged 1 commit into from
Mar 1, 2016

Conversation

alpha-beta-soup
Copy link
Contributor

Fixes problem with nightshade checking whether a datetime is in UTC; it was rejecting datetimes that have their tzinfo explicitly set to UTC. The check has now been corrected and simplified.

In [37]: d = datetime.datetime.now()

In [38]: bool(d.utcoffset()) # time-zone naive
Out[38]: False

In [39]: d = d.replace(tzinfo=pytz.UTC)

In [40]: bool(d.utcoffset()) # utc
Out[41]: False

In [41]: eastern = pytz.timezone('US/Eastern')

In [42]: d = d.replace(tzinfo=eastern)

In [43]: bool(d.utcoffset()) # non-utc, non-zero offset
Out[43]: True

So therefore the check only needs to be if date.utcoffset():, which catches all non-zero offsets, and allows the naive case to continue passing.

WeatherGod added a commit that referenced this pull request Mar 1, 2016
@WeatherGod WeatherGod merged commit c67d89c into matplotlib:master Mar 1, 2016
@WeatherGod
Copy link
Member

Thank you!

@alpha-beta-soup alpha-beta-soup deleted the iss272 branch March 1, 2016 20:02
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.

2 participants