When are polymorphic association rails used

Strange time zone problem with Pytz

Life is Strange Partner in Time Issue 13 of 16 Reading How does she live?

An offset of seven hours and 37 minutes? That's a little strange, does anyone have the same problem?

In fact, I get a different behavior in between

  • What's the problem with accuracy?
  • See stackoverflow.com/questions/11442183/…
  • Possible duplicate of the Python datetime object shows an incorrect time zone offset

Time zones and offsets change over the years. The default zone name and offset given by pytz when creating a time zone object are the earliest available for that zone, and at times they can seem strange. When you use to append the zone to a date, the correct zone name and offset are replaced. Simply using the constructor for appending the zone to the date does not allow for proper customization.

While I'm sure historical changes in time zones are a factor, passing the Pytz time zone object to the DateTime constructor leads to strange behavior, even in time zones where no changes have been made since it was first introduced.


If you create the datetime object and then localize it, you will get the results you expect


  • Before November 1883, there were no standard time zones in the United States. Time was local: en.wikipedia.org/wiki/Time_in_the_United_States#History. I'm assuming the time zone database returns New York time.
  • If you look at sample data from the Olson database, you can see that New York was offset from before. So it is wrong that the New York time zone never changed.
  • I am corrected. That would explain this behavior for data times in 1883, but not for 2020
  • See my answer. The tzinfo object doesn't know what date you're going to use with it unless you use it. For some reason, Pytz thinks 1883 is as likely as 2020.
  • 1 Correct, but it is still reasonable to expect datetime to use the time zone object passed in according to the data parameters passed to its constructor.

Author: Rhys Tapia, email