You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/11/28 05:59:29 UTC

[incubator-superset] branch master updated: Ensure that dttm is of same timezone as epoch_with_tz (#6453)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 4579b12  Ensure that dttm is of same timezone as epoch_with_tz (#6453)
4579b12 is described below

commit 4579b12732f975f2d278476975d0f876ab470ae1
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Wed Nov 28 07:59:23 2018 +0200

    Ensure that dttm is of same timezone as epoch_with_tz (#6453)
---
 superset/utils/core.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset/utils/core.py b/superset/utils/core.py
index be545b0..bd23d07 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -358,6 +358,7 @@ def pessimistic_json_iso_dttm_ser(obj):
 
 def datetime_to_epoch(dttm):
     if dttm.tzinfo:
+        dttm = dttm.replace(tzinfo=pytz.utc)
         epoch_with_tz = pytz.utc.localize(EPOCH)
         return (dttm - epoch_with_tz).total_seconds() * 1000
     return (dttm - EPOCH).total_seconds() * 1000