From 9be137ce949d4ad9f1ed52e54eda48dc29b849c2 Mon Sep 17 00:00:00 2001 From: M Aswin Kishore Date: Tue, 1 Aug 2023 11:45:51 +0530 Subject: [PATCH] feat: add support for mongo date field --- graphene_mongo/converter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/graphene_mongo/converter.py b/graphene_mongo/converter.py index 62a4f478..7a6beeb3 100644 --- a/graphene_mongo/converter.py +++ b/graphene_mongo/converter.py @@ -82,6 +82,13 @@ def convert_field_to_datetime(field, registry=None, executor: ExecutorEnum = Exe ) +@convert_mongoengine_field.register(mongoengine.DateField) +def convert_field_to_date(field, registry=None, executor: ExecutorEnum = ExecutorEnum.SYNC): + return graphene.Date( + description=get_field_description(field, registry), required=field.required + ) + + @convert_mongoengine_field.register(mongoengine.DictField) @convert_mongoengine_field.register(mongoengine.MapField) def convert_field_to_jsonstring(field, registry=None, executor: ExecutorEnum = ExecutorEnum.SYNC):