IE11's Date.parse function "succeeds" on a large number of invalid dates.

Without using a third-party library, what is the proper way to validate whether a string in the format YYYY/MM/DD contains an actual "legal" date (e.g. "2020/02/29" succeeds, but "2019/02/29" fails, etc) in javascript?

Examples from IE11 console:

new Date(Date.parse('2020/05/99')     // Fri Aug 07 2020
new Date(Date.parse('2020/05/100')    // Sat Aug 08 20202
new Date(Date.parse('2020/05/1000')   // Wed Jan 25 2023
new Date(Date.parse('2020/69/800000') // Fri Dec 29 4215
new Date(Date.parse('2020/69/1000')   // Sat May 27 2028
new Date(Date.parse('2020/70/1000')   // Invalid Date

You could write something like this:

function parseDate(dateString) {
  var dateParts = dateString.split("/"),
      years = dateParts[0],
      months = dateParts[1],
      days = dateParts[2]
  
  // sanity check date parts
  if (days > 31) return "Invalid Date - Days"
  if (months > 12) return "Invalid Date - Months"
  
  var myDate = new Date(years, months, days)
  
  return myDate
}

Demo in Stack Snippets

<!-- begin snippet: js hide: true console: true babel: false --> <!-- language: lang-js -->
function parseDate(dateString) {
  var dateParts = dateString.split("/"),
      years = dateParts[0],
      months = dateParts[1],
      days = dateParts[2]
  
  // sanity check date parts
  if (days > 31) return "Invalid Date - Days"
  if (months > 12) return "Invalid Date - Months"
  
  var myDate = new Date(years, months, days)
  
  return myDate
}

console.log('2020/05/15: ', parseDate('2020/05/15'))
console.log('2020/05/99: ', parseDate('2020/05/99'))
console.log('2020/05/100: ', parseDate('2020/05/100'))
console.log('2020/70/1000: ', parseDate('2020/70/1000'))
<!-- end snippet -->