From 8031258f5382b453bed2e9181ea3311a3708bb9b Mon Sep 17 00:00:00 2001 From: Binita Date: Tue, 23 Apr 2024 23:15:36 -0500 Subject: [PATCH 1/2] Worked on ISO datetime format --- pyQuARC/code/datetime_validator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyQuARC/code/datetime_validator.py b/pyQuARC/code/datetime_validator.py index fd67e4ef..44834d30 100644 --- a/pyQuARC/code/datetime_validator.py +++ b/pyQuARC/code/datetime_validator.py @@ -28,6 +28,9 @@ def _iso_datetime(datetime_string): """ REGEX = r"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$" match_iso8601 = re.compile(REGEX).match + parts = datetime_string.split('.') + if len(parts) == 2: + datetime_string = parts[0] try: if match_iso8601(datetime_string): if datetime_string.endswith("Z"): From 2122790f3ae633e1e793ca69b4f107b670dac88a Mon Sep 17 00:00:00 2001 From: Binita Date: Wed, 24 Apr 2024 08:49:52 -0500 Subject: [PATCH 2/2] removed if condition in _iso_datetime function --- pyQuARC/code/datetime_validator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyQuARC/code/datetime_validator.py b/pyQuARC/code/datetime_validator.py index 44834d30..e7b218dc 100644 --- a/pyQuARC/code/datetime_validator.py +++ b/pyQuARC/code/datetime_validator.py @@ -28,9 +28,7 @@ def _iso_datetime(datetime_string): """ REGEX = r"^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$" match_iso8601 = re.compile(REGEX).match - parts = datetime_string.split('.') - if len(parts) == 2: - datetime_string = parts[0] + datetime_string = datetime_string.split('.')[0] try: if match_iso8601(datetime_string): if datetime_string.endswith("Z"):