I am using the bootstrap date picker to enable selection of dates in a form using simple_form_for. For example
<%= f.input :payment_date, as: :string, input_html: { class: "datepicker" } %>
My date picker uses the format of dd-mm-yyyy
I would like to set today's date as the default value in the form using simple_form_for, any ideas on how I can do that?
<%= f.input :payment_date, as: :string, input_html: { class: "datepicker", value: Time.now.strftime('%d-%m-%Y') } %>
Another format to it is: (working with active admin gem)
f.input :date, as: :date_picker, :input_html => { :value => Date.today}
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