From 8aa6ddba0be535975d3da05f462767c492047a20 Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Mon, 24 Jan 2022 20:52:35 +0200 Subject: [PATCH] (core) Convert datetime objects in Date columns to timestamps at midnight of the date Summary: Changes Date.do_convert to fix a bug noticed in https://grist.slack.com/archives/C069RUP71/p1643044498033400 Test Plan: Existing tests, and tested manually that the use case with the summary table was fixed Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3233 --- sandbox/grist/usertypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox/grist/usertypes.py b/sandbox/grist/usertypes.py index 81fbbc38..97522898 100644 --- a/sandbox/grist/usertypes.py +++ b/sandbox/grist/usertypes.py @@ -287,7 +287,7 @@ class Date(Numeric): if value in ("", None): return None elif isinstance(value, datetime.datetime): - return moment.dt_to_ts(value) + return moment.date_to_ts(value.date()) elif isinstance(value, datetime.date): return moment.date_to_ts(value) elif isinstance(value, (float, six.integer_types)):