Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

offset fix

  • Loading branch information...
commit e715f3a67c8e3d329acaeafd7be0aedf43ae83ef 1 parent a203033
@ttilley authored
View
9 lib/time_crisis/datetime.rb
@@ -245,11 +245,12 @@ def self.strptime_default
# compatibility method for TZInfo
def new_offset(of)
- if of < 0
- of = 1 + of
+ if of.is_a?(Rational)
+ of = (1 + of) if of < 0
+ of = of * 86400
end
-
- self.class.new!(:jd=>jd, :parts=>[hour, min, sec, usec], :offset=>(of * 86400))
+
+ self.class.new!(:jd=>jd, :parts=>[hour, min, sec, usec], :offset=>of.to_i)
end
# Which parts of this datetime were guessed instead of being parsed from the input.
View
2  lib/time_crisis/support/time_with_zone.rb
@@ -215,7 +215,7 @@ def to_datetime
end
def to_tc_datetime
- ::TimeCrisis::DateTime.civil(utc.year, utc.month, utc.day, utc.hour, utc.min, utc.sec, 0, utc_offset)
+ utc.to_tc_datetime.new_offset(utc_offset)
end
def acts_like_time?
Please sign in to comment.
Something went wrong with that request. Please try again.