I have a website where I am implementing datepickers, the site is for uploading school tasks, then I have a datepicker for the date on which it was commissioned (homeWorkDate) and another for the date that it should be delivered (reviewDate). The detail is more noticeable when you want to edit a task, at the time of loading the dates it always takes as reference today and not its date (baseDate).
I have tried with defaultDate and setDate
function setCalendarsDate(baseDate, homeWorkDate, reviewDate) {
$("#fmt_d")
.datepicker({
defaultDate: baseDate,
maxDate: homeWorkDate
})
.datepicker("setDate", homeWorkDate)
$("#fmt_e")
.datepicker({
defaultDate: baseDate,
minDate: reviewDate
})
.datepicker("setDate", reviewDate)
}