core
core copied to clipboard
Relative Modified Date Incorrect
The code in lib/template.php at line 92-93 as follows produces an incorrect relative date. The $diffhours is already "diff-ed" from the current time and by subtracting from date('G') you are doubly "diff-ing" the date. What happens is that files modified only a few hours prior receive a relative modified date of "yesterday"
else if((date('G')-$diffhours) > 0) { return $l->t('today'); }
else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); }
code corrected as follows:
else if($diffhours < 24) { return $l->t('today'); }
else if($diffhours < 48) { return $l->t('yesterday'); }
I found the issue. If date.timezone is not set in php.ini the code date('G') generates an error. Thus it was causing files modified only a few hours before to display "yesterday". This was an incorrect setting on my part.