How do you parse a date from an HTML5 date input?

It's interpreting the date as UTC, which, for most time zones, will make it seem like "yesterday". One solution could be to add the time-zone offset back into the date to "convert" it to your local timezone.


var newDate = new Date(dateInput.value + 'T00:00');

This will give the correct date in any timezone.


If it's an actual date input on a supporting browser, then it will have a valueAsDate property. There's no need to parse it.