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()
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
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()
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
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
def is_past(self): date = datetime.datetime.now() start = datetime.datetime.combine(date.date(), datetime.time.min) return self.start < start
def is_today(self): date = datetime.datetime.now() start = datetime.datetime.combine(date.date(), datetime.time.min) return self.start == start