From: Cyperghost Date: Tue, 29 Oct 2024 13:35:24 +0000 (+0100) Subject: No longer use `DateUtil::format()` to format the date. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=930c9d830bc6e4697be967a4ef0cf711892ba51d;p=GitHub%2FWoltLab%2FWCF.git No longer use `DateUtil::format()` to format the date. --- diff --git a/wcfsetup/install/files/lib/util/DateUtil.class.php b/wcfsetup/install/files/lib/util/DateUtil.class.php index 96d59fa743..b4e70c8962 100644 --- a/wcfsetup/install/files/lib/util/DateUtil.class.php +++ b/wcfsetup/install/files/lib/util/DateUtil.class.php @@ -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--; }