Module: ActiveSupport::CoreExtensions::DateTime::Calculations::ClassMethods
- Defined in:
- lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb
Instance Method Summary collapse
- #current ⇒ Object
-
#local_offset ⇒ Object
DateTimes aren’t aware of DST rules, so use a consistent non-DST offset when creating a DateTime with an offset in the local zone.
Instance Method Details
#current ⇒ Object
23 24 25 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb', line 23 def current ::Time.zone_default ? ::Time.zone.now.to_datetime : ::Time.now.to_datetime end |
#local_offset ⇒ Object
DateTimes aren’t aware of DST rules, so use a consistent non-DST offset when creating a DateTime with an offset in the local zone
19 20 21 |
# File 'lib/gems/activesupport-2.2.2/lib/active_support/core_ext/date_time/calculations.rb', line 19 def local_offset ::Time.local(2007).utc_offset.to_r / 86400 end |