Fixed a regular expression in the _parse_period_spec function of the period utility.

This commit is contained in:
依瑪貓 2023-03-05 14:24:51 +08:00
parent 32c27d7c07
commit fe77f87110

View File

@ -498,7 +498,7 @@ def _parse_period_spec(text: str) \
m = re.match(r"^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?-$", text)
if m is not None:
return __get_start(m[1], m[2], m[3]), None
m = re.match(r"-^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$", text)
m = re.match(r"-(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$", text)
if m is not None:
return None, __get_end(m[1], m[2], m[3])
m = re.match(r"^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?-(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$", text)