calendar

TIP

日历日期转换

solar2lunar(year, month, day)

公历转农历

参数类型作用备注
yearnumber公历年
monthnumber公历月
daynumber公历日

例:

 const lunar = api.calendar.solar2lunar(2021, 12, 20)
//[ 2021, 11, 17, false ]
//农历日期2021年11月17日,不是闰年


lunar2solar(year, month, day)

农历转公历

参数类型作用备注
yearnumber农历年
monthnumber农历月
daynumber农历日

例:

 const solar = api.calendar.lunar2solar(2021, 12, 20)
// [ 2022, 1, 22 ]

convertLunarMonth(month)

数字转农历月份写法

参数类型作用备注
monthnumber数字的月份

例:

 const month = api.calendar.convertLunarMonth(7)
//兰月

convertLunarDay(day)

数字转农历天数写法

参数类型作用备注
daynumber数字的天

例:

 const day = api.calendar.convertLunarDay(26)
//廿六