I'm using jQuery Datepicker gem and when I'm editing a record that has a date it it behaves unexpectedly.
When I create a new record the date is entered with the mm/dd/yy format. When I go to edit the record the date is being populated in the date field in the format yyyy-dd-mm and I have no idea why. Perhaps this is something to do with Rails itself?
The Date column in the table is set to Date, which I would imagine is fine. Is there something that I need to do in my view when displaying the date or something in the controller?
This is what is in my application.js file:
$(document).on('page:change', function () {
$('#cust_dob').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "mm/dd/yy",
yearRange: "1900:+0"
});
});
Any help would be much appreciated.