Skip to content

Commit

Permalink
Ruby 1.9 compat: don't use obsolete ParseDate
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8490 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 27, 2007
1 parent d760d88 commit 05a4db5
Showing 1 changed file with 4 additions and 4 deletions.
@@ -1,4 +1,4 @@
require 'parsedate'
require 'date'

module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
Expand All @@ -12,15 +12,15 @@ def ord

# Form can be either :utc (default) or :local.
def to_time(form = :utc)
::Time.send("#{form}_time", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0})
::Time.send("#{form}_time", *::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })
end

def to_date
::Date.new(*ParseDate.parsedate(self)[0..2])
::Date.new(*::Date._parse(self, false).values_at(:year, :mon, :mday))
end

def to_datetime
::DateTime.civil(*ParseDate.parsedate(self)[0..5].map {|arg| arg || 0} << 0)
::DateTime.civil(*::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })
end
end
end
Expand Down

0 comments on commit 05a4db5

Please sign in to comment.