From 16e30b976271056646c7b543422b99ec1b61d155 Mon Sep 17 00:00:00 2001 From: Jason Conger Date: Mon, 17 Oct 2022 17:05:48 -0500 Subject: [PATCH] fix: update date comparison timezone information for AAD inputs Addresses part of #16 --- package/bin/MS_AAD_audit.py | 2 +- package/bin/MS_AAD_signins.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/bin/MS_AAD_audit.py b/package/bin/MS_AAD_audit.py index 913f392..cbf9884 100755 --- a/package/bin/MS_AAD_audit.py +++ b/package/bin/MS_AAD_audit.py @@ -128,7 +128,7 @@ def validate_input(helper, definition): raise ValueError("Invalid date format specified for 'Start Date': %s" % start_date) # Make sure the date entered is less than 30 days in the past. # Otherwise, the reporting API will throw an error - if d < datetime.datetime.now() - datetime.timedelta(days=30): + if d.replace(tzinfo=None) < datetime.datetime.now() - datetime.timedelta(days=30): helper.log_error("_Splunk_ 'Start Date' cannot be more than 30 days in the past.: " + start_date) raise ValueError("'Start Date' cannot be more than 30 days in the past.") diff --git a/package/bin/MS_AAD_signins.py b/package/bin/MS_AAD_signins.py index 72124d9..e587a3b 100755 --- a/package/bin/MS_AAD_signins.py +++ b/package/bin/MS_AAD_signins.py @@ -137,7 +137,7 @@ def validate_input(helper, definition): raise ValueError("Invalid date format specified for 'Start Date': %s" % start_date) # Make sure the date entered is less than 30 days in the past. # Otherwise, the reporting API will throw an error - if d < (datetime.datetime.now() - datetime.timedelta(days=30)): + if d.replace(tzinfo=None) < (datetime.datetime.now() - datetime.timedelta(days=30)): helper.log_error("_Splunk_ 'Start Date' cannot be more than 30 days in the past.: " + start_date) raise ValueError("'Start Date' cannot be more than 30 days in the past.")