Skip to content

Commit

Permalink
Fix "date is not serializable" error.
Browse files Browse the repository at this point in the history
Fix for issue : #185
  • Loading branch information
karwosts authored Feb 15, 2022
1 parent d0e530b commit 7456c1e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/grocy/json_encode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from datetime import datetime
from datetime import date
from pathlib import Path
from typing import Any

Expand All @@ -17,6 +18,8 @@ def default(self, o: Any) -> Any:
return o.barcode
if isinstance(o, datetime):
return o.isoformat()
if isinstance(o, date):
return o.isoformat()
if isinstance(o, set):
return list(o)
if isinstance(o, Path):
Expand Down

0 comments on commit 7456c1e

Please sign in to comment.