Sha256: 991fc8f2decd91cc4fe80a507ca85053637c8d1c3e4c9a5b6accc3fc7b668476

Contents?: true

Size: 1.35 KB

Versions: 50

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

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, default: false

    # Change the output of <tt>ActiveSupport::TimeZone.utc_to_local</tt>.
    #
    # When +true+, it returns local times with a UTC offset, with +false+ local
    # times are returned as UTC.
    #
    #   # Given this zone:
    #   zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"]
    #
    #   # With `utc_to_local_returns_utc_offset_times = false`, local time is converted to UTC:
    #   zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 UTC
    #
    #   # With `utc_to_local_returns_utc_offset_times = true`, local time is returned with UTC offset:
    #   zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 -0500
    mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false
  end
end

Version data entries

50 entries across 48 versions & 10 rubygems

Version Path
activesupport-7.1.5 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.4.2 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.0.8.6 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.4.1 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.0.8.5 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.4 lib/active_support/core_ext/date_and_time/compatibility.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.4/lib/active_support/core_ext/date_and_time/compatibility.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/core_ext/date_and_time/compatibility.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/core_ext/date_and_time/compatibility.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/core_ext/date_and_time/compatibility.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.3.4 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.0.8.4 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.3.2 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.3.1 lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.0.8.1 lib/active_support/core_ext/date_and_time/compatibility.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.1.3/lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport-7.1.3 lib/active_support/core_ext/date_and_time/compatibility.rb