From f6b1e3abed51773a64ac3a935c6a59cbc69c9247 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Fri, 23 Feb 2024 23:37:28 +0100 Subject: [PATCH] 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. --- src/common/dates.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/dates.py b/src/common/dates.py index d90c0ca8..8410b0d5 100644 --- a/src/common/dates.py +++ b/src/common/dates.py @@ -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. """