Skip to content

Commit d3013d6

Browse files
committed
core (fix): isoformat issue fix
1 parent 9a60044 commit d3013d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/practable/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def check_slot_available(self, slot):
159159
available_now = False
160160
when = []
161161
else:
162-
start = datetime.fromisoformat(avail[0]["start"])
163-
end = datetime.fromisoformat(avail[0]["end"])
162+
start = datetime.strptime(avail[0]["start"], "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
163+
end = datetime.strptime(avail[0]["end"], "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
164164
when = {"start": start, "end": end}
165165
available_now = when["start"] <= (datetime.now(timezone.utc) +
166166
timedelta(seconds=1))
@@ -296,8 +296,8 @@ def get_bookings(self):
296296
self.bookings = []
297297

298298
for booking in bookings:
299-
start = datetime.fromisoformat(booking["when"]["start"])
300-
end = datetime.fromisoformat(booking["when"]["end"])
299+
start = datetime.strptime(booking["when"]["start"], "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
300+
end = datetime.strptime(booking["when"]["end"], "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
301301

302302
if now >= start and now <= end:
303303
self.bookings.append(booking)

0 commit comments

Comments
 (0)