From fe0a84f50fdc260bea8daa263a3cfcc9160b591b Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Thu, 22 Feb 2024 12:04:42 +0100 Subject: [PATCH] fix: use DateHandler instead of StringHandler for DateObjectDateField --- viecpro_typesense/fields.py | 2 +- viecpro_typesense/handlers.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/viecpro_typesense/fields.py b/viecpro_typesense/fields.py index dde6ba3..1d28c4c 100644 --- a/viecpro_typesense/fields.py +++ b/viecpro_typesense/fields.py @@ -71,7 +71,7 @@ class Config: class DateObjectDateField(Field): class Config: - handler = StringHandler + handler = DateHandler options = O(type="string") diff --git a/viecpro_typesense/handlers.py b/viecpro_typesense/handlers.py index feaadd8..8086f87 100644 --- a/viecpro_typesense/handlers.py +++ b/viecpro_typesense/handlers.py @@ -36,6 +36,10 @@ class StringHandler(Handler): def func(x): return fixstring(x) if x else "" +class DateHandler(Handler): + def func(x): return str(x) if x else "" + + RelatedIDHandler = StringHandler