const isMoreThanSixDaysApart = (days: any ,date1: any, date2: any) => {
const oneDay = 24 * 60 * 60 * 1000; // 每天的毫秒数
const halfYearInMs = days * oneDay; // days的毫秒数
const diff = Math.abs(new Date(date2).getTime() - new Date(date1).getTime()); // 计算两个日期的时间差(毫秒)
return diff > halfYearInMs; // 返回结果
};
判断两个日期是否超过多少天
最新推荐文章于 2024-11-17 22:31:08 发布