Reputation: 20222
I have a form which has a field of type Date
.
The following line creates an input for the field, where the user can choose the date.
<%= f.date_select :start_date %>
How can I make it display only weekdays as input options?
Upvotes: 0
Views: 486
Reputation: 10673
It's not possible to do what you want with a date_select helper. You have two alternatives (and one isn't really an alternative):
1) Write a validation in the model that fails if the date selected is not a weekend; or
2) Use a JavaScript date picker (like jQuery DatePicker), which is the only real solution. You can disable specific days or categories of days with DatePicker.
Upvotes: 1