There was stll a bug in Sugar 4 with regard to DST (at least with Pacific/Auckland (GMT+12) (+DST) anyway)
Server time is correct, all MSQL storage times are correct (UTC) but Sugar would still not detect that we are in DST here in NZ, and always display everything 1hr wrong.
Found the fault to be the result of a function in /include/TimeDate.php not recognising that we are indeed in DST
The attached TimeDate.php appears to work so far... Hopefully this may help someone else too.
Techical Explanation Follows:
The inDST function checks to see whether the supplied date is in the Daylight Savings date range.
This function calls another function called “getDSTRange” which gets the user’s start and end dates for daylight savings.
In the TimeZones definition file, the Pacific/Auckland start month is October and the end month is March.
The getDSTRange was pulling out these start/end dates and appending the current year (2006) – then passing them back to the inDST function.
The inDST function would then take the supplied date (the date it was checking) and pass it through this if statement:
If (suppliedDate >= StartDST AND StartDST > EndDST) OR (suppliedDate >= StartDST AND suppliedDate < EndDST)
The StartDST is always going to be greater than the EndDST but the SuppliedDate will only be greater than StartDST in October, November and December.
This means that for January and February – it’s up to the second part of the if statement to return true:
The SuppliedDate will only be greater than StartDST in October, November and December.
This means that this IF statement would only ever return true in October, November, and December.
The solution was to modify the START DST time, and change it to the previous year:
If (09/01/2006 >= 01/10/2005 AND 01/10/2005 > 01/03/2006) OR (09/01/2006 >= 01/10/2005 AND 09/01/2006 < 01/03/2006)


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks