1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 07:52:23 +00:00

Merge branch 'bug_31_july' into 'beta'

bug du jour 31 juillet (bissextile)

See merge request bde/nk20!254
This commit is contained in:
korenstin 2024-08-08 16:23:21 +02:00
commit 951ba74f8f

View File

@ -295,7 +295,14 @@ class Club(models.Model):
today = datetime.date.today()
while (today - self.membership_start).days >= 365:
# Avoid any problems on February 29
if self.membership_start.month == 2 and self.membership_start.day == 29:
self.membership_start -= datetime.timedelta(days=1)
if self.membership_end.month == 2 and self.membership_end.day == 29:
self.membership_end += datetime.timedelta(days=1)
while today >= datetime.date(self.membership_start.year + 1,
self.membership_start.month, self.membership_start.day):
if self.membership_start:
self.membership_start = datetime.date(self.membership_start.year + 1,
self.membership_start.month, self.membership_start.day)