From 5006ad2bf1a6d5132ed07d28a7f6f0a9a454d5a7 Mon Sep 17 00:00:00 2001 From: Krateng Date: Fri, 15 Jan 2021 18:45:42 +0100 Subject: [PATCH] Version bump --- maloja/__pkginfo__.py | 2 +- maloja/malojatime.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 7962796..98957c7 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@krateng.dev", "github": "krateng" } -version = 2,12,1 +version = 2,12,2 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", diff --git a/maloja/malojatime.py b/maloja/malojatime.py index d26acec..588cb8c 100644 --- a/maloja/malojatime.py +++ b/maloja/malojatime.py @@ -204,17 +204,16 @@ class MTime(MRangeDescriptor): # a range that is exactly one christian week (starting on sunday) class MTimeWeek(MRangeDescriptor): def __init__(self,year=None,week=None): - self.year = year - self.week = week - thisisoyear_firstday = datetime.date.fromisocalendar(year,1,1) - datetime.timedelta(days=1) + thisisoyear_firstday = datetime.date.fromisocalendar(year,1,1) - datetime.timedelta(days=1) #sunday instead of monday self.firstday = thisisoyear_firstday + datetime.timedelta(days=7*(week-1)) + # do this so we can construct the week with overflow (eg 2020/-3) self.lastday = self.firstday + datetime.timedelta(days=6) - # now check if we're still in the same year + # now get the actual year and week number (in case of overflow) y,w,_ = self.firstday.chrcalendar() - self.year,self.week = y,w + self.year,self.week,_ = self.firstday.chrcalendar()