select_datetime and select_time default to Time.zone.now when config.time_zone is set
This commit is contained in:
parent
c2c779044f
commit
f757f58388
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* select_datetime and select_time default to Time.zone.now when config.time_zone is set [Geoff Buesing]
|
||||
|
||||
* datetime_select defaults to Time.zone.now when config.time_zone is set [Geoff Buesing]
|
||||
|
||||
* Remove ActionController::Base#view_controller_internals flag. [Pratik]
|
||||
|
@ -250,7 +250,7 @@ def datetime_select(object_name, method, options = {}, html_options = {})
|
||||
# # prefixed with 'payday' rather than 'date'
|
||||
# select_datetime(my_date_time, :prefix => 'payday')
|
||||
#
|
||||
def select_datetime(datetime = Time.now, options = {}, html_options = {})
|
||||
def select_datetime(datetime = Time.current, options = {}, html_options = {})
|
||||
separator = options[:datetime_separator] || ''
|
||||
select_date(datetime, options, html_options) + separator + select_time(datetime, options, html_options)
|
||||
end
|
||||
@ -321,7 +321,7 @@ def select_date(date = Date.today, options = {}, html_options = {})
|
||||
# # separated by ':' and includes an input for seconds
|
||||
# select_time(my_time, :time_separator => ':', :include_seconds => true)
|
||||
#
|
||||
def select_time(datetime = Time.now, options = {}, html_options = {})
|
||||
def select_time(datetime = Time.current, options = {}, html_options = {})
|
||||
separator = options[:time_separator] || ''
|
||||
select_hour(datetime, options, html_options) + separator + select_minute(datetime, options, html_options) + (options[:include_seconds] ? separator + select_second(datetime, options, html_options) : '')
|
||||
end
|
||||
|
@ -934,6 +934,24 @@ def test_select_time_with_html_options
|
||||
assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {:include_seconds => false}, :class => 'selector')
|
||||
end
|
||||
|
||||
uses_mocha 'TestDatetimeAndTimeSelectUseTimeCurrentAsDefault' do
|
||||
def test_select_datetime_uses_time_current_as_default
|
||||
time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
|
||||
Time.expects(:current).returns time
|
||||
expects(:select_date).with(time, anything, anything).returns('')
|
||||
expects(:select_time).with(time, anything, anything).returns('')
|
||||
select_datetime
|
||||
end
|
||||
|
||||
def test_select_time_uses_time_current_as_default
|
||||
time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
|
||||
Time.expects(:current).returns time
|
||||
expects(:select_hour).with(time, anything, anything).returns('')
|
||||
expects(:select_minute).with(time, anything, anything).returns('')
|
||||
select_time
|
||||
end
|
||||
end
|
||||
|
||||
def test_date_select
|
||||
@post = Post.new
|
||||
@post.written_on = Date.new(2004, 6, 15)
|
||||
|
Loading…
Reference in New Issue
Block a user