2
It happens like this: Mum field date, when it is empty, it brings the datepicker correctly and fills the field in the database format aaaa-mm-dd
and saved in this format.
When I edit, when placing the cursor in this field, it brings a different calendar with another date. For example, if I choose 06/03/2017, it saves 2017-03-06 and when I edit it shows a 1911 calendar. Where am I missing? Follow the code:
<script type="text/javascript">
$(function() {
$(".datepicker").datepicker({
format: "dd/mm/yyyy",
language: "pt-BR"
});
});
...
<td> <%= f.text_field :data_vencimento_real, class: 'datepicker' %></td>
I have the same problem using datepicker in Django, the problem is in Javascript and not in Rails
– Leila
The problem is not the saving but the loading of the database, where you must convert the date to the due format before sending to view.
– iamdlm