How to check the (empty) value of a input type="date" in Chrome

I would do this

var valueDate = document.getElementById('Date').value;

if (!valueDate) {
  alert('date is invalid');
}else{alert('date is valid')}

I would try using Date.parse() if I were you.

var valueDate = document.getElementById('Date').value;

if(!Date.parse(valueDate)){
  alert('date is invalid');
}

http://www.w3schools.com/jsref/jsref_parse.asp


You could check for a falsy value:

if (!valueDate) {
    // ...
}

The falsy values in JavaScript are:

  1. undefined
  2. null
  3. false
  4. ""
  5. 0 and -0
  6. 0n
  7. NaN

Since document.getElementById('Date').value is always of type string if a value is set, you don't get false positives like 0 being treated like no input, which would be the case if the type was number.