From 02fb4d2abf350292e82e7936cd3f9253de25338b Mon Sep 17 00:00:00 2001 From: Scott Ames-Messinger Date: Tue, 16 Apr 2024 21:52:23 -0600 Subject: [PATCH] Add support for loading nil dates --- lib/mongo_ecto.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mongo_ecto.ex b/lib/mongo_ecto.ex index 5f8049c..c2738e2 100644 --- a/lib/mongo_ecto.ex +++ b/lib/mongo_ecto.ex @@ -474,6 +474,10 @@ defmodule Mongo.Ecto do defp load_time(time), do: time + defp load_date(nil) do + {:ok, nil} + end + defp load_date(date) do {:ok, date |> DateTime.to_date()} end