In your changeDate function you need to add the formatted date in the input the update function doesn't set the input value
changeDate
// Set the formatted date to the input field $("#date-input").val(formattedDate);
This will solve your issue