very minor nit - if $abs is false, return before trying to use false in a numeric calculation
also return 'never' if we have an uninitialised date
This commit is contained in:
parent
26cd3a4703
commit
baead9f4c8
1 changed files with 11 additions and 10 deletions
|
@ -176,12 +176,13 @@ function relative_date($posted_date) {
|
|||
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
|
||||
|
||||
$abs = strtotime($localtime);
|
||||
$etime = time() - $abs;
|
||||
|
||||
if ($abs==False) {
|
||||
if ($posted_date === '0000-00-00 00:00:00' || $abs === False) {
|
||||
return t('never');
|
||||
}
|
||||
|
||||
$etime = time() - $abs;
|
||||
|
||||
if ($etime < 1) {
|
||||
return t('less than a second ago');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue