📜  新日期 javascript 无效日期 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:43.895000             🧑  作者: Mango

代码示例1
if (Object.prototype.toString.call(d) === "[object Date]") {
  // it is a date
  if (isNaN(d.getTime())) {  // d.valueOf() could also work
    // date is not valid
  } else {
    // date is valid
  }
} else {
  // not a date
}