I'm using jquery datepciker in a Rails app. I would like to have the date already filled in when the form page loads. So, that the user can leave the date as-is or change it.
I was hoping the datepicker options would let me do that.
I tried this:
$("#comment_status_date").datepicker({
dateFormat: 'yy-mm-dd',
setDate: Date.now
});
But, the date field was empty.
Do I have to do some ruby code in the model or controller? Does datepicker have an option to do this?
Thanks!!
I figured out a way:
<%= f.input :status_date, :as => :string, :label => 'Date', :class => 'calendar hasDatepicker', :input_html => { :value => Date.today.to_s } %>
Date.today,nowis forTime.now.