Reputation: 593
I need my date select form field to show users only the future dates (like for eg. today is 7 apr 2016, then it must show all dates beyond 7 apr 2016) and for month field it must only show the current month,year(any)
<%= f.date_select :start_date,class: 'form-control'%>
Year: any
Date: only future dates
Month: the current ongoing month
Upvotes: 0
Views: 631
Reputation: 47
There are two ways:
Using date_select you only have the option of restricting the starting year but not month and day. http://apidock.com/rails/v3.2.1/ActionView/Helpers/DateHelper/date_select
<%= f.date_select :start_date, start_year: Date.today.year, class: 'form-control'%>
Upvotes: 0