@@ -508,7 +508,7 @@ def select_hour(datetime, options = {}, html_options = {})
508508
509509 # Returns a select tag with options for each of the days 1 through 31 with the current day selected.
510510 # The <tt>date</tt> can also be substituted for a day number.
511- # If you want to display days with a leading zero set the <tt>:use_two_digit_numbers</tt> key in +options+ to true.
511+ # If you want to display days with a leading zero set the <tt>:use_two_digit_numbers</tt> key in +options+ to true.
512512 # Override the field name using the <tt>:field_name</tt> option, 'day' by default.
513513 #
514514 # ==== Examples
@@ -854,7 +854,7 @@ def date_order
854854 end
855855
856856 def translated_date_order
857- date_order = I18n . translate ( :'date.order' , :locale => @options [ :locale ] ) || [ ]
857+ date_order = I18n . translate ( :'date.order' , :locale => @options [ :locale ] , :default => [ ] )
858858
859859 forbidden_elements = date_order - [ :year , :month , :day ]
860860 if forbidden_elements . any?
@@ -990,18 +990,12 @@ def build_selects_from_types(order)
990990 # Returns the separator for a given datetime component.
991991 def separator ( type )
992992 case type
993- when :year
994- @options [ :discard_year ] ? "" : @options [ :date_separator ]
995- when :month
996- @options [ :discard_month ] ? "" : @options [ :date_separator ]
997- when :day
998- @options [ :discard_day ] ? "" : @options [ :date_separator ]
993+ when :year , :month , :day
994+ @options [ :"discard_#{ type } " ] ? "" : @options [ :date_separator ]
999995 when :hour
1000996 ( @options [ :discard_year ] && @options [ :discard_day ] ) ? "" : @options [ :datetime_separator ]
1001- when :minute
1002- @options [ :discard_minute ] ? "" : @options [ :time_separator ]
1003- when :second
1004- @options [ :include_seconds ] ? @options [ :time_separator ] : ""
997+ when :minute , :second
998+ @options [ :"discard_#{ type } " ] ? "" : @options [ :time_separator ]
1005999 end
10061000 end
10071001 end
0 commit comments