Hey Dino,
It seems that things on joomla 2.5 have changed quite a bit and we need to modify out date functions.
go to components/com_comments/joscomment/utils.php find this function:
function getLocalDate($strdate, $format='%Y-%m-%d %H:%M:%S') {
jimport('joomla.utilities.date');
$user = & JFactory::getUser();
// if we have an anonymous user, then use global config, instead of the user params
if ($user->get('id')) {
$tz = $user->getParam('timezone');
} else {
$conf = & JFactory::getConfig();
$tz = $conf->getValue('config.offset');
}
$jdate = new JDate($strdate);
$jdate->setOffset($tz);
if ($format == 'age') {
$current = new JDate();
$current->setOffset($tz);
$unixtst = (int) $jdate->toUnix();
$diff = (int) ($current->toUnix() - $unixtst);
$years = 0;
$months = 0;
$days = 0;
$hours = 0;
$minutes = 0;
$seconds = 0;
if ($diff > (60 * 60 * 24 * 365)) {
// more than a yeas
$years = floor($diff / (60 * 60 * 24 * 365));
$diff = (int) ($diff % (60 * 60 * 24 * 365));
}
if ($diff > (60 * 60 * 24 * 30)) {
// more than a month
$months = floor($diff / (60 * 60 * 24 * 30));
$diff = (int) ($diff % (60 * 60 * 24 * 30));
}
if ($diff > (60 * 60 * 24)) {
// more than a day
$days = floor($diff / (60 * 60 * 24));
$diff = (int) ($diff % (60 * 60 * 24));
}
if ($diff > (60 * 60)) {
// more than an hour
$hours = floor($diff / (60 * 60));
$diff = (int) ($diff % (60 * 60));
}
if ($diff > 60) {
// more than a minute
$minutes = floor($diff / 60);
$diff = (int) ($diff % 60);
}
$seconds = $diff;
if ((int) $years) {
$formatDate = JText::sprintf('COM_COMMENT_YEAR' . ((int) $years == 1 ? '' : 'S') . '_AGO', $years);
} elseif ((int) $months) {
$formatDate = JText::sprintf('COM_COMMENT_MONTH' . ((int) $months == 1 ? '' : 'S') . '_AGO', $months);
} elseif ((int) $days) {
$formatDate = JText::sprintf('COM_COMMENT_DAY' . ((int) $days == 1 ? '' : 'S') . '_AGO', $days);
} elseif ((int) $hours) {
$formatDate = JText::sprintf('COM_COMMENT_HOUR' . ((int) $hours == 1 ? '' : 'S') . '_AGO', $hours);
} elseif ((int) $minutes) {
$formatDate = JText::sprintf('COM_COMMENT_MINUTE' . ((int) $minutes == 1 ? '' : 'S') . '_AGO', $minutes);
} elseif ((int) $seconds) {
$formatDate = JText::sprintf('COM_COMMENT_SECOND' . ((int) $seconds == 1 ? '' : 'S') . '_AGO', $seconds);
} else {
$formatDate = JText::sprintf('COM_COMMENT_SECOND' . ((int) $seconds == 1 ? '' : 'S') . '_AGO', $seconds);
}
} else {
$formatDate = $jdate->toFormat($format);
}
return $formatDate;
}
and change it to
function getLocalDate($strdate, $format='%Y-%m-%d %H:%M:%S') {
jimport('joomla.utilities.date');
// if we have an anonymous user, then use global config, instead of the user params
$userTz = JFactory::getUser()->getParam('timezone');
$timeZone = JFactory::getConfig()->getValue('offset');
if($userTz) {
$timeZone = $userTz;
}
$jdate = new JDate($strdate);
$jdate->setTimezone(new DateTimeZone($timeZone));
if ($format == 'age') {
$current = new JDate();
$current->setOffset($tz);
$unixtst = (int) $jdate->toUnix();
$diff = (int) ($current->toUnix() - $unixtst);
$years = 0;
$months = 0;
$days = 0;
$hours = 0;
$minutes = 0;
$seconds = 0;
if ($diff > (60 * 60 * 24 * 365)) {
// more than a yeas
$years = floor($diff / (60 * 60 * 24 * 365));
$diff = (int) ($diff % (60 * 60 * 24 * 365));
}
if ($diff > (60 * 60 * 24 * 30)) {
// more than a month
$months = floor($diff / (60 * 60 * 24 * 30));
$diff = (int) ($diff % (60 * 60 * 24 * 30));
}
if ($diff > (60 * 60 * 24)) {
// more than a day
$days = floor($diff / (60 * 60 * 24));
$diff = (int) ($diff % (60 * 60 * 24));
}
if ($diff > (60 * 60)) {
// more than an hour
$hours = floor($diff / (60 * 60));
$diff = (int) ($diff % (60 * 60));
}
if ($diff > 60) {
// more than a minute
$minutes = floor($diff / 60);
$diff = (int) ($diff % 60);
}
$seconds = $diff;
if ((int) $years) {
$formatDate = JText::sprintf('COM_COMMENT_YEAR' . ((int) $years == 1 ? '' : 'S') . '_AGO', $years);
} elseif ((int) $months) {
$formatDate = JText::sprintf('COM_COMMENT_MONTH' . ((int) $months == 1 ? '' : 'S') . '_AGO', $months);
} elseif ((int) $days) {
$formatDate = JText::sprintf('COM_COMMENT_DAY' . ((int) $days == 1 ? '' : 'S') . '_AGO', $days);
} elseif ((int) $hours) {
$formatDate = JText::sprintf('COM_COMMENT_HOUR' . ((int) $hours == 1 ? '' : 'S') . '_AGO', $hours);
} elseif ((int) $minutes) {
$formatDate = JText::sprintf('COM_COMMENT_MINUTE' . ((int) $minutes == 1 ? '' : 'S') . '_AGO', $minutes);
} elseif ((int) $seconds) {
$formatDate = JText::sprintf('COM_COMMENT_SECOND' . ((int) $seconds == 1 ? '' : 'S') . '_AGO', $seconds);
} else {
$formatDate = JText::sprintf('COM_COMMENT_SECOND' . ((int) $seconds == 1 ? '' : 'S') . '_AGO', $seconds);
}
} else {
$formatDate = $jdate->format($format, true);
}
return $formatDate;
}
This should be all. Let me know if after those modifications everything is ok.
Cheers,
Daniel