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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to