123456789_123456789_123456789_123456789_123456789_

Module: DateAndTime::Compatibility

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb

Class Attribute Summary

Instance Attribute Summary

Class Attribute Details

.preserve_timezone (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb', line 22

def self.preserve_timezone
  ActiveSupport.deprecator.warn(
    "`DateAndTime::Compatibility.preserve_timezone` has been deprecated and will be removed in Rails 7.3."
  )
end

.preserve_timezone=(value) (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb', line 28

def self.preserve_timezone=(value)
  ActiveSupport.deprecator.warn(
    "`DateAndTime::Compatibility.preserve_timezone=` has been deprecated and will be removed in Rails 7.3."
  )
end

.utc_to_local_returns_utc_offset_times (rw) Also known as: #utc_to_local_returns_utc_offset_times

Change the output of ActiveSupport::TimeZone.utc_to_local.

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
[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb', line 20

mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false

Instance Attribute Details

#utc_to_local_returns_utc_offset_times (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb', line 20

mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false