MantisBT - Pending Requests
View Issue Details
0001414Pending RequestsTaskspublic2013-11-27 04:172016-12-26 10:25
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001414: Display of overdue wrong for same day tasks
Descriptioncreate task in projdesigner:
for dates, it proposes: start=now, end = now + 1 h, duration = 1 h

store task. Now time on my computer is approx start + 1 min. Task end in ca. 1 hour. task is displayed as overdue .

TagsNo tags attached.
Attached Filespng overdue errors.PNG (53,939) 1969-12-31 16:00

2013-11-27 09:47   
If you're located in Germany (UTC+1h) then this might be related to TZ offset issues in determining actual overdue.
This has had quite a bit of discussion in the old forums & I have sucessfully fixed the core issues (still gantt issues) in my build but Keith is holding off on the git mods. One issue about introducing the fix is the ability to correct the historic offsets in the stored user (date/ time) data. I haven't spent any time on the sql code yet.
Cheers, Sasquatch
2013-11-27 13:58   
I was just testing this on the develop branch and everything appears to work as expected.

Using the patch for, this shouldn't come up as easily anyway.
2013-11-27 22:18   
but it was in the middle of the day, so no TZ assumed as origin.

2013-11-27 23:53   
historic offsets:

if they are not corrected, one could just store the start time of the correction in the db.
Then, if necessary, the user can figure out or apply a correction if needed, but we make sure that the fututre tasks will be ok.

If I understand correctly, at the moment, we keep the future tasks wrong because the fix would not fix the past tasks.

I rather have the future tasks ok, the old ones will be obsolete soon anyway.
2013-11-28 00:22   
The fix is quite easy & covers a couple of issues.
1. Wrong logging of database change times (currently offset by locale TZ difference to London
2. Wrong results when getting some dates back from DB because of the London TZ base.

Typical fix is to change away from TZ defaults & references of "Europe/London" to the correct "UTC". The former adjusts for daylight saving and the latter doesn't.
Unfortunately my notes/ fixes on this were in the old Forums and now no longer available. Look in file classes/w2p/Utilities/Date.class.php line 21 and classes/w2p/Core/CappUI.php line 250, 275
I did test against various user timezones and found no issues.
My thinking on the sql code was to set up a script to a/ change the code and b/ offset the stored data by the calculated offset according to system settings. All fraught with database danger & challenging to the novice.
Do you have my pm address?

Cheers, Sasquatch
2013-11-28 00:30   
(Last edited: 2013-11-28 00:31)
Aha - found my local git commits from playing around in August :-)
---------------------- classes/w2p/Core/CAppUI.class.php ----------------------
index 23969e1..01a8bd9 100644
@@ -250,7 +250,7 @@ class w2p_Core_CAppUI
             $q->addWhere("sysval_value_id = '$timezoneOffset'");
             $userTimezone = $q->loadResult();
- $userTimezone = (strlen($userTimezone) == 0) ? 'Europe/London' : $userTimezone;
+ $userTimezone = (strlen($userTimezone) == 0) ? 'UTC' : $userTimezone;
             $userTZ = new DateTimeZone($userTimezone);
             echo '<span class="error">';
@@ -275,7 +275,7 @@ class w2p_Core_CAppUI
         $userTZ = $this->getPref('TIMEZONE');
         $userTimezone = new DateTimeZone($userTZ);
- $systemTimezone = new DateTimeZone('Europe/London');
+ $systemTimezone = new DateTimeZone('UTC');
         $ts = new DateTime($datetime, $userTimezone);
@@ -291,7 +291,7 @@ class w2p_Core_CAppUI
         $userTimezone = $this->getPref('TIMEZONE');
         $userTZ = new DateTimeZone($userTimezone);
- $systemTZ = new DateTimeZone('Europe/London');
+ $systemTZ = new DateTimeZone('UTC');
         $ts = new DateTime($datetime, $systemTZ);
--------------------- classes/w2p/Database/Query.class.php ---------------------
index e7fcf02..9abeba6 100644
@@ -576,7 +576,7 @@ class w2p_Database_Query {
     public function dbfnNowWithTZ() {
         $df = 'Y-m-d H:i:s';
- $defaultTZ = 'Europe/London';
+ $defaultTZ = 'UTC';
         $systemTZ = new DateTimeZone($defaultTZ);
         $ts = new DateTime();

2013-11-28 03:53   
I think the old Forums are still online and can be searched .they are just closed for new Posts.

2013-12-21 22:13   
I just double checked.. the only references to Europe/London were in the unit tests which I just updated.

Are you guys still seeing the issue?
2013-12-21 22:35   
(Last edited: 2013-12-21 22:39)
My last round of testing after Keith had fixed all the Europe/ London issues came up good - no issue apparent with timezones.
The other thing picked up - looks like this has corrected the gantt display issues as well :-) No longer getting offsets in displayed bars that were very obvious in my locale (NZ) with the 12 or 13h offset from UTC.
Thanks Keith

2013-12-22 18:55   
So do we call this resolved?
2013-12-25 17:55   
Sorry Keith, a check with brand w2p 3.1 pre and a brand new db gives the same overdue error. New picture tells a thousand words
2014-06-15 22:54   
I've been digging around on this one. Here is the code in question:

It appears that $now is always one hour in the future.. is everyone else seeing the same?

Issue History
2013-11-27 04:17optoNew Issue
2013-11-27 09:47sasquatch58Note Added: 0003085
2013-11-27 13:58caseydkNote Added: 0003088
2013-11-27 13:58caseydkStatusnew => feedback
2013-11-27 21:17caseydkProjectv3.0 Release => v3.2 Release
2013-11-27 21:19caseydkProjectv3.2 Release => v3.1 Release
2013-11-27 22:18optoNote Added: 0003089
2013-11-27 23:53optoNote Added: 0003090
2013-11-28 00:22sasquatch58Note Added: 0003091
2013-11-28 00:30sasquatch58Note Added: 0003092
2013-11-28 00:31sasquatch58Note Edited: 0003092
2013-11-28 03:53optoNote Added: 0003093
2013-12-21 22:13caseydkNote Added: 0003135
2013-12-21 22:35sasquatch58Note Added: 0003136
2013-12-21 22:39sasquatch58Note Edited: 0003136
2013-12-22 18:55caseydkNote Added: 0003143
2013-12-25 17:55sasquatch58Note Added: 0003147
2013-12-25 17:58sasquatch58File Added: overdue errors.PNG
2014-01-05 12:07caseydkProjectv3.1 Release => v3.2 Release
2014-01-21 17:58caseydkTarget Version => 3.2
2014-01-25 00:41caseydkCategoryGeneral => Tasks
2014-03-27 09:44caseydkProjectv3.2 Release => v4.0 Release (Planning)
2014-06-10 22:49caseydkTarget Version3.2 => 4.0
2014-06-15 22:54caseydkNote Added: 0003490
2016-12-26 10:25caseydkProjectv4.0 Release (Planning) => Pending Requests