Needs review
Project:
On This Day
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
29 Apr 2010 at 04:15 UTC
Updated:
10 Oct 2010 at 21:43 UTC
Jump to comment: Most recent file
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);
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 784902-onthisday-use-format_date.patch.txt | 4.14 KB | sillygwailo |
Comments
Comment #1
sillygwailoI'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?
Comment #2
sillygwailoThe attached patch replaces
date()calls withformat_date(), usingtime()where appropriate. (In the D7 branch, I replacetime()withREQUEST_TIME.)