From 6d5aae47896c0094713432b30a40a0c6a2cbfb21 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 20 Sep 2026 01:53:29 +0000 Subject: [PATCH] fix(datastore): serialize native bucket datetimes Git-Session-Id: ec77 --- aw_datastore/storages/peewee.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aw_datastore/storages/peewee.py b/aw_datastore/storages/peewee.py index 3a1fe5a..1223ef4 100644 --- a/aw_datastore/storages/peewee.py +++ b/aw_datastore/storages/peewee.py @@ -121,11 +121,12 @@ class BucketModel(BaseModel): datastr = CharField(null=True) # JSON-encoded object def json(self): + created = self.created + if isinstance(created, str): + created = iso8601.parse_date(created) return { "id": self.id, - "created": iso8601.parse_date(self.created) - .astimezone(timezone.utc) - .isoformat(), + "created": created.astimezone(timezone.utc).isoformat(), "name": self.name, "type": self.type, "client": self.client,