moment.js

const yes = moment().subtract(3, 'days').startOf('day');
const no = moment().subtract(1, 'days').endOf('day');

最後面沒加 .format() 的話,出來的是物件,想要有字串或時間,要加上

.format('x');
// 1588435200000
// 顯示豪秒數
.format();
// 2020-05-05T23:59:59+08:00
// 顯示格式化後的時間