diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2010-07-10 17:36:10 +0100 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2010-07-10 17:36:10 +0100 |
commit | cd2bbed9846d84a1230a1b9e52843eedca17b28d (patch) | |
tree | 5214b7855f3d102e4c22239b9d62bc5717cb3547 /activesupport/lib/active_support/core_ext/date/conversions.rb | |
parent | d2c633ba0bfb7baacdee89a46d7d036d24c68817 (diff) | |
parent | 80e47d7b88dcc732ebeb5290faab6e529829dac6 (diff) | |
download | rails-cd2bbed9846d84a1230a1b9e52843eedca17b28d.tar.gz rails-cd2bbed9846d84a1230a1b9e52843eedca17b28d.tar.bz2 rails-cd2bbed9846d84a1230a1b9e52843eedca17b28d.zip |
Merge branch 'master' of http://github.com/rails/rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date/conversions.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/conversions.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb index ba17b0a06b..092f936961 100644 --- a/activesupport/lib/active_support/core_ext/date/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date/conversions.rb @@ -1,6 +1,6 @@ require 'date' require 'active_support/inflector' -require 'active_support/core_ext/time/calculations' +require 'active_support/core_ext/date/zones' class Date DATE_FORMATS = { @@ -13,10 +13,10 @@ class Date } # Ruby 1.9 has Date#to_time which converts to localtime only. - remove_method :to_time if instance_methods.include?(:to_time) + remove_method :to_time if method_defined?(:to_time) # Ruby 1.9 has Date#xmlschema which converts to a string without the time component. - remove_method :xmlschema if instance_methods.include?(:xmlschema) + remove_method :xmlschema if method_defined?(:xmlschema) # Convert to a formatted string. See DATE_FORMATS for predefined formats. # @@ -81,16 +81,6 @@ class Date def to_time(form = :local) ::Time.send("#{form}_time", year, month, day) end - - # 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 # Converts a Date instance to a DateTime, where the time is set to the beginning of the day # and UTC offset is set to 0. |