In the summer, articles posted shortly before midnight will often show up on the page for the following day:

Posted by GeneBreshears on Thu 7 Jun 2001 - 16:34
[...]
Posted by Rigel on Thu 6 Jun 2002 - 23:58

The code that determines the offset includes the following line:
$year_ago = mktime(0, 0, 0, $month, $day, $year - $offset);

mktime has another parameter telling it whether to correct for DST or not. If it is not set, then it will default to -1 andtry to detect whether it should apply DST. This was deprecated in PHP 5.1.0 but is apparently still working.

Adding the parameter 0 at the end appears to fix this, e.g.:
$year_ago = mktime(0, 0, 0, $month, $day, $year - $offset, 0);

Comments

sillygwailo’s picture

Assigned: Unassigned » sillygwailo

I've been using format_date() (to get the $month, $day and $year) in the 7.x branch, and plan to backport that. Would that do the trick?

sillygwailo’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new4.14 KB

The attached patch replaces date() calls with format_date(), using time() where appropriate. (In the D7 branch, I replace time() with REQUEST_TIME.)