Search code examples
ruby-on-railsdatetimeformbuilder

Is there a way to limit selections in the Rails FormBuilder datetime select helper?


I want to use FormBuilder's datetime_select helper to create dropdowns for a datetime field and want to specify which minute values to use in the drop down (let's say, I want to use 0, 15, 30 and 45.)

Is there some hidden option to f.datetime_select that will let me do this?


Solution

  • You can use :minute_step option like this

    <%= f.datetime_select :start_datetime, :ampm => true, :minute_step => 15 %>