core icon indicating copy to clipboard operation
core copied to clipboard

Relative Modified Date Incorrect

Open ScottGeiger opened this issue 13 years ago • 1 comments

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'); }

ScottGeiger avatar Jan 06 '13 03:01 ScottGeiger

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.

ScottGeiger avatar Jan 06 '13 03:01 ScottGeiger