Calendar
Calendar
Importing Modules
import calendar from '@system.calendar'
API Definitions
getLunar
Gets the lunar date information for a Date object and returns a lunar date description of type LunarDate.
getLunar
Gets the lunar information corresponding to the specified Gregorian year, month, and day, and returns a lunar date description of type LunarDate. The parameter meanings are as follows:
year: The full year number, for example,2024;month: The month number, starting from0, where December is ;day: The day number, starting from1.
Type Definitions
LunarDate
type LunarDate = {
month: string, // Lunar month name
day: string, // Lunar day name
festival?: string // Festival name, may be undefined
}
month: The name of the lunar month, for example,'正月','二月'.day: The name of the lunar day, for example,'初一','十五'.festival: The festival name; the property is undefined if there is no festival.
