document.getElementById("datePicker").valueAsDate = new Date()
<label for="start">Start date:</label>
<input type="date" id="start" name="trip-start"
value="2018-07-22"
min="2018-01-01" max="2018-12-31">
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear() + "-" + month + "-" + day;
// convert Javascript Date to HTML Input
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var hour = ("0" + (now.getHours())).slice(-2);
var min = ("0" + (now.getMinutes())).slice(-2);
var today = now.getFullYear() + "-" + month + "-" + day + "T" + hour + ":" + min;
<input type="date" >
document.getElementById("myDate").value = "2014-02-09";