1
votes

I have a SimpleForm for a User, with birthday as an attribute:

t.date "birthday"

I generate a SimpleForm:

<%= f.input :birthday %>

Rails generates the 3 inputs for day, month and year:

enter image description here

But the years just go from 2014 until 2024.

Is this the default behaviour now? I've tried to add myself the collection of years, but I don't have a normal input, I have a date input, which is separated into 3 by Rails, that's why I don't know how to solve the problem.

Can somebody help me?

1

1 Answers

3
votes

Not sure about the defaults, but simple_form allow customizing year range (which is in their README, btw)

  <%= f.input :date_of_birth, as: :date, start_year: Date.today.year - 90,
                              end_year: Date.today.year - 12, discard_day: true,
                              order: [:month, :year] %>