JDate::toRFC822() does not return offset corretly
Posted: Tue Oct 06, 2009 1:40 pm
Description:
When using $local=true, the JDate::toRFC822() method correctly calculates the date and time with the offset. However is always outputs '+0000' at the end of the returned string. The JDate::toISO8601() method on the other hand correctly evaluates this and appends the offset in the form +00:00.
Reported on:
J!1.5
Related files:
libraries/joomla/html/html.php
Proposed fix(es):
I have created a patch to resolve this problem. This patch borrows code from JDate::toISO8601() with a few tweaks. To test the patch try the following before and after applying:
When using $local=true, the JDate::toRFC822() method correctly calculates the date and time with the offset. However is always outputs '+0000' at the end of the returned string. The JDate::toISO8601() method on the other hand correctly evaluates this and appends the offset in the form +00:00.
Reported on:
J!1.5
Related files:
libraries/joomla/html/html.php
Proposed fix(es):
I have created a patch to resolve this problem. This patch borrows code from JDate::toISO8601() with a few tweaks. To test the patch try the following before and after applying:
Code: Select all
// get now
$now = JFactory::getDate();
echo 'UTC+0:'.$now->toRFC822();
echo '<p>';
$now->setOffset(1);
echo 'UTC+1:'.$now->toRFC822(true);
echo '<p>';
$now->setOffset(-1);
echo 'UTC-1:'.$now->toRFC822(true);