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/23 07:16:10 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #12552: fix(explore): deprecated x periods pattern in new time picker value

zhaoyongjie commented on a change in pull request #12552:
URL: https://github.com/apache/superset/pull/12552#discussion_r563031381



##########
File path: superset/utils/date_parser.py
##########
@@ -71,19 +71,32 @@ def parse_human_datetime(human_readable: str) -> datetime:
     >>> year_after_1 == year_after_2
     True
     """
+    x_periods = r"^\s*([0-9]+)\s+(second|minute|hour|day|week|month|quarter|year)s?\s*$"
+    if re.search(x_periods, human_readable, re.IGNORECASE):
+        raise ValueError(
+            _(
+                "date string is unclear."
+                " Please specify [{0} ago] or [{0} later]".format(human_readable)
+            )
+        )
+
+    error_msg = ValueError(_("Couldn't parse date string [{}]".format(human_readable)))

Review comment:
       Thanks for pointing this out. I remember that `lazy_gettext()` function can support this syntax, but I've tried this and now it doesn't work.  I will fix this.




----------------------------------------------------------------
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