安装插件
pnpm add chinese-lunar-calendar
引入阳历/阴历切换函数
import {getLunar} from 'chinese-lunar-calendar'export function lunarDate(pDate){const year = pDate.getFullYear()const month = pDate.getMonth() +1const day = pDate.getDate()const result = getLunar(year,month,day)return result.dateStr
}
调用方法
const date = new Date()
const result = lunarDate(date)//十月廿十