From e96838e2619c25dca7eaf3bf5b20c7098a36baca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Thu, 21 Dec 2017 15:18:05 +0100
Subject: [PATCH] Merge branch
 '5746-using-date-modifier-not-work-for-unix-password-expiration' into
 '1.3-dev'

Resolve "Using date modifier not work for unix password expiration"

See merge request fusiondirectory/fd!101

(cherry picked from commit 9d3163f9097333ab3bed5c186db1ead9edabcada)

37dba370 :sparkles: feat(template): Add special epoch format for date modifier
---
 include/class_templateHandling.inc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc
index 6752459c4..2655ba9b1 100644
--- a/include/class_templateHandling.inc
+++ b/include/class_templateHandling.inc
@@ -364,6 +364,10 @@ class templateHandling
       $args[] = 'd.m.Y';
     }
     $dateObject = new DateTime($args[0], new DateTimeZone('UTC'));
+    if ($args[1] == 'epoch') {
+      /* Special handling for shadowExpire: days since epoch */
+      return array(floor($dateObject->format('U') / 86400));
+    }
     return array($dateObject->format($args[1]));
   }
 
-- 
GitLab