<input type="time" />
Just found a bug which occurs with probability 1/60. Fixed code (MCVE):
function f() {
var input = document.querySelector("input[type=time]");
var time = input.value;
/* added this: */
if(time.length === "hh:mm".length) {
time += ":00";
}
doStuffWithTime(time);
}