1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-15 02:57:15 +02:00

Make sure livestamp' is only active when 'relative' is selected in toDate().

This commit is contained in:
Cameron
2018-03-04 13:02:50 -08:00
parent 82c7598b74
commit c377050945
2 changed files with 15 additions and 9 deletions

View File

@@ -4740,13 +4740,17 @@ class e_parser
* Includes support for 'livestamp' (http://mattbradley.github.io/livestampjs/)
* @param integer $datestamp - unix timestamp
* @param string $format - short | long | relative
* @return HTML with converted date.
* @return string converted date (html)
*/
public function toDate($datestamp = null, $format='short')
{
if(!is_numeric($datestamp)){ return null; }
return '<span data-livestamp="'.$datestamp.'">'.e107::getDate()->convert($datestamp, $format).'</span>';
$value = e107::getDate()->convert_date($datestamp, $format);
$inc = ($format === 'relative') ? ' data-livestamp="'.$datestamp.'"' : '';
return '<span'.$inc.'>'.$value.'</span>';
}