1
1
Fork 0

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:
Friendika 2011-06-29 03:54:29 -07:00
parent 26cd3a4703
commit baead9f4c8

View file

@ -176,12 +176,13 @@ function relative_date($posted_date) {
$localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date); $localtime = datetime_convert('UTC',date_default_timezone_get(),$posted_date);
$abs = strtotime($localtime); $abs = strtotime($localtime);
$etime = time() - $abs;
if ($abs==False) { if ($posted_date === '0000-00-00 00:00:00' || $abs === False) {
return t('never'); return t('never');
} }
$etime = time() - $abs;
if ($etime < 1) { if ($etime < 1) {
return t('less than a second ago'); return t('less than a second ago');
} }