Korean Lunar Calendar

0.3.1 · active · verified Thu Apr 09

This Python library provides functionalities to convert between the Gregorian (solar) calendar and the Korean lunisolar calendar, adhering to the standards of the Korea Astronomy and Space Science Institute (KASI). It supports a date range from 1000-01-01 to 2050-11-18 for lunar dates and 1000-02-13 to 2050-12-31 for solar dates. The current version is 0.3.1.

Warnings

Install

Imports

Quickstart

Initialize the calendar, then use `setSolarDate` or `setLunarDate` to perform conversions and retrieve results using `getLunarCalendar`, `getSolarCalendar`, `getKoreanGapja`, or `getChineseGapja`.

from korean_lunar_calendar import KoreanLunarCalendar

calendar = KoreanLunarCalendar()

# Convert Solar (Gregorian) to Lunar
calendar.setSolarDate(2017, 6, 24)
lunar_date = calendar.getLunarCalendar()
print(f"Solar 2017-06-24 is Lunar: {lunar_date['year']}-{lunar_date['month']}-{lunar_date['day']} (Intercalation: {lunar_date['intercalation']})")

korean_gapja = calendar.getKoreanGapja()
print(f"Korean GapJa: {korean_gapja['year']} {korean_gapja['month']} {korean_gapja['day']} (Intercalation: {korean_gapja['intercalation']})")

# Convert Lunar to Solar
calendar.setLunarDate(1956, 1, 21, False) # year, month, day, is_intercalary (윤달여부)
solar_date = calendar.getSolarCalendar()
print(f"Lunar 1956-01-21 (not intercalary) is Solar: {solar_date['year']}-{solar_date['month']}-{solar_date['day']}")

view raw JSON →