diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index b4c1adbe76a23a520e23971aa3a00ee3d3c7574b..b7ef1fb90d074581adc2725801665ec19abe5eae 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -931,7 +931,7 @@ def datetime_selector(options, html_options)
end
def default_datetime(options)
- return if options[:include_blank]
+ return if options[:include_blank] || options[:prompt]
case options[:default]
when nil
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb
index 59e921f09bd2a724581fab470bb326a15c963d59..2e4763f4466e618fac15065dfa6acd925d60acd2 100644
--- a/actionpack/test/template/date_helper_test.rb
+++ b/actionpack/test/template/date_helper_test.rb
@@ -1820,60 +1820,60 @@ def test_datetime_select_with_separators
def test_datetime_select_with_default_prompt
@post = Post.new
- @post.updated_at = Time.local(2004, 6, 15, 16, 35)
+ @post.updated_at = nil
expected = %{\n"
expected << %{\n"
expected << %{\n"
expected << " — "
expected << %{\n"
expected << " : "
expected << %{\n"
- assert_dom_equal expected, datetime_select("post", "updated_at", :prompt => true)
+ assert_dom_equal expected, datetime_select("post", "updated_at", :start_year=>1999, :end_year=>2009, :prompt => true)
end
def test_datetime_select_with_custom_prompt
@post = Post.new
- @post.updated_at = Time.local(2004, 6, 15, 16, 35)
+ @post.updated_at = nil
expected = %{\n"
expected << %{\n"
expected << %{\n"
expected << " — "
expected << %{\n"
expected << " : "
expected << %{\n"
- assert_dom_equal expected, datetime_select("post", "updated_at", :prompt => {:year => 'Choose year', :month => 'Choose month', :day => 'Choose day', :hour => 'Choose hour', :minute => 'Choose minute'})
+ assert_dom_equal expected, datetime_select("post", "updated_at", :start_year=>1999, :end_year=>2009, :prompt => {:year => 'Choose year', :month => 'Choose month', :day => 'Choose day', :hour => 'Choose hour', :minute => 'Choose minute'})
end
def test_date_select_with_zero_value_and_no_start_year