From c13db6802ec347cdcfa3b16edd6bea61880da3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 13 Apr 2023 14:40:07 +0200 Subject: [PATCH] v0.0.102 --- rfctime/rfc3339.go | 4 ++++ rfctime/rfc3339Nano.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/rfctime/rfc3339.go b/rfctime/rfc3339.go index e493f55..0e350ff 100644 --- a/rfctime/rfc3339.go +++ b/rfctime/rfc3339.go @@ -66,6 +66,10 @@ func (t *RFC3339Time) UnmarshalText(data []byte) error { } func (t *RFC3339Time) UnmarshalBSONValue(bt bsontype.Type, data []byte) error { + if bt == bsontype.Null { + *t = RFC3339Time{} + return nil + } if bt != bsontype.DateTime { return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339Time", bt)) } diff --git a/rfctime/rfc3339Nano.go b/rfctime/rfc3339Nano.go index a14b856..8383b32 100644 --- a/rfctime/rfc3339Nano.go +++ b/rfctime/rfc3339Nano.go @@ -66,6 +66,10 @@ func (t *RFC3339NanoTime) UnmarshalText(data []byte) error { } func (t *RFC3339NanoTime) UnmarshalBSONValue(bt bsontype.Type, data []byte) error { + if bt == bsontype.Null { + *t = RFC3339NanoTime{} + return nil + } if bt != bsontype.DateTime { return errors.New(fmt.Sprintf("cannot unmarshal %v into RFC3339NanoTime", bt)) }