[wp-trac] [WordPress Trac] #25768: date_i18n() is wrong for certain formats, escapes sequences and daylight saving time
WordPress Trac
noreply at wordpress.org
Wed Oct 30 11:08:20 UTC 2013
#25768: date_i18n() is wrong for certain formats, escapes sequences and daylight
saving time
-------------------------+-------------------------------------------------
Reporter: raubvogel | Owner:
Type: defect | Status: new
(bug) | Milestone: Awaiting Review
Priority: normal | Version: 3.7.1
Component: Date/Time | Keywords: has-patch needs-testing dev-
Severity: major | feedback
-------------------------+-------------------------------------------------
{{{date_i18n()}}} returns wrong values in the following cases:
* If time zone is not GMT {{{date_i18n( 'c', time() )}}} does not return
the correct difference to GMT part, e.g., 2013-10-30T14:00:00+00:00
instead of 2013-10-30T14:00:00+01:00.
* The time zone offset is sometimes wrong:
{{{
/*
* Test is called in time zone Europe/Berlin at a date where daylight
saving time is off!
* (Daylight saving time in Europe/Berlin was switched off at 2013-10-27)
*/
// results 2013-10-29T22:15:03+01:00 while daylight saving time
(Europe/Berlin) is off; result is correct
echo(date_i18n('Y-m-d\TH:i:sP', 1383084903));
// results 2013-10-11T19:37:20+01:00 while daylight saving time
(Europe/Berlin) is on; result is wrong! should be +02:00!
echo(date_i18n('Y-m-d\TH:i:sP', 1381520240));
}}}
* {{{date_i18n( 'D | \D | \\D | \\\D | \\\\D | \\\\\D | \\\\\\D' )}}} does
not escaping properly.
The implementation of {{{date_i18n()}}} is not very well at all. Therefore
it was completely rewritten solving the issues above. Performance should
be better too. I added some tests too.
This ticket is a result of the discussion in ticket #20973. You can find a
more detailed discussion there.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25768>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list