Reputation: 329
I am using the rails date_select to prompt users to pick year, month and day. However, I would like to only list prompt users to enter just year and month without showing the day field. I want the day to always be 20th of any month of any year. How do I do this?
Upvotes: 3
Views: 478
Reputation: 198324
date_select @foo, :date_of_foo, { discard_day: true }
will get rid of the date part; unfortunately it is incompatible with
date_select @foo, :date_of_foo, { default: { day: 20 } }
which would pre-set the (now omitted) day select to 20
; instead, the day is set to 1
, so you will have to adjust the day manually when you receive it (or hack the date_select
result to change the hidden field's value from 1
to 20
).
Upvotes: 1