absfuyu.util.lunar module

Absfuyu: Lunar calendar

Convert to lunar calendar

Version: 5.1.0 Date updated: 10/03/2025 (dd/mm/yyyy)

Source:

Astronomical algorithms from the book “Astronomical Algorithms” by Jean Meeus, 1998 https://www.informatik.uni-leipzig.de/~duc/amlich/AL.py

class absfuyu.util.lunar.LunarCalendar(year: int, month: int, day: int, *, time_zone: int = 7, lunar_leap: bool = False)[source]

Bases: object

Lunar Calendar

to_lunar()[source]

Convert solar date to the corresponding lunar date.

Returns:

LunarCalendar instance

Return type:

LunarCalendar

to_solar()[source]

Convert a lunar date to the corresponding solar date.

Returns:

  • LunarCalendar – LunarCalendar instance

  • date – When unable to convert

convert_all() dict[source]

Convert to both lunar and solar

This method has no practical use

Return type:

dict

classmethod from_solar(year: int, month: int, day: int, lunar_leap: bool = False)[source]

Convert to lunar day from solar day

Parameters:
  • year (int) – Year (in range [1, 9999])

  • month (int) – Month (in range [1, 12])

  • day (int) – Day (in range [1, 31])

  • lunar_leap (bool) – Is leap (Default: False)

Returns:

LunarCalendar instance

Return type:

LunarCalendar

classmethod from_datetime(datetime_object: date | datetime)[source]

Convert from datetime.datetime object

Parameters:

datetime_object (date | datetime) – datetime.datetime object

Returns:

LunarCalendar instance

Return type:

LunarCalendar

classmethod now()[source]

Get lunar calendar for datetime.datetime.now()

Returns:

LunarCalendar instance

Return type:

LunarCalendar