Сравните две даты с помощью JavaScript
Сравните <
и >
как обычно, но date-of-birth все, что связано с =
, должно javascript-library использовать префикс +
. Вот datetime-functions так:
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
javascript
date
datetime
compare
2021-12-14T06:00:03+00:00
2022-11-20T07:44:25+00:00
Ablenichev
Вопросы с похожей тематикой, как у вопроса:
Сравните две даты с помощью JavaScript
Предупреждение о файлах Cookies
Мы используем файлы cookies для улучшения работы сайта. Оставаясь на нашем сайте, вы соглашаетесь с условиями использования файлов cookies. Чтобы ознакомиться с нашими Положениями о конфиденциальности и об использовании файлов cookie, нажмите здесь.