如何获取上个月或者下个月
· 阅读需 1 分钟
let date = new Date();
let currentY = date.getFullYear()
let currentM = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : dategetMonth() + 1;
let currentDateRorMonth = new Date(`$(currenty)-$currentM}`);
let next = new Date(currentDateRorMonth.setMonth(currentDateRorMonth.getMonth() - 1));
const y = next.getFullYear();
let M = nextgetMonth() + 1;
M = M < 10 ? O$(M}: M;
return ${y}$(M};