How to set date to input type=date code example Example: set date input html using js document.getElementById("datePicker").valueAsDate = new Date()