Mercurial > libervia-backend
comparison libervia/backend/tools/common/date_utils.py @ 4088:4325a0f13b0f
tools (common/date_utils): update date parsing regex:
the regex `<timestamp> + 30 minutes` was not parsed correctly, this update should fix it.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 08 Jun 2023 21:27:12 +0200 |
parents | 4b842c1fb686 |
children | c6d85c31a59f |
comparison
equal
deleted
inserted
replaced
4087:f8284f994948 | 4088:4325a0f13b0f |
---|---|
35 from libervia.backend.core.constants import Const as C | 35 from libervia.backend.core.constants import Const as C |
36 from libervia.backend.core.i18n import _ | 36 from libervia.backend.core.i18n import _ |
37 | 37 |
38 RELATIVE_RE = re.compile( | 38 RELATIVE_RE = re.compile( |
39 r"\s*(?P<in>\bin\b)?" | 39 r"\s*(?P<in>\bin\b)?" |
40 r"(?P<date>[^+-].+[^\s+-])?\s*(?P<direction>[-+])?\s*" | 40 r"(?P<date>[^+-][^+]+[^\s+-])?\s*(?P<direction>[-+])?\s*" |
41 r"\s*(?P<quantity>\d+)\s*" | 41 r"\s*(?P<quantity>\d+)\s*" |
42 r"(?P<unit>(second|sec|s|minute|min|month|mo|m|hour|hr|h|day|d|week|w|year|yr|y))s?" | 42 r"(?P<unit>(second|sec|s|minute|min|month|mo|m|hour|hr|h|day|d|week|w|year|yr|y))s?" |
43 r"(?P<ago>\s+ago)?\s*", | 43 r"(?P<ago>\s+ago)?\s*", |
44 re.I | 44 re.I |
45 ) | 45 ) |