File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [ UNRELEASED]
9
9
10
+ * ` datetime.date() ` values are properly JSON serialized. (#204 )
10
11
11
12
## [ 0.6.2] - 2025-05-21
12
13
Original file line number Diff line number Diff line change 3
3
import numbers
4
4
import warnings
5
5
from binascii import b2a_base64
6
- from datetime import datetime
6
+ from datetime import date , datetime
7
7
from typing import Iterable
8
8
9
9
from dateutil .tz import tzlocal
@@ -31,6 +31,9 @@ def json_default(obj: object) -> object:
31
31
obj = _ensure_tzinfo (obj )
32
32
return obj .isoformat ().replace ("+00:00" , "Z" )
33
33
34
+ if isinstance (obj , date ):
35
+ return obj .isoformat ()
36
+
34
37
if isinstance (obj , bytes ):
35
38
return b2a_base64 (obj ).decode ("ascii" )
36
39
You can’t perform that action at this time.
0 commit comments