Example #1
0
 def __init__(self, events, date=datetime.date.today()):
     self.events=events
     if isinstance(date, datetime.datetime):
         date = date.date()
     self.start = datetime.datetime.combine(date, datetime.time.min)
     self.end = self.start + datetime.timedelta(days=1)
     self.occurrences = self._get_sorted_occurrences()
Example #2
0
 def _get_day_range(self, date):
     if isinstance(date, datetime.datetime):
         date = date.date()
     start = datetime.datetime.combine(date, datetime.time.min)
     start = pytz.utc.localize(start) #convert it to tz aware
     end = start + datetime.timedelta(days=1)
     return start, end
Example #3
0
 def __init__(self, events, date=datetime.date.today()):
     self.events = events
     if isinstance(date, datetime.datetime):
         date = date.date()
     self.start = datetime.datetime.combine(date, datetime.time.min)
     self.end = self.start + datetime.timedelta(days=1)
     self.occurrences = self._get_sorted_occurrences()
Example #4
0
 def _get_day_range(self, date):
     if isinstance(date, datetime.datetime):
         date = date.date()
     start = datetime.datetime.combine(
         date, datetime.time.min).replace(tzinfo=self.tzinfo)
     end = start + datetime.timedelta(days=1)
     return start, end
Example #5
0
 def _get_day_range(self, date):
     if isinstance(date, datetime.datetime):
         date = date.date()
     start = datetime.datetime.combine(date, datetime.time.min)
     end = start + datetime.timedelta(days=1)
     return start, end
 def is_past(self):
     date = datetime.datetime.now()
     start = datetime.datetime.combine(date.date(), datetime.time.min)
     return self.utc_start < start
Example #7
0
 def is_past(self):
     date = datetime.datetime.now()
     start = datetime.datetime.combine(date.date(), datetime.time.min)
     return self.start < start
Example #8
0
 def is_today(self):
     date = datetime.datetime.now()
     start = datetime.datetime.combine(date.date(), datetime.time.min)
     return self.start == start