Sofanisba
Sofanisba

Reputation: 39

Limiting datetime_select to a certain start time

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 %>`

Upvotes: 2

Views: 638

Answers (1)

MilesStanfield
MilesStanfield

Reputation: 4649

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

<%= f.datetime_select :time,  minute_step: 30, start_hour: 17, end_hour: 22 %>`

Upvotes: 6

Related Questions