Skip to content
Browse files

Merge pull request #4639 from joevandyk/datetime-infinity-select-fix

datetime_select fix for dates of -infinity and +infinity
  • Loading branch information...
2 parents dc81d00 + 59a408e commit 1d67f1ade761db75bceb30d914c4280cc3dbc984 @tenderlove tenderlove committed Jan 24, 2012
Showing with 13 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_view/helpers/date_helper.rb
  2. +12 −0 actionpack/test/template/date_helper_test.rb
View
2 actionpack/lib/action_view/helpers/date_helper.rb
@@ -783,7 +783,7 @@ def select_year
private
%w( sec min hour day month year ).each do |method|
define_method(method) do
- @datetime.kind_of?(Fixnum) ? @datetime : @datetime.send(method) if @datetime
+ @datetime.kind_of?(Numeric) ? @datetime : @datetime.send(method) if @datetime
end
end
View
12 actionpack/test/template/date_helper_test.rb
@@ -2118,6 +2118,18 @@ def test_datetime_select_with_separators
assert_dom_equal expected, datetime_select("post", "updated_at", { :date_separator => " / ", :datetime_separator => " , ", :time_separator => " - ", :include_seconds => true })
end
+ def test_datetime_select_with_integer
+ @post = Post.new
+ @post.updated_at = 3
+ datetime_select("post", "updated_at")
+ end
+
+ def test_datetime_select_with_infinity # Float
+ @post = Post.new
+ @post.updated_at = (-1.0/0)
+ datetime_select("post", "updated_at")
+ end
+
def test_datetime_select_with_default_prompt
@post = Post.new
@post.updated_at = nil

0 comments on commit 1d67f1a

Please sign in to comment.
Something went wrong with that request. Please try again.