From 86a9828565feee728ef71241be65000639d69653 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 23 Dec 2019 18:30:06 +0000 Subject: [PATCH] Improve render_timestamp() --- core/05-functions.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/05-functions.php b/core/05-functions.php index f8c3d71..dcca0b9 100644 --- a/core/05-functions.php +++ b/core/05-functions.php @@ -567,11 +567,17 @@ if (!function_exists('getallheaders')) { /** * Renders a timestamp in HTML. * @package core - * @param int $timestamp The timestamp to render. + * @param int $timestamp The timestamp to render. + * @param boolean $absolute Whether the time should be displayed absolutely, or relative to the current time. + * @param boolean $html Whether the result should formatted as HTML (true) or plain text (false). * @return string HTML representing the given timestamp. */ -function render_timestamp($timestamp) { - return ""; +function render_timestamp($timestamp, $absolute = false, $html = true) { + $time_rendered = $absolute ? date("Y-m-d g:ia e", $timestamp) : human_time_since($timestamp); + if($html) + return ""; + else + return $time_rendered; } /** * Renders a page name in HTML.