No longer use `DateUtil::format()` to format the date.
authorCyperghost <olaf_schmitz_1@t-online.de>
Tue, 29 Oct 2024 13:35:24 +0000 (14:35 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Tue, 29 Oct 2024 13:35:24 +0000 (14:35 +0100)
wcfsetup/install/files/lib/util/DateUtil.class.php

index 96d59fa7434d435063406d424002fa7fe35e0ca1..b4e70c8962ab7a39603aa24f8cbbd0658b89194d 100644 (file)
@@ -456,10 +456,12 @@ final class DateUtil
 
         // calc
         if ($year) {
-            $age = self::format(null, 'Y') - $year;
-            if (self::format(null, 'n') < $month) {
+            $now = new \DateTimeImmutable("now", WCF::getUser()->getTimeZone());
+
+            $age = $now->format('Y') - $year;
+            if ($now->format('n') < $month) {
                 $age--;
-            } elseif (self::format(null, 'n') == $month && self::format(null, 'j') < $day) {
+            } elseif ($now->format('n') == $month && $now->format('j') < $day) {
                 $age--;
             }