Sha256: 99920f7cef608ad1943fd25b791714a461d88b41f84fb9ce1bea0682010c6e96

Contents?: true

Size: 674 Bytes

Versions: 8

Compression:

Stored size: 674 Bytes

Contents

require 'active_support/core_ext/module/attribute_accessors'

module DateAndTime
  module Compatibility
    # If true, +to_time+ preserves the timezone offset of receiver.
    #
    # NOTE: With Ruby 2.4+ the default for +to_time+ changed from
    # converting to the local system time, to preserving the offset
    # of the receiver. For backwards compatibility we're overriding
    # this behavior, but new apps will have an initializer that sets
    # this to true, because the new behavior is preferred.
    mattr_accessor(:preserve_timezone, instance_writer: false) { false }

    def to_time
      preserve_timezone ? getlocal(utc_offset) : getlocal
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/activesupport-5.0.0/lib/active_support/core_ext/date_and_time/compatibility.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0.1 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0.rc2 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0.racecar1 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0.rc1 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-5.0.0.beta4 lib/active_support/core_ext/date_and_time/compatibility.rb