[wp-trac] [WordPress Trac] #49413: wp_exif_date2ts should use Dateatime and accept an optional offset

WordPress Trac noreply at wordpress.org
Sun Aug 23 17:53:14 UTC 2020


#49413: wp_exif_date2ts should use Dateatime and accept an optional offset
--------------------------+---------------------
 Reporter:  dshanske      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  low           |   Milestone:  5.6
Component:  Date/Time     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------
Changes (by dshanske):

 * milestone:  Awaiting Review => 5.6


Comment:

 Spent some time with this and simplified it. The other items I put in my
 proof of concept could be addressed in a future ticket and addressed as a
 media issue.

 This new version removes all usages of strtotime and replaces them with
 the DateTime class. It also stores the generated time as an RFC3339
 timestamp with the key 'created' so the timezone data is preserved. The
 DateTime object uses the offset info introduced in Exif 2.31.

 Because the new function uses DateTime, when 2.32, which now incorporates
 the timezone in the DateDigitized field starts to be adopted, this will
 require no changes to just work.

 It maintains the created_timestamp key as the timestamp for backward
 compatibility...however, when there is an offset, the timestamp will be
 adjusted appropriately. When there isn't an offset, it will use the site's
 timezone, which means it will be at least the correct timezone much of the
 time, if not all.

 While the focus was on the EXIF data, there was a need to make sure the
 IPTC data was consistent by adding the same 'created' key when it is used.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49413#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list