diff --git a/datasette/app.py b/datasette/app.py index aa75d772a3..23d21600c6 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -930,7 +930,7 @@ async def permission_allowed( used_default = True self._permission_checks.append( { - "when": datetime.datetime.utcnow().isoformat(), + "when": datetime.datetime.now(datetime.timezone.utc).isoformat(), "actor": actor, "action": action, "resource": resource, diff --git a/datasette/default_magic_parameters.py b/datasette/default_magic_parameters.py index 1938220765..91c1c5aa0a 100644 --- a/datasette/default_magic_parameters.py +++ b/datasette/default_magic_parameters.py @@ -24,9 +24,12 @@ def now(key, request): if key == "epoch": return int(time.time()) elif key == "date_utc": - return datetime.datetime.utcnow().date().isoformat() + return datetime.datetime.now(datetime.timezone.utc).date().isoformat() elif key == "datetime_utc": - return datetime.datetime.utcnow().strftime(r"%Y-%m-%dT%H:%M:%S") + "Z" + return ( + datetime.datetime.now(datetime.timezone.utc).strftime(r"%Y-%m-%dT%H:%M:%S") + + "Z" + ) else: raise KeyError