Skip to content

Commit

Permalink
relative_time() macro - ZeroDivisonError fix for current time
Browse files Browse the repository at this point in the history
  • Loading branch information
Petro31 committed Oct 15, 2024
1 parent 2cb21f5 commit d2d462e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions easy_time.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -1422,9 +1422,12 @@
{%- if uptime %}
{%- set value = _delta_seconds(now(), uptime) | int %}
{%- set seconds = value | abs %}
{%- set future = value / seconds > 0 %}
{%- set current = value == 0 %}
{%- set future = not current and value / seconds > 0 %}
{%- set items = _just_time(seconds, language, values, biggest, short=short, floor=floor) %}
{%- if future %}
{%- if current %}
{{- items }}
{%- elif future %}
{{- translate('in', language=language) }} {{ items }}
{%- else %}
{%- set t = translate('ago', language=language) %}
Expand Down

0 comments on commit d2d462e

Please sign in to comment.