Allow passing `start` and `end ` as `datetime.datetime`, not `str` only
@@ -108,10 +108,9 @@ class ReservationEventModel(Base):
end=self.end))
def _parse_client_time_format(self):
+ if isinstance(self.start, str) and isinstance(self.start, str):
client_datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ'
-
- def parsed_datetime(t): return datetime.datetime.strptime(
- t, client_datetime_format)
+ parsed_datetime = lambda t: datetime.datetime.strptime(t, client_datetime_format)
try:
self.start = parsed_datetime(self.start)
self.end = parsed_datetime(self.end)
