Skip to content

Commit

Permalink
fix: JSON encoding date objects (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimorg authored Oct 2, 2024
1 parent f46a12b commit c50d62b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/crewai/utilities/crew_json_encoder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, date
import json
from uuid import UUID
from pydantic import BaseModel
Expand All @@ -11,8 +11,9 @@ def default(self, obj):
elif isinstance(obj, UUID):
return str(obj)

elif isinstance(obj, datetime):
elif isinstance(obj, datetime) or isinstance(obj, date):
return obj.isoformat()

return super().default(obj)

def _handle_pydantic_model(self, obj):
Expand Down

0 comments on commit c50d62b

Please sign in to comment.