It happens like this: Mum field date, when it is empty, it brings the datepicker correctly and fills the field in the format of yyyy-mm-dd bank and saved in that format. When I edit, when placing the cursor in this field, it brings a different calendar with another date. For example, if I choose 3/6/2017, it saves 2017-03-06 and when I edit it it shows a calendar of 1911. Where am I going wrong? Here is the code:
$(function() {
$(".datepicker").datepicker({
format: "dd/mm/yyyy",
language: "pt-BR"
});
});
...
<% = f.text_field: real_data_day, class: 'datepicker'% >