提交 b9cbadf1 编写于 作者: J Joe Van Dyk 提交者: Alexey Vakhov

datetime_select should work with -/+ infinity dates

上级 dd0275e4
......@@ -795,7 +795,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
......
......@@ -2132,6 +2132,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册