timecop icon indicating copy to clipboard operation
timecop copied to clipboard

Time.zone utc offset not freezing correctly

Open epbarger opened this issue 11 years ago • 1 comments

Within an RSpec test...

  Timecop.travel(Time.parse('June 2014'))
  Time.use_zone(customer.time_zone) do
    customer.time_zone # => "Pacific Time (US & Canada)"
    Date.today # => Sun, 01 Jun 2014
    Date.today.in_time_zone.utc_offset # => -25200 (correct for the frozen Date)
    Time.zone.utc_offset # => -28800 (incorrect for frozen Date, correct for current Feb 9)

    example.run
  end
  Timecop.return

epbarger avatar Feb 09 '15 18:02 epbarger

probably pretty closely-related to #130 and #134, but also very tightly-coupled with ActiveSupport (since Date#in_time_zone, Time#zone, ActiveSupport::TimeZone#utc_offset all need to correctly be aware the mocked time instead of real time), and may be dependent on what version of ActiveSupport you're using.

yaauie avatar Feb 09 '15 18:02 yaauie