def when(self): if self.all_day: start = self.start.date() end = self.end.date() return Date(start) if start == end else DateSpan(start, end) else: start = self.start end = self.end return Time(start) if start == end else TimeSpan(start, end)
def when(self): if self.all_day: # Dates are stored as DateTimes so transform to dates here. start = arrow.get(self.start).to('utc').date() end = arrow.get(self.end).to('utc').date() return Date(start) if start == end else DateSpan(start, end) else: start = self.start end = self.end return Time(start) if start == end else TimeSpan(start, end)