📌  相关文章
📜  检查日期字符串是否小于或大于另一个日期字符串 - Javascript 代码示例

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

代码示例1
const x = new Date('2013-05-23');
const y = new Date('2013-05-23');

// less than, greater than is fine:
console.log('x < y', x < y); // false
console.log('x > y', x > y); // false
console.log('x === y', x === y); // false, oops!

// anything involving '=' should use the '+' prefix
// it will then compare the dates' millisecond values
console.log('+x <= +y', +x <= +y); // true
console.log('+x >= +y', +x >= +y); // true
console.log('+x === +y', +x === +y); // true