date_select method can only set :start_year, but i'd like to set start date (e.g. date 3 months ago) (but there are no such options).
so, can i set start date to date_select method? or, to make such the select box, should i use select_tag and options_for_select? or, are there any solutions?
thanks,
It is possible... e.g.
:start_year – Set the start year for the year select. Default is Time.now.year - 5
see this resource.
The date_select
helper only supports setting a start_year
and end_year
(i.e. 2015-2020), not a start_date
and end_date
(i.e. June 1st, 2015 to July 1st, 2020). The date_select
helper is design to be very simple. If you look closely, you will even notice every month has 31 days.
A few workarounds are available:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With