]> git.wh0rd.org - tt-rss.git/commitdiff
smart_date_time: add special case when article date is within current hour
authorAndrew Dolgov <noreply@fakecake.org>
Fri, 3 Jul 2015 20:25:28 +0000 (23:25 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Fri, 3 Jul 2015 20:25:47 +0000 (23:25 +0300)
include/functions.php

index 5c10ac6ac790198e21ed55bee25407172767b6f3..84c1e35ff5f3ee3b271051321a51e5da0ef43a27 100644 (file)
        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);