fix time Elapsed
This commit is contained in:
parent
16e2a6b139
commit
242d43f7c1
@ -101,10 +101,9 @@ class Lang
|
|||||||
|
|
||||||
public static function timeElapsed($datetime, $full = false)
|
public static function timeElapsed($datetime, $full = false)
|
||||||
{
|
{
|
||||||
$now = new DateTime;
|
$now = new DateTime(date("Y-m-d H:i:s"));
|
||||||
$ago = new DateTime($datetime);
|
$ago = new DateTime($datetime);
|
||||||
$diff = $now->diff($ago);
|
$diff = $now->diff($ago);
|
||||||
|
|
||||||
$diff->w = floor($diff->d / 7);
|
$diff->w = floor($diff->d / 7);
|
||||||
$diff->d -= $diff->w * 7;
|
$diff->d -= $diff->w * 7;
|
||||||
|
|
||||||
@ -124,10 +123,15 @@ class Lang
|
|||||||
unset($string[$k]);
|
unset($string[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$when = "";
|
||||||
|
if(time()>strtotime($datetime)){
|
||||||
|
$when = Lang::T('ago');
|
||||||
|
}else{
|
||||||
|
$when = Lang::T('later');
|
||||||
|
}
|
||||||
if (!$full)
|
if (!$full)
|
||||||
$string = array_slice($string, 0, 1);
|
$string = array_slice($string, 0, 1);
|
||||||
return $string ? implode(', ', $string) .' '. Lang::T('ago') : Lang::T('just now');
|
return $string ? implode(', ', $string) .' '. $when : Lang::T('just now');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function nl2br($text)
|
public static function nl2br($text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user