Fix dates in php < 8.0.0

This commit is contained in:
Léo Serre 2022-02-01 22:39:26 +01:00
parent f60cf54bab
commit 662f72a006
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ else {
$user->rank = "visitor"; // All users are visitors
}
$user->date_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, $config['timezone']);
if (PHP_VERSION_ID < 80000) {
$user->date_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::LONG, IntlDateFormatter::NONE, $config['timezone']);
} else {
$user->date_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, $config['timezone']);
}
$user->datetime_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::LONG, IntlDateFormatter::SHORT, $config['timezone']);
$user->datetimeshort_format = new IntlDateFormatter($config['locale'], IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $config['timezone']);