I am trying to set the helper's birth date in my Rails application (2.3.5). This is currently the case.
<%= f.date_select :date_of_birth, :start_year => Time.now.year - 110, :end_year => Time.now.year %>
This generates a perfectly functional set of date fields that work fine, but ....
By default, they have today's date, which is not ideal for the date of birth (I'm not sure what it is, but if you are not working with a newborn unit, today the date seems less ideal). I want him to read January 1, 2010 (or 2011, or any other year when this happens). Using the: default option failed. I have tried many features, including:
<%= f.date_select :date_of_birth, :default => {:year => Time.now.year, :month => 'Jan', :day => 1}, :start_year => Time.now.year - 110, :end_year => Time.now.year %>
and
<%= f.date_select :date_of_birth, :default => Time.local(2010,'Jan',1), :start_year => Time.now.year - 110, :end_year => Time.now.year %>
None of this changes the behavior of the first example. Does the default option really work as described? It seems like this should be a fairly simple task.
That one.
source share