From 46973af5df23a6b593f5c9c5e33a3ec25fd315f4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 3 Jul 2015 23:25:28 +0300 Subject: [PATCH] smart_date_time: add special case when article date is within current hour --- include/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/functions.php b/include/functions.php index 5c10ac6ac..84c1e35ff 100644 --- a/include/functions.php +++ b/include/functions.php @@ -960,7 +960,9 @@ function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false) { if (!$owner_uid) $owner_uid = $_SESSION['uid']; - if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) { + if (date("Y.m.d.G", $timestamp) == date("Y.m.d.G", time() + $tz_offset)) { + return T_sprintf("%d min", date("i", time() + $tz_offset - $timestamp)); + } else if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) { return date("G:i", $timestamp); } else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) { $format = get_pref('SHORT_DATE_FORMAT', $owner_uid);