In rails project I'm using best_in_place
datepicker and have some trouble with date format.
The html generated by best_in_place
:
<span class="best_in_place pull-right" id="best_in_place_task_5_deadline"
data-url="/projects/4/tasks/5" data-object="task" data-attribute="deadline"
data-type="date" data-original-content="2012-08-16">16 Aug</span>
As you can see from data-original-content
the date format is yy-mm-dd
, but when I choose the date I've got something like this 09/03/1916
I've tried to set the date format in application.js
:
$.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
But it didn't help.
It wasn't obvious for me, I had to look inside the code source
jQuery(function($){
$.extend($.fn.datepicker.defaults, { format: 'dd-mm-yy' });
});