[wp-trac] [WordPress Trac] #28636: Add functions for working with local dates and times
WordPress Trac
noreply at wordpress.org
Fri Aug 22 04:49:18 UTC 2014
#28636: Add functions for working with local dates and times
-------------------------+-----------------------------
Reporter: mboynes | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Date/Time | Version: 2.9
Severity: normal | Resolution:
Keywords: 2nd-opinion | Focuses:
-------------------------+-----------------------------
Comment (by mboynes):
Great feedback, thanks!
Replying to [comment:3 rmccue]:
> One thing I see missing right now is checking for "Z" in the time
string; Z indicates Zulu time (UTC) in ISO8601/RFC3339. Note that ISO8601
can also take timezone offsets in the form of "+hhmm" or "+hh" (ditto -).
IMO, detecting this is more trouble than it's worth, and it might be worth
reconsidering that approach.
You're right, this simply wasn't thorough enough. The more I elaborated on
the regex, the more I was reinventing the wheel. I'm attaching another
patch to leverage `DateTime`'s parser to see if a timezone is present in
the string. If one is, or the string fails to parse, it bails. Since this
is to be a drop-in replacement for `strtotime()`, it makes sense that it
should use the same parser (duh).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28636#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list