Merge pull request #19219 from FHenry/14_fix_warning

fix: warning dol_print_date setTimeStamp when time empty
This commit is contained in:
Laurent Destailleur 2021-10-31 16:49:13 +01:00 committed by GitHub
commit 51b0758263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2289,7 +2289,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$user_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz);
$user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : $time);
$user_dt->setTimestamp(($tzoutput == 'tzuser' || empty($time)) ? dol_now() : $time);
$offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore