Skip to content

Commit

Permalink
fix: stop invalid uptime from crashing tha page
Browse files Browse the repository at this point in the history
  • Loading branch information
tymees committed Nov 1, 2024
1 parent a4a6e50 commit ee9b4f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion humitifier-server/src/hosts/templatetags/host_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def size_from_mb(value, **kwargs):
@register.filter()
def uptime(time_in_seconds: float, reference: datetime):

startup_datetime = reference - timedelta(seconds=time_in_seconds)
try:
startup_datetime = reference - timedelta(seconds=time_in_seconds)
except TypeError:
return "Failed to parse uptime"

return timesince(startup_datetime, reference)

0 comments on commit ee9b4f1

Please sign in to comment.