1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Version bump

This commit is contained in:
Krateng 2021-01-15 18:45:42 +01:00
parent bcd62c16fa
commit 5006ad2bf1
2 changed files with 5 additions and 6 deletions

View File

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

View File

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