Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions graphene_pydantic/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
from pydantic import BaseModel
from pydantic.fields import FieldInfo
from pydantic_core import PydanticUndefined
from pydantic.types import (
PastDate,
FutureDate,
PastDatetime,
FutureDatetime,
AwareDatetime,
NaiveDatetime,
)

from .registry import Placeholder, Registry
from .util import construct_union_class_name, evaluate_forward_ref
Expand Down Expand Up @@ -213,9 +221,15 @@ def find_graphene_type(
return UUID
elif type_ in (str, bytes):
return String
elif type_ == datetime.datetime:
elif type_ in [
datetime.datetime,
PastDatetime,
FutureDatetime,
AwareDatetime,
NaiveDatetime
]:
return DateTime
elif type_ == datetime.date:
elif type_ in [datetime.date, PastDate, FutureDate]:
return Date
elif type_ == datetime.time:
return Time
Expand Down