知道字符串,如果根据该字符串,计算该字符串对应的下一个月的时间
字符串 2021年3月
const replaceMonth = (str) => {
const [year, month] = str.match(/\d+/g);
if (Number(month) === 12) {
return `${Number(year) + 1}年1月`;
} else {
return `${year}年${Number(month) + 1}月`;
}
}