无法在 moment js 中找到差异

Unable to find difference in moment js

谁能解释一下下面两种说法的区别?我尝试打印这两个语句的格式,结果相同。我很困惑:(

时刻(“2021-04-01T23:59:59”).endOf('day') .diff(时刻("2021-03-17T23:59:59").endOf('month'), 'days'); // 返回 1

时刻(“2021-04-01T23:59:59”) .diff(moment("2021-03-17T23:59:59").endOf('month'), 'days') // 返回 0

当您使用时:

start_1 = moment("2021-04-01T23:59:59").endOf('day')
console.log(start_1.millisecond()) // 999

start_2 = moment("2021-04-01T23:59:59")
console.log(start_2.millisecond()) // 000

end = moment("2021-03-17T23:59:59").endOf('month')

console.log(start_1.diff(end, 'days')) // 1
console.log(start_1.diff(end, 'millisecond')) // 86400000 = 24 * 60 * 60 * 1000

console.log(start_2.diff(end, 'days')) // 0
console.log(start_2.diff(end, 'hours')) // 23
console.log(start_2.diff(end, 'millisecond')) // 86399001