I am using datepicker
of jqueryUI
to choose the date in a calendar, the problem is, if I choose 04/12/2017
it is saved in the 12/04/2017
database.
datepicker:
$('#schedulingCalendar').datepicker({
dateFormat: 'dd/mm/yy',
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('d-m-yy', date);
return [ $.inArray(string, arrayDaysToshow) >= 0 ]
},
onSelect: function(){
$('#schedulingCalendar').removeClass('input-validation-error');
$('#messageSchedulingDate').hide();
$('#messageCheckDate').hide();
},
onClose: function(){
$("#panelCalendar").animate({'height': '100%'}, 150);
}
});
If I change the dateFormat
to yy/mm/dd
, it saves correctly in the database, remembering that this problem occurs only in production , in debug it works normal .
OBS: debugging the code until the moment of SaveChanges
(use repository) the date is correct ( 04/12/2017
) but when consolidating in the database this 12/04/2017
EDIT
another curious thing, I am using ToString("d MMM yyyy")
to display the date after saving, so debug displays for example 4 dez 2017
and the server thus displays 4 Dec 2017