Reputation: 5178
<%= simple_form_for(@model) do |f| %>
<%= f.input birthday %>
<div class="form-actions">
<%= f.button :submit, "Submit" %>
</div>
<% end %>
The default months and days work just fine, but the range of selection for years is too slim. Default only goes from 2010 - 2020. How do I change it so it ranges from, say, 1930 - current year?
Upvotes: 3
Views: 2558
Reputation: 5178
<%= simple_form_for(@model) do |f| %>
<%= f.input :birthday, start_year: Date.today.year - 110, end_year: Date.today.year %>
<div class="form-actions">
<%= f.button :submit, "Submit" %>
</div>
<% end %>
This gives the possible year selection from current year to 110 years ago.
Found here: http://apidock.com/rails/ActionView/Helpers/DateHelper/date_select
Upvotes: 10