Created
March 23, 2012 13:04
-
-
Save ramhoj/2170462 to your computer and use it in GitHub Desktop.
Time.zone.parse bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use | |
| DateTime.parse("2012-03-25 03:29").in_time_zone(Time.zone) | |
| # Instead of | |
| Time.zone.parse("2012-03-25 03:29") | |
| # Until the pull request https://github.com/jarkko/rails/commit/bb4a1d68f6db8bf99d2b6e21eee72a19d494dee0 has been pulled into Rails. |
So yeah, go ahead :-)
Author
Damn you copy-pate! :).
Thanks for catching that. The blog post is now updated at http://elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails#bug_in_timezoneparse
I really appreciate you going down to the bottom of this issue. I know that I've seen it briefly before but it went a way and I didn't had the time to understand what was really going on. Great to have it all figured out now!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks dandy. Note though that the second example shouldn't push the time up by an hour. The problem of course is that if you'd use PST instead (i.e. are not sure whether it is or is not DST at that point), it would break: