ruby on rails - Bootstrap datepicker default value simple_form_for -


i using bootstrap date picker enable selection of dates in form using simple_form_for. example

  <%= f.input :payment_date, as: :string, input_html: { class: "datepicker" } %> 

my date picker uses format of dd-mm-yyyy

i set today's date default value in form using simple_form_for, ideas on how can that?

<%= f.input :payment_date, as: :string, input_html: { class: "datepicker", value: time.now.strftime('%d-%m-%y') } %>    

another format is: (working active admin gem)

f.input :date, as: :date_picker, :input_html => { :value => date.today} 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -