up infos vélo

This commit is contained in:
Tykayn 2025-07-15 23:23:32 +02:00 committed by tykayn
parent c0a1780fce
commit 0b760c20bc
7 changed files with 246 additions and 50 deletions

View file

@ -0,0 +1,16 @@
{# Template partiel pour afficher une date et le temps écoulé #}
{% set now = "now"|date('U') %}
{% set then = date|date('U') %}
{% set diff = now - then %}
{% set hours = (diff / 3600)|round(0, 'floor') %}
{% set days = (diff / 86400)|round(0, 'floor') %}
<span title="{{ date|date('d/m/Y H:i') }}">
{{ date|date('d/m/Y H:i') }}
{%- if days > 0 -%}
(il y a {{ days }} jour{{ days > 1 ? 's' : '' }})
{%- elseif hours > 0 -%}
(il y a {{ hours }} heure{{ hours > 1 ? 's' : '' }})
{%- else -%}
(il y a moins d'une heure)
{%- endif -%}
</span>