/**
* 获取当前月之前n个月
* @param { Number } n
* @return { Array }
*/
export const getLastEndMonth = (n) => {
const oDate = new Date();
const oFullyear = oDate.getFullYear();
const oMonth = oDate.getMonth()+1;
// 当前年
if(n <= oMonth) {
return [`${oFullyear}-${oMonth-n+1}`,`${oFullyear}-${oMonth}`]
}
// 跨年
let aMonth = n - oMonth
let aFullyear = oFullyear - Math.ceil(aMonth/12)
let resMonth = 12 - aMonth%12+1
return [`${aFullyear}-${resMonth}`,`${oFullyear}-${oMonth}`];
}