Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix DTZ007 `datetime.datetime.strptime()` without %z.
Anders Kaseorg3e10ceb02250
diff --git a/zerver/lib/validator.py b/zerver/lib/validator.pyindex b83ff74cfa3..af35fd5e274 100644--- a/zerver/lib/validator.py+++ b/zerver/lib/validator.py@@ -30,7 +30,7 @@ for any particular type of object.import reimport sysfrom dataclasses import dataclass-from datetime import datetime+from datetime import datetime, timezonefrom decimal import Decimalfrom typing import (Any,@@ -147,7 +147,10 @@ def check_date(var_name: str, val: object) -> str:if not isinstance(val, str):raise ValidationError(_("{var_name} is not a string").format(var_name=var_name))try:- if datetime.strptime(val, "%Y-%m-%d").strftime("%Y-%m-%d") != val:+ if (+ datetime.strptime(val, "%Y-%m-%d").replace(tzinfo=timezone.utc).strftime("%Y-%m-%d")+ != val+ ):raise ValidationError(_("{var_name} is not a date").format(var_name=var_name))except ValueError:raise ValidationError(_("{var_name} is not a date").format(var_name=var_name))