When fetched, date is shows as one day behind. The DB has correct data stored [closed]

I have a node.js and MySQL project. the user inputs the date from a dropdown and submits the form. In the backend, i see proper date but when i fetch it, its 1 day behind. Ive read that it might be a UTC problem but i dont understand how to fix it
I have some custom js for this to avoid userinput

html:

            <label for="dob" class="form-label">Date of Birth</label>
            <input type="date" class="form-control" id="dob" name="dob" required value="{{formData.dob}}">
            <div class="invalid-feedback">Please enter your date of birth.</div>
          </div>

and the js:

  //set limit
  const dateInput = document.getElementById("dob");
  const maxDate = new Date().setFullYear(new Date().getFullYear() - 18);
  dateInput.setAttribute("max", new Date(maxDate).toISOString().split('T')[0]);

  dateInput.addEventListener("keydown", function(event) {
    event.preventDefault(); // Prevent typing
  });
  dateInput.addEventListener("input", function(event) {
    event.preventDefault(); // Prevent input
  });