This time for real tho

This commit is contained in:
Krateng 2021-01-15 20:09:34 +01:00
parent 2a5d9498d1
commit 06c32e205e
3 changed files with 5 additions and 3 deletions

View File

@ -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",

View File

@ -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)

View File

@ -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