Explorar el Código

norm_datetime handles None

main
Rocketsoup hace 1 mes
padre
commit
815e5391ea
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2
    0
      rocketbot/utils.py

+ 2
- 0
rocketbot/utils.py Ver fichero

@@ -209,6 +209,8 @@ def format_bytes(size: int) -> str:
209 209
 def norm_datetime(dt: datetime) -> datetime:
210 210
 	"""Converts a datetime to UTC for consistent comparison."""
211 211
 	# "Naive" datetimes (without a time zone) are assumed as system local time zone
212
+	if dt is None:
213
+		return dt
212 214
 	return datetime.fromtimestamp(dt.timestamp(), timezone.utc)
213 215
 
214 216
 MOD_PERMISSIONS: Permissions = Permissions(Permissions.manage_messages.flag)

Loading…
Cancelar
Guardar