import moment from 'moment' // 获取当前年月 export const getCurrentYearMonth = () => { return moment(new Date()).format("YYYY-MM") } // 获取当前月份 export const getCurrentMonth = () => { return (new Date()).getMonth() + 1 } // 获取前几个月的年月 export const getSubtractMonthYearMonth = (subtract = 1) => { return moment(new Date()).subtract(subtract,'months').startOf('month').format('YYYY-MM') } // 获取后几个月的年月 export const getAddMonthYearMonth = (add = 1) => { return moment(new Date()).add(add,'months').startOf('month').format('YYYY-MM') }