Skip to content

Commit

Permalink
fix json decoder for date objects
Browse files Browse the repository at this point in the history
  • Loading branch information
douwevandermeij committed Nov 21, 2024
1 parent 34f6070 commit b0bc602
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fractal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Fractal is a scaffolding toolkit for building SOLID logic for your Python applications."""

__version__ = "5.3.1"
__version__ = "5.3.2"

from abc import ABC

Expand Down
2 changes: 2 additions & 0 deletions fractal/core/utils/json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class EnhancedEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime.datetime):
return o.isoformat()
elif isinstance(o, datetime.date):
return o.isoformat()
elif isinstance(o, datetime.time):
return o.isoformat()
elif isinstance(o, set):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fractal-toolkit"
version = "5.3.1"
version = "5.3.2"
description = "Fractal is a scaffolding toolkit for building SOLID logic for your Python applications."
authors = ["Douwe van der Meij <douwe@karibu-online.nl>"]

Expand Down
1 change: 1 addition & 0 deletions tests/core/utils/test_json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

data = [
(datetime(year=2021, month=8, day=19), "2021-08-19T00:00:00"),
(datetime(year=2021, month=8, day=19).date(), "2021-08-19"),
(time(hour=12, minute=30, second=59), "12:30:59"),
({1, 2, 3}, [1, 2, 3]),
(UUID("12345678123456781234567812345678"), "12345678-1234-5678-1234-567812345678"),
Expand Down

0 comments on commit b0bc602

Please sign in to comment.