Exemple #1
0
 def _update_internal_state(self, time_date):
     date = dt_util.as_local(time_date).date()
     calendar = KoreanLunarCalendar()
     calendar.setSolarDate(date.year, date.month, date.day)
     lunar_date = calendar.LunarIsoFormat()
     self._state = lunar_date
     self._attribute = {
         'korean_gapja': calendar.getGapJaString(),
         'chinese_gapja': calendar.getChineseGapJaString()
     }
Exemple #2
0
def printInformation(year, is_intercalation=False):
    today = datetime.today()
    year = today.year
    month = today.month
    day = today.day
    calendar = KoreanLunarCalendar()
    calendar.setSolarDate(year, month, day)

    print('Year: {}'.format(year))

    # 할머니: (음) 5/23
    calendar.setLunarDate(year, 5, 23, is_intercalation)
    print('할머니 제사 (음) 5/23')
    print('* Solar: {}'.format(calendar.SolarIsoFormat()))
    print('* Lunar: {}'.format(calendar.LunarIsoFormat()))
    print('* Hangul: {}'.format(calendar.getGapJaString()))
    print('* Hanja: {}'.format(calendar.getChineseGapJaString()))

    calendar.setLunarDate(year, 5, 1, is_intercalation)
    print('초하루 (음) 5/1')
    print('* Solar: {}'.format(calendar.SolarIsoFormat()))
    print('* Lunar: {}'.format(calendar.LunarIsoFormat()))
    print('* Hangul: {}'.format(calendar.getGapJaString()))
    print('* Hanja: {}'.format(calendar.getChineseGapJaString()))

    print('------------------------------')

    # 할아버지: (음) 8/6
    calendar.setLunarDate(year, 8, 6, is_intercalation)
    print('할아버지 제사 (음) 8/6')
    print('* Solar: {}'.format(calendar.SolarIsoFormat()))
    print('* Lunar: {}'.format(calendar.LunarIsoFormat()))
    print('* Hangul: {}'.format(calendar.getGapJaString()))
    print('* Hanja: {}'.format(calendar.getChineseGapJaString()))

    print('초하루 (음) 8/1')
    calendar.setLunarDate(year, 8, 1, is_intercalation)
    print('* Solar: {}'.format(calendar.SolarIsoFormat()))
    print('* Lunar: {}'.format(calendar.LunarIsoFormat()))
    print('* Hangul: {}'.format(calendar.getGapJaString()))
    print('* Hanja: {}'.format(calendar.getChineseGapJaString()))