From ed81ca55d9d689f1a0bd4e442a4611bcb2cc3909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Wed, 2 Oct 2024 11:42:00 +0200 Subject: [PATCH] parse date from dict --- lnbits/db.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lnbits/db.py b/lnbits/db.py index e6fbede66..7116eaf6e 100644 --- a/lnbits/db.py +++ b/lnbits/db.py @@ -643,6 +643,9 @@ def dict_to_model(_row: dict, model: type[TModel]) -> TModel: logger.warning(f"Converting {key} to model `{model}`.") continue type_ = model.__fields__[key].type_ + if issubclass(type_, datetime.datetime): + _dict[key] = datetime.datetime.fromtimestamp(value) + continue if issubclass(type_, bool): _dict[key] = bool(value) continue