public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
select_datetime and select_time default to Time.zone.now when 
config.time_zone is set
gbuesing (author)
Sun Apr 20 22:40:04 -0700 2008
commit  f757f5838818ce35f7927a10a8cda6f9583869c5
tree    daf4e2170f579dd562eb930c6d94254670aa7401
parent  c2c779044ffb1c435f4722f62fcbd400883f3225
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* select_datetime and select_time default to Time.zone.now when config.time_zone is set [Geoff Buesing]
0
+
0
 * datetime_select defaults to Time.zone.now when config.time_zone is set [Geoff Buesing]
0
 
0
 * Remove ActionController::Base#view_controller_internals flag. [Pratik]
...
250
251
252
253
 
254
255
256
...
321
322
323
324
 
325
326
327
...
250
251
252
 
253
254
255
256
...
321
322
323
 
324
325
326
327
0
@@ -250,7 +250,7 @@
0
       # # prefixed with 'payday' rather than 'date'
0
       # select_datetime(my_date_time, :prefix => 'payday')
0
       #
0
- def select_datetime(datetime = Time.now, options = {}, html_options = {})
0
+ def select_datetime(datetime = Time.current, options = {}, html_options = {})
0
         separator = options[:datetime_separator] || ''
0
         select_date(datetime, options, html_options) + separator + select_time(datetime, options, html_options)
0
        end
0
@@ -321,7 +321,7 @@
0
       # # separated by ':' and includes an input for seconds
0
       # select_time(my_time, :time_separator => ':', :include_seconds => true)
0
       #
0
- def select_time(datetime = Time.now, options = {}, html_options = {})
0
+ def select_time(datetime = Time.current, options = {}, html_options = {})
0
         separator = options[:time_separator] || ''
0
         select_hour(datetime, options, html_options) + separator + select_minute(datetime, options, html_options) + (options[:include_seconds] ? separator + select_second(datetime, options, html_options) : '')
0
       end
...
933
934
935
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
937
938
...
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
0
@@ -933,6 +933,24 @@
0
     assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector')
0
     assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {:include_seconds => false}, :class => 'selector')
0
   end
0
+
0
+ uses_mocha 'TestDatetimeAndTimeSelectUseTimeCurrentAsDefault' do
0
+ def test_select_datetime_uses_time_current_as_default
0
+ time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
0
+ Time.expects(:current).returns time
0
+ expects(:select_date).with(time, anything, anything).returns('')
0
+ expects(:select_time).with(time, anything, anything).returns('')
0
+ select_datetime
0
+ end
0
+
0
+ def test_select_time_uses_time_current_as_default
0
+ time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
0
+ Time.expects(:current).returns time
0
+ expects(:select_hour).with(time, anything, anything).returns('')
0
+ expects(:select_minute).with(time, anything, anything).returns('')
0
+ select_time
0
+ end
0
+ end
0
 
0
   def test_date_select
0
     @post = Post.new

Comments

    No one has commented yet.