Library to convert Korean lunar-calendar to Gregorian calendar.
Korean calendar and Chinese calendar is same lunar calendar but have different date. This follow the KARI(Korea Astronomy and Space Science Institute) νκ΅ μμλ ₯ λ³ν (νκ΅μ²λ¬Έμ°κ΅¬μ κΈ°μ€) - λ€νΈμν¬ μ°κ²° λΆνμ
μλ ₯ μ§μ λ²μ (1000λ
01μ 01μΌ ~ 2050λ
11μ 18μΌ)
Korean Lunar Calendar (1000-01-01 ~ 2050-11-18)
μλ ₯ μ§μ λ²μ (1000λ
02μ 13μΌ ~ 2050λ
12μ 31μΌ)
Gregorian Calendar (1000-02-13 ~ 2050-12-31)
pip install korean_lunar_calendar
from korean_lunar_calendar import KoreanLunarCalendar
Korean Solar Date -> Korean Lunar Date (μλ ₯ -> μλ ₯)
calendar = KoreanLunarCalendar()
# params : year(λ
), month(μ), day(μΌ)
calendar.setSolarDate(2017, 6, 24)
# Lunar Date (ISO Format)
print(calendar.LunarIsoFormat())
# Korean GapJa String
print(calendar.getGapJaString())
# Chinese GapJa String
print(calendar.getChineseGapJaString())
[Result]
2017-05-01 Intercalation
μ μ λ
λ³μ€μ μμ€μΌ (μ€μ)
δΈι
εΉ΄ δΈεζ 壬εζ₯ (ιζ)
Korean Lunar Date -> Korean Solar Date (μλ ₯ -> μλ ₯)
calendar = KoreanLunarCalendar()
# params : year(λ
), month(μ), day(μΌ), intercalation(μ€λ¬μ¬λΆ)
calendar.setLunarDate(1956, 1, 21, False)
# Solar Date (ISO Format)
print(calendar.SolarIsoFormat())
# Korean GapJa String
print(calendar.getGapJaString())
# Chinese GapJa String
print(calendar.getChineseGapJaString())
[Result]
1956-03-03
λ³μ λ
κ²½μΈμ κΈ°μ¬μΌ
δΈη³εΉ΄ εΊε―
ζ ε·±ε·³ζ₯
Check for invalid date input
calendar = KoreanLunarCalendar()
# invald date
calendar.setLunarDate(99, 1, 1, False) # => return False
calendar.setSolarDate(2051, 1, 1) # => return False
# OK
calendar.setLunarDate(1000, 1, 1, False) # => return True
calendar.setSolarDate(2050, 12, 31) # => return True