Skip to content

Commit

Permalink
fix: update date comparison timezone information for AAD inputs
Browse files Browse the repository at this point in the history
Addresses part of #16
  • Loading branch information
JasonConger committed Oct 17, 2022
1 parent 5ba7da2 commit 16e30b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package/bin/MS_AAD_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
2 changes: 1 addition & 1 deletion package/bin/MS_AAD_signins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down

0 comments on commit 16e30b9

Please sign in to comment.