Check if two dates are on the same day (ignores time components).
检查两个日期是否在同一天(忽略时间部分)。
The first date to compare. 第一个要比较的日期
Optional
The second date to compare. 第二个要比较的日期
True if both dates are on the same day, false otherwise. 如果两个日期在同一天则返回 true,否则返回 false
isSameDay(new Date('2024-01-15'), new Date('2024-01-15T12:00:00')) // => trueisSameDay(new Date('2024-01-15'), new Date('2024-01-16')) // => falseisSameDay(new Date('2024-01-15'), '2024-01-15') // => true Copy
isSameDay(new Date('2024-01-15'), new Date('2024-01-15T12:00:00')) // => trueisSameDay(new Date('2024-01-15'), new Date('2024-01-16')) // => falseisSameDay(new Date('2024-01-15'), '2024-01-15') // => true
Check if two dates are on the same day (ignores time components).
检查两个日期是否在同一天(忽略时间部分)。