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

Adjusted predefined ranges to consider timezone

This commit is contained in:
Krateng 2020-12-01 19:19:01 +01:00
parent 951f6bb562
commit e6535eb6bc

View File

@ -383,18 +383,18 @@ y = MTime(2020)
def today(): def today():
tod = datetime.datetime.utcnow() tod = datetime.datetime.now(tz=TIMEZONE)
return MTime(tod.year,tod.month,tod.day) return MTime(tod.year,tod.month,tod.day)
def thisweek(): def thisweek():
tod = datetime.datetime.utcnow() tod = datetime.datetime.now(tz=TIMEZONE)
tod = datetime.date(tod.year,tod.month,tod.day) tod = datetime.date(tod.year,tod.month,tod.day)
y,w,_ = tod.chrcalendar() y,w,_ = tod.chrcalendar()
return MTimeWeek(y,w) return MTimeWeek(y,w)
def thismonth(): def thismonth():
tod = datetime.datetime.utcnow() tod = datetime.datetime.now(tz=TIMEZONE)
return MTime(tod.year,tod.month) return MTime(tod.year,tod.month)
def thisyear(): def thisyear():
tod = datetime.datetime.utcnow() tod = datetime.datetime.now(tz=TIMEZONE)
return MTime(tod.year) return MTime(tod.year)
def alltime(): def alltime():
return MRange(None,None) return MRange(None,None)