weihnachten hinzugefügt

This commit is contained in:
Christian Pütter 2020-06-03 19:44:18 +02:00
parent 64afd24a90
commit 680066dfa9
1 changed files with 19 additions and 1 deletions

View File

@ -52,5 +52,23 @@ class Holidays(callbacks.Plugin):
else:
irc.reply(f'Es sind noch {days_remaining} Tage bis Ostersonntag.')
ostern = wrap(ostern)
@internationalizeDocstring
def weihnachten(self, irc, msg, args):
"""
Returns the number of days until christmas
"""
# Determine left days in this year
christmas_current_year = date(date.today().year, 12, 25)
days_remaining = (christmas_current_year - date.today()).days
# If it has already passed, determine date for next year
if days_remaining < 0:
christmas_next_year = date(date.today().year+1, 12, 25)
days_remaining = (christmas_next_year - date.today()).days
if days_remaining == 0:
irc.reply('Heute ist der 1. Weichnachtstag.')
else:
irc.reply(f'Es sind noch {days_remaining} Tage bis zum 1. Weihnachtstag.')
weihnachten = wrap(weihnachten)
Class = Holidays