tzinfo patch no longer needed
we have a newer tzinfo in our gemfile than rails has, so this method doesn't need patched (it's already been fixed) Change-Id: I2cee60da0187965f680d73dbe53a0fc751d33984 Reviewed-on: https://gerrit.instructure.com/26598 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
c5114c418a
commit
aa35181cee
|
@ -37,38 +37,6 @@ if RUBY_VERSION < '2.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
if CANVAS_RAILS2
|
if CANVAS_RAILS2
|
||||||
# See http://developer.uservoice.com/entries/how-to-upgrade-a-rails-2.3.14-app-to-ruby-1.9.3/
|
|
||||||
# TZInfo needs to be patched. In particular, you'll need to re-implement the datetime_new! method:
|
|
||||||
require 'tzinfo'
|
|
||||||
|
|
||||||
module TZInfo
|
|
||||||
# Methods to support different versions of Ruby.
|
|
||||||
module RubyCoreSupport #:nodoc:
|
|
||||||
HALF_DAYS_IN_DAY = rational_new!(1, 2)
|
|
||||||
|
|
||||||
# Rails 2.3 defines datetime_new! in terms of methods that don't exist in
|
|
||||||
# Ruby 1.9.3, so we have to redefine it here
|
|
||||||
def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY)
|
|
||||||
# Convert from an Astronomical Julian Day number to a civil Julian Day number.
|
|
||||||
jd = ajd + of + HALF_DAYS_IN_DAY
|
|
||||||
|
|
||||||
# Ruby trunk revision 31862 changed the behaviour of DateTime.jd so that it will no
|
|
||||||
# longer accept a fractional civil Julian Day number if further arguments are specified.
|
|
||||||
# Calculate the hours, minutes and seconds to pass to jd.
|
|
||||||
|
|
||||||
jd_i = jd.to_i
|
|
||||||
jd_i -= 1 if jd < 0
|
|
||||||
hours = (jd - jd_i) * 24
|
|
||||||
hours_i = hours.to_i
|
|
||||||
minutes = (hours - hours_i) * 60
|
|
||||||
minutes_i = minutes.to_i
|
|
||||||
seconds = (minutes - minutes_i) * 60
|
|
||||||
|
|
||||||
DateTime.jd(jd_i, hours_i, minutes_i, seconds, of, sg)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
require "active_support/core_ext/string/output_safety"
|
require "active_support/core_ext/string/output_safety"
|
||||||
class ERB
|
class ERB
|
||||||
module Util
|
module Util
|
||||||
|
|
Loading…
Reference in New Issue