You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/06 06:37:47 UTC

[GitHub] [superset] ktmud commented on a change in pull request #12300: fix(explore): timepicker show human readable string in pill

ktmud commented on a change in pull request #12300:
URL: https://github.com/apache/superset/pull/12300#discussion_r552396011



##########
File path: superset/utils/core.py
##########
@@ -1497,6 +1497,25 @@ def get_since_until(
     if time_range and time_range.startswith("Next") and separator not in time_range:
         time_range = _relative_start + separator + time_range
 
+    if (
+        time_range
+        and time_range.startswith("previous calendar week")
+        and separator not in time_range
+    ):
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, WEEK), WEEK) : LASTDAY(DATEADD(DATETIME('today'), -1, WEEK), WEEK)"  # pylint: disable=line-too-long

Review comment:
       If I'm reading the code right, these do not seem to be SQL expressions. They are passed to [`datetime_eval`](https://github.com/airbnb/incubator-superset/blob/865beae3d8644bb5e9df156e5fea80c3ec0202a2/superset/utils/core.py#L1540) which will translate them into actual timestamps before sending to SQL queries.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org