-
-
Save exAspArk/3e9d1dfa5e112b5ebf4e to your computer and use it in GitHub Desktop.
Get rid of TZInfo::AmbiguousTime exception
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
# config/initializers/hacks.rb | |
Dir[Rails.root.join("lib/hacks/**/*.rb")].each { |file| require file } |
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
# lib/hacks/time_zone.rb | |
# HACK to not raise TZInfo::AmbiguousTime error (https://github.com/tzinfo/tzinfo/issues/32) on: | |
# Time.zone.parse('27.10.2014 1:30:00 MSK +03:00') - 1.day | |
# | |
# Please get rid of it when you bump rails version and PR below will be resolved: | |
# https://github.com/rails/rails/pull/17409 | |
module ActiveSupport | |
class TimeZone | |
def period_for_local(time, dst = true) | |
tzinfo.period_for_local(time, dst) { |results| results.first } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment