From e79c5a495fadb680c7002d4b890a3f718daeb6ed Mon Sep 17 00:00:00 2001 From: Benno Rice Date: Sun, 31 Dec 2017 15:04:31 +1100 Subject: [PATCH] Deal with situation where $date is null/None --- ejson/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ejson/__init__.py b/ejson/__init__.py index 40246af..07fd0dd 100644 --- a/ejson/__init__.py +++ b/ejson/__init__.py @@ -101,6 +101,8 @@ def _decode(self, o): if "$escape" in o: return self._decode_escaped(o['$escape']) if "$date" in o: + if o["$date"] is None: + return None return datetime.fromtimestamp(o["$date"] / 1000.0, timezone.utc) if "$binary" in o: return b64decode(o['$binary'])