From 06c32e205e95df8d3d1e27876887b7da7aa2bdf4 Mon Sep 17 00:00:00 2001 From: Krateng Date: Fri, 15 Jan 2021 20:09:34 +0100 Subject: [PATCH] This time for real tho --- maloja/__pkginfo__.py | 2 +- maloja/malojatime.py | 5 ++++- maloja/monkey.py | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 6123e25..d7535d8 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@krateng.dev", "github": "krateng" } -version = 2,12,3 +version = 2,12,4 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", diff --git a/maloja/malojatime.py b/maloja/malojatime.py index 78eb801..574f227 100644 --- a/maloja/malojatime.py +++ b/maloja/malojatime.py @@ -205,9 +205,12 @@ class MTime(MRangeDescriptor): class MTimeWeek(MRangeDescriptor): def __init__(self,year=None,week=None): + # do this so we can construct the week with overflow (eg 2020/-3) thisisoyear_firstday = datetime.date.fromchrcalendar(year,1,1) self.firstday = thisisoyear_firstday + datetime.timedelta(days=7*(week-1)) - # do this so we can construct the week with overflow (eg 2020/-3) + self.firstday = datetime.date(self.firstday.year,self.firstday.month,self.firstday.day) + # for compatibility with pre python3.8 (https://bugs.python.org/issue32417) + self.lastday = self.firstday + datetime.timedelta(days=6) diff --git a/maloja/monkey.py b/maloja/monkey.py index 0e02757..cfd8529 100644 --- a/maloja/monkey.py +++ b/maloja/monkey.py @@ -50,7 +50,6 @@ class expandeddate(date): @classmethod def fromchrcalendar(cls,y,w,d): try: - assert 1==2 return datetime.date.fromisocalendar(y,w,d) - timedelta(days=1) #sunday instead of monday except: # pre python3.8 compatibility