Bootstrap datepicker defaults to today instead of input value date

48 Views Asked by At

I'm using Bootstrap 4 datepicker and the calendar popup defaults to todays date instead of the date set in input field. I also have multiple date fields in this form all using datepicker so want it to open to the set input value automatically without having to set it for each field if thats possible?

(https://i.stack.imgur.com/wcZZq.png)

<input type="text" name="reg_date" class="form-control date-picker" value="07-05-2022">
<input type="text" name="next_due" class="form-control date-picker" value="20-02-2024">
<input type="text" name="next_inv" class="form-control date-picker" value="01-02-2024">
<input type="text" name="terminate" class="form-control date-picker" value="">


// date picker
$(".date-picker").datepicker({
    language: "en",
    autoClose: true,
    dateFormat: "dd-mm-yyyy",
});

However if no value set then open to todays date

Does anyone have a solution?

Tried googling & searching through here for answers but cant seem to find this specific issue (maybe i'm not describing it correctly?)

0

There are 0 best solutions below