2

Is there a way to limit datetime_select in rails so that it only shows certain hours, e.g. so that the only options are 5pm-10pm? currently only have this:`

<%= f.label :time %><br>
<%= f.datetime_select :time,  :minute_step => 30 %>`
Sofanisba
  • 39
  • 4

1 Answers1

6

This will give you an hour range between 5pm - 10pm

<%= f.datetime_select :time,  minute_step: 30, start_hour: 17, end_hour: 22 %>`
MilesStanfield
  • 4,571
  • 1
  • 21
  • 32