Sha256: cf2d393b3bc3af6a001599956418a004801fe62cbb6dd2ef9e6210fe62cf6f64

Contents?: true

Size: 352 Bytes

Versions: 11

Compression:

Stored size: 352 Bytes

Contents

require 'date'
require 'active_support/core_ext/time/zones'

class Date
  # Converts Date to a TimeWithZone in the current zone if Time.zone_default is set,
  # otherwise converts Date to a Time via Date#to_time
  def to_time_in_current_zone
    if ::Time.zone_default
      ::Time.zone.local(year, month, day)
    else
      to_time
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/date/zones.rb
activesupport-3.0.5 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.5.rc1 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.4 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.4.rc1 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.3 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.2 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.1 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.0 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.0.rc2 lib/active_support/core_ext/date/zones.rb
activesupport-3.0.0.rc lib/active_support/core_ext/date/zones.rb