Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #20328, comment 11


Ignore:
Timestamp:
03/05/2013 12:20:31 PM (12 years ago)
Author:
scholesmafia
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20328, comment 11

    v2 v3  
    33The original phpdoc for the function hints at the bug: "Simply adds the value of gmt_offset." This is not sufficient to be DST aware. The point of DST is that gmt_offset changes throughout the year, so simply adding the offset to any date will be incorrect for ~50% of dates.
    44
    5 The dual function `get_gmt_from_date` uses the `timezone_string` option and the `DateTime` class to properly respect the timezone, as alluded to in #20398. This is why the second test `test_dst_respected_getting_gmt_date` passes. The logic for in this function is rather nasty and roundabout, however, so the attached patch simplifies it.
     5The dual function `get_gmt_from_date` uses the `timezone_string` option and the `DateTime` class to properly respect the timezone, as alluded to in #20398. This is why the second test `test_dst_respected_getting_gmt_date` passes. The logic in this function is rather nasty and roundabout, however, so the attached patch simplifies it.
    66
    77The patch to `get_date_from_gmt` adds the same functionality, so that the `timezone_string` is used to convert the GMT date into a date local to that timezone, which respects DST where relevant.