diff --git a/wiki/macro/BirthDate.py b/wiki/macro/BirthDate.py index 1fb56165..68be5156 100644 --- a/wiki/macro/BirthDate.py +++ b/wiki/macro/BirthDate.py @@ -14,7 +14,13 @@ def execute(macro, text): year, month, day = text.split(",") y, m, d = int(year), int(month), int(day) now = datetime.datetime(*time.localtime()[:6]) - birthdate = datetime.datetime(now.year, m, d) + birthdate = now + if m==2 and d==29: + birthdate = datetime.datetime(now.year, 3, 01) + if now.month==2 and now.day==29: + now = datetime.datetime(now.year, 3, 01) + else: + birthdate = datetime.datetime(now.year, m, d) age = now.year - y if now < birthdate: age -= 1