Fixed timedate to 'Europe/Paris'

This commit is contained in:
xdrm-brackets 2017-07-24 18:57:00 +02:00
parent 511d045362
commit 59ee9b680c
1 changed files with 12 additions and 11 deletions

View File

@ -14,7 +14,8 @@
=========================================================*/
$loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view');
$twig = new \Twig_Environment($loader, []);
$twig->getExtension('Twig_Extension_Core')->setTimezone('Europe/Paris');
/* [2] Store variables
=========================================================*/
@ -70,7 +71,7 @@
}
/* RETURNS A RELATIVE HUMAN-READABLE TIME
*
* @ts<int> Timestamp to process
@ -106,20 +107,20 @@
$units['hour'] = intval(date('H')) - $units['hour'];
$units['minute'] = intval(date('i')) - $units['minute'];
$units['second'] = intval(date('s')) - $units['second'];
/* [3] Return significative relative time
=========================================================*/
/* (1) Date units */
if( $units['year'] > 0 ) return [ $units['year'], 'Y' ];
if( $units['month'] > 0 ) return [ $units['month'], 'm' ];
if( $units['day'] > 0 ) return [ $units['day'], 'd' ];
if( $units['year'] > 0 ) return [ $units['year'], 'Y' ];
if( $units['month'] > 0 ) return [ $units['month'], 'm' ];
if( $units['day'] > 0 ) return [ $units['day'], 'd' ];
/* (2) Time units */
if( $units['hour'] > 0 ) return [ $units['hour'], 'H' ];
if( $units['minute'] > 0 ) return [ $units['minute'], 'i' ];
if( $units['second'] > 0 ) return [ $units['second'], 's' ];
if( $units['hour'] > 0 ) return [ $units['hour'], 'H' ];
if( $units['minute'] > 0 ) return [ $units['minute'], 'i' ];
if( $units['second'] > 0 ) return [ $units['second'], 's' ];
/* (3) Default value */
return [0, '.'];
}