Issue:Timezone adjust not working with UserDateFormat
From FollowTheScore
| 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) {