[wp-trac] [WordPress Trac] #20942: get_gmt_from_date() throws exceptions
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 14 16:20:57 UTC 2012
#20942: get_gmt_from_date() throws exceptions
--------------------------+------------------
Reporter: mdawaffe | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.5
Component: Date/Time | Version:
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------
Comment (by nacin):
If you pass an invalidate date (like month 13), the regular expression
will be fine but the exception will be thrown.
There's no need for us to convert all of this to procedural aliases. Just
the creation. So:
{{{
$datetime = date_create( $string );
if ( ! $datetime )
return something;
$datetime->setTimezone( new DateTimeZone('UTC') );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20942#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list