Natively support the %Y/%m/%d date format

For parsing dates such as 2020/01/25, as seen on https://github.com/envoyproxy/envoy/blob/main/RELEASES.md#major-release-schedule.
This commit is contained in:
Marc Wrobel
2024-02-23 23:37:28 +01:00
parent a20f4c7224
commit f6b1e3abed

View File

@@ -12,6 +12,7 @@ def parse_date(text: str, formats: list[str] = frozenset([
"%d-%B-%Y", # 1-January-2020
"%Y-%m-%d", # 2020-01-01
"%m/%d/%Y", # 01/25/2020
"%Y/%m/%d", # 2020/01/25
])) -> datetime:
"""Parse a given text representing a date using a list of formats.
"""