aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-20 18:22:21 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-20 18:22:21 +0100
commit7ab47751068c6480e7e44fc9265a7e690dd4af3b (patch)
tree256b236f0d37625f9d74af4d4280a4673fb4f805 /activesupport/lib/active_support/core_ext/date
parent51095be1b08b1dd2a8a049f009bac6220fa7a68b (diff)
downloadrails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.tar.gz
rails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.tar.bz2
rails-7ab47751068c6480e7e44fc9265a7e690dd4af3b.zip
Initial pass at removing dead 1.8.x code from Active Support.
There are a bunch of other implicit branches that adds 1.8.x specific code that still needs to be removed. Pull requests for those cases are welcome.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb18
-rw-r--r--activesupport/lib/active_support/core_ext/date/conversions.rb23
2 files changed, 0 insertions, 41 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index f0f67765c6..2212e0b3ca 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -7,24 +7,6 @@ require 'active_support/core_ext/time/zones'
class Date
DAYS_INTO_WEEK = { :monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6 }
- if RUBY_VERSION < '1.9'
- undef :>>
-
- # Backported from 1.9. The one in 1.8 leads to incorrect next_month and
- # friends for dates where the calendar reform is involved. It additionally
- # prevents an infinite loop fixed in r27013.
- def >>(n)
- y, m = (year * 12 + (mon - 1) + n).divmod(12)
- m, = (m + 1) .divmod(1)
- d = mday
- until jd2 = self.class.valid_civil?(y, m, d, start)
- d -= 1
- raise ArgumentError, 'invalid date' unless d > 0
- end
- self + (jd2 - jd)
- end
- end
-
class << self
# Returns a new Date representing the date 1 day ago (i.e. yesterday's date).
def yesterday
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb
index 338104fd05..3262c254f7 100644
--- a/activesupport/lib/active_support/core_ext/date/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -63,12 +63,6 @@ class Date
alias_method :default_inspect, :inspect
alias_method :inspect, :readable_inspect
- # A method to keep Time, Date and DateTime instances interchangeable on conversions.
- # In this case, it simply returns +self+.
- def to_date
- self
- end if RUBY_VERSION < '1.9'
-
# Converts a Date instance to a Time, where the time is set to the beginning of the day.
# The timezone can be either :local or :utc (default :local).
#
@@ -83,23 +77,6 @@ class Date
::Time.send("#{form}_time", year, month, day)
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.
- #
- # ==== Examples
- # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
- #
- # date.to_datetime # => Sat, 10 Nov 2007 00:00:00 0000
- def to_datetime
- ::DateTime.civil(year, month, day, 0, 0, 0, 0)
- end if RUBY_VERSION < '1.9'
-
- def iso8601
- strftime('%F')
- end if RUBY_VERSION < '1.9'
-
- alias_method :rfc3339, :iso8601 if RUBY_VERSION < '1.9'
-
def xmlschema
to_time_in_current_zone.xmlschema
end