From f676c12617856a53822a47a4ba43c9b8407873ef Mon Sep 17 00:00:00 2001 From: faph Date: Sun, 5 Nov 2023 18:45:08 -0600 Subject: [PATCH] Fix date default which should be number of days since 1970-1-1 Previous logic was dependant on timezone --- src/py_avro_schema/_schemas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py_avro_schema/_schemas.py b/src/py_avro_schema/_schemas.py index 41d5663..2565fff 100644 --- a/src/py_avro_schema/_schemas.py +++ b/src/py_avro_schema/_schemas.py @@ -351,7 +351,7 @@ def data(self, names: NamesType) -> JSONObj: def make_default(self, py_default: datetime.date) -> int: """Return an Avro schema compliant default value for a given Python value""" - return (py_default - datetime.date.fromtimestamp(0)).days + return (py_default - datetime.date(1970, 1, 1)).days class TimeSchema(Schema):