korean/py-korean-lunar-calendar: New port: Korean Lunar Calendar

This commit is contained in:
Yuri Victorovich 2022-12-25 14:12:18 -08:00
parent 8585a47067
commit bb8b0fac84
5 changed files with 67 additions and 0 deletions

View File

@ -41,6 +41,7 @@
SUBDIR += nhpf
SUBDIR += p5-Lingua-KO-Hangul-Util
SUBDIR += p5-Lingua-KO-Romanize-Hangul
SUBDIR += py-korean-lunar-calendar
SUBDIR += scim-hangul
SUBDIR += scim-tables
SUBDIR += sourcehansans-otf

View File

@ -0,0 +1,25 @@
PORTNAME= korean-lunar-calendar
DISTVERSION= 0.3.1
CATEGORIES= korean python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DISTNAME= ${PORTNAME:S/-/_/g}-${PORTVERSION}
MAINTAINER= yuri@FreeBSD.org
COMMENT= Korean Lunar Calendar
WWW= https://github.com/usingsky/korean_lunar_calendar_py
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= python:3.6+
USE_PYTHON= distutils autoplist pytest
NO_ARCH= yes
TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
do-test:
@${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test.py
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1672005953
SHA256 (korean_lunar_calendar-0.3.1.tar.gz) = eb2c485124a061016926bdea6d89efdf9b9fdbf16db55895b6cf1e5bec17b857
SIZE (korean_lunar_calendar-0.3.1.tar.gz) = 9877

View File

@ -0,0 +1,31 @@
from korean_lunar_calendar import KoreanLunarCalendar
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())
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())
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

View File

@ -0,0 +1,7 @@
korean-lunar-calendar is a library to convert Korean lunar-calendar to Gregorian
calendar.
Korean calendar and Chinese calendar is same lunar calendar but they have
different dates.
This package follows the KARI (Korea Astronomy and Space Science Institute).