From 1bb4c8402bad92abe0d0b4a27a8f98ca73183c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20=22NeK=22=20Moisy-Mabille?= Date: Mon, 3 Feb 2014 16:43:12 +0100 Subject: [PATCH] =?UTF-8?q?On=20a=20le=20droit=20de=20na=C3=AEtre=20le=202?= =?UTF-8?q?9=20f=C3=A9vrier=20#c=C3=A9ciliasrequest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wiki/macro/BirthDate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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