Difference between revisions of "Issue:Timezone adjust not working with UserDateFormat"
From FollowTheScore
(New page: {{Issue |Type = Bug |Extension = DPL |Version = 1.7.4 |Description = UserDateFormat will always output time in UTC. |Status = open }} == Problem == UserDateFormat ...) |
|||
| Line 9: | Line 9: | ||
== Problem == | == Problem == | ||
UserDateFormat will always output time in UTC. The following hack makes it work: | UserDateFormat will always output time in UTC. The following hack makes it work: | ||
| − | + | <pre> | |
Index: C:/temp/tmp/DynamicPageList2.php | Index: C:/temp/tmp/DynamicPageList2.php | ||
=================================================================== | =================================================================== | ||
| Line 37: | Line 37: | ||
if($bAddContribution) { | if($bAddContribution) { | ||
| − | + | </pre> | |
== Reply == | == Reply == | ||
Latest revision as of 17:42, 23 February 2009
| Description: | UserDateFormat will always output time in UTC. |
| Extension / Version: | DPL / 1.7.4 |
| Type / Status: | Bug / open |
Problem
UserDateFormat will always output time in UTC. The following hack makes it work:
Index: C:/temp/tmp/DynamicPageList2.php
===================================================================
--- C:/temp/tmp/DynamicPageList2.php (revision 9)
+++ C:/temp/tmp/DynamicPageList2.php (revision 10)
@@ -1077,7 +1077,7 @@
error_reporting(E_ALL);
- global $wgUser, $wgContLang;
+ global $wgUser, $wgContLang, $wgLang;
global $wgTitle, $wgNonincludableNamespaces;
//logger (display of debug messages)
@@ -3079,8 +3079,11 @@
elseif ($bAddEditDate) $dplArticle->mDate = $row->rev_timestamp;
if ($dplArticle->mDate!='' && $sUserDateFormat!='') {
+ // Adjust for timezone
+ $adjusted = $wgLang->userAdjust(wfTimeStamp(TS_MW, $dplArticle->mDate), false);
// we add one space for nicer formatting
- $dplArticle->myDate = gmdate($sUserDateFormat,wfTimeStamp(TS_UNIX,$dplArticle->mDate)).' ';
+ $dplArticle->myDate = gmdate($sUserDateFormat, wfTimeStamp(TS_UNIX, $adjusted)).' ';
+
}
// CONTRIBUTION, CONTRIBUTOR
if($bAddContribution) {