你好,我想看看两个日期是否在的其他两个日期之间
这是我试过的,但似乎不起作用
checkSameDates = (selectedDate, removedDates) => {
return (
new Date(removedDates.startDate) >= new Date(selectedDate.startDate) &&
new Date(selectedDate.endDate) <= new Date(removedDates.endDate)
);
};
selectedDate is 15/6/2021 to 17/6/2021
removedDates is 15/6/2021 to 15/6/2021
有什么问题吗?
检查此链接。
function formatDates(strDate) {
var parts = strDate.split('/');
var retVal = new Date(parseInt(parts[2]), parseInt(parts[1] - 1), parseInt(parts[0]));
console.log(retVal.toLocaleString());
return retVal;
}