I'm trying to add a date field to my form.

I added bootstrap-datepicker-rails gem, all required css and javascript.

When I choose the date in the calendar and click Save, it's not updated in the database.

Here's the code of the form:

= simple_form_for @model
  = f.input :date_last, :required => true, 
            :input_html => { data: {behaviour: "datepicker"}}, 
            :as => :string
  = f.button :submit, 'Save', :class => 'btn btn-primary'

I think this might have to do with formats, but not sure where to look at.

Update

It works when I change default format to yyyy-mm-dd (default is mm/dd/yyyy):

$('[data-behaviour~=datepicker]').datepicker({"format": "yyyy-mm-dd", "weekStart": 1, "autoclose": true});
Edit
Report