I have this code with Jquery to show two datepicker and when I click on it it shows me the date fine, but when showing it in the input it shows it in "mdy" format
<div class="col-sm">
<input id="dp_start" width="276" />
</div>
<div class="col-sm">
<input id="dp_end" width="276" />
</div>
<script type="text/javascript">
$('#dp_start').datepicker({
uiLibrary: 'bootstrap4',
language: 'es',
locale: 'es-es',
dateFormat: 'dd/mm/yy',
startDate: '-3d',
onSelect: function(dateText, inst) {
alert(dateText);
},
onChange: function(dateText, inst) {
alert(dateText);
}
});
$('#dp_end').datepicker({
uiLibrary: 'bootstrap4',
language: 'es',
locale: 'es-es',
dateFormat: 'dd/mm/yy',
changeDate: function(dateText, inst) {
alert(dateText);
}
});
);
</script>
I show you some images of the behavior.
Step 1- Click on the datepicker
Step 2 - Once I have clicked on a date in the datepicker
As I explained, I try to select January 4, 2020 and it ends up putting me on April 1, 2020.
Try changing dateFormat to format
In bootstrap4's DatePicker the format attribute is used since formatDate is deprecated in this version.
Greetings.