mirror of https://github.com/zulip/zulip.git
ruff: Fix DTZ004 `datetime.datetime.utcfromtimestamp()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
7216ba4813
commit
705460ff58
|
@ -28,9 +28,9 @@ def is_outdated_server(user_profile: Optional[UserProfile]) -> bool:
|
|||
# someone has upgraded in the last year but to a release more than
|
||||
# a year old.
|
||||
git_version_path = os.path.join(settings.DEPLOY_ROOT, "version.py")
|
||||
release_build_time = datetime.datetime.utcfromtimestamp(
|
||||
os.path.getmtime(git_version_path)
|
||||
).replace(tzinfo=datetime.timezone.utc)
|
||||
release_build_time = datetime.datetime.fromtimestamp(
|
||||
os.path.getmtime(git_version_path), datetime.timezone.utc
|
||||
)
|
||||
|
||||
version_no_newer_than = min(LAST_SERVER_UPGRADE_TIME, release_build_time)
|
||||
deadline = version_no_newer_than + datetime.timedelta(
|
||||
|
|
|
@ -143,8 +143,8 @@ This is most often used for legal compliance.
|
|||
output = {"zerver_message": message_dicts}
|
||||
floatify_datetime_fields(output, "zerver_message")
|
||||
for item in output["zerver_message"]:
|
||||
item["date_sent_utc"] = datetime.utcfromtimestamp(int(item["date_sent"])).strftime(
|
||||
"%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
item["date_sent_utc"] = datetime.fromtimestamp(
|
||||
int(item["date_sent"]), timezone.utc
|
||||
).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
write_table_data(options["output"], output)
|
||||
|
|
Loading…
Reference in New Issue