Skip to content

Commit

Permalink
[chore] switch to timezone.utc instead of utcnow() since the last…
Browse files Browse the repository at this point in the history
… one is deprecated in Python 12 (#3539)
  • Loading branch information
ssenchenko authored Feb 9, 2024
1 parent c03ad6d commit b85b950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions integration/helpers/deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import sys
import time
from collections import OrderedDict
from datetime import datetime
from datetime import datetime, timezone

import botocore

Expand Down Expand Up @@ -140,7 +140,7 @@ def create_changeset(
"ChangeSetType": changeset_type,
"Parameters": parameter_values,
"Capabilities": capabilities,
"Description": f"Created by SAM CLI at {datetime.utcnow().isoformat()} UTC",
"Description": f"Created by SAM CLI at {datetime.now(timezone.utc).isoformat()} UTC",
"Tags": tags,
}

Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/deployer/utils/time_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def parse_date(date_string):
# will use current local time as the base for subtraction, but falsely assume it is a UTC time. Therefore
# the time that dateparser returns will be a `datetime` object that did not have any timezone information.
# So be explicit to set the time to UTC.
"RELATIVE_BASE": datetime.datetime.utcnow()
"RELATIVE_BASE": datetime.datetime.now(datetime.timezone.utc)
}

return dateparser.parse(date_string, settings=parser_settings)

0 comments on commit b85b950

Please sign in to comment.