Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

datetime_select should work with -/+ infinity dates

  • Loading branch information...
commit 59a408eb64729909aca15ef59291aea2cef951e2 1 parent dc826f9
Joe Van Dyk joevandyk authored
2  actionpack/lib/action_view/helpers/date_helper.rb
View
@@ -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
12 actionpack/test/template/date_helper_test.rb
View
@@ -2084,6 +2084,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
Please sign in to comment.
Something went wrong with that request. Please try again.