From 23fb808d7060fabd44aba4cbbbe1cd82696adde0 Mon Sep 17 00:00:00 2001 From: Krateng Date: Tue, 11 Jun 2019 10:08:55 +0200 Subject: [PATCH] Fixed caching bug --- malojatime.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/malojatime.py b/malojatime.py index 9b03e70..d789b8c 100644 --- a/malojatime.py +++ b/malojatime.py @@ -66,6 +66,9 @@ class MRangeDescriptor: def unlimited(self): return False + def active(self): + return (self.last_stamp() > datetime.datetime.utcnow().timestamp()) + # returns the description of the range including buttons to go back and forth #def desc_interactive(self,**kwargs): # if self.next(1) is None: @@ -99,7 +102,7 @@ class MTime(MRangeDescriptor): # whether we currently live or will ever again live in this range def active(self): - tod = datetime.date.today() + tod = datetime.datetime.utcnow().date() if tod.year > self.year: return False if self.precision == 1: return True if tod.year == self.year: @@ -235,13 +238,13 @@ class MTimeWeek(MRangeDescriptor): return str(self) # whether we currently live or will ever again live in this range - def active(self): - tod = datetime.date.today() - if tod.year > self.year: return False - if tod.year == self.year: - if tod.chrcalendar()[1] > self.week: return False - - return True +# def active(self): +# tod = datetime.date.today() +# if tod.year > self.year: return False +# if tod.year == self.year: +# if tod.chrcalendar()[1] > self.week: return False +# +# return True def urikeys(self): return {"in":str(self)}