From b6ced673dce6ca4e6a94fbfcbc2d5ee4a3b8f960 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 24 Apr 2025 11:34:06 +0200 Subject: [PATCH] Correction calcul dates --- _calcul_dates.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_calcul_dates.html b/_calcul_dates.html index 6239b76..00ca468 100644 --- a/_calcul_dates.html +++ b/_calcul_dates.html @@ -9,11 +9,12 @@ {{:assign ts_debut=$date_debut|strtotime}} {{:assign ts_fin=$date_fin|strtotime}} -{{:assign nbjours="1+(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}} -{{* au cas où les deux dates seraient inversées ... *}} -{{if $nbjours < 0}} - {{:assign nbjours="-1*%d"|math:$nbjours}} +{{if $ts_debut <= $ts_fin}} + {{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}} +{{else}} + {{:assign nbjours="(%d-%d)/(60*60*24)"|math:$ts_debut:$ts_fin}} {{/if}} + {{* pour simplifier : 360 jours par an *}} {{:assign nbjours="round(%f/365*360)"|math:$nbjours}}