summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-07-03 23:25:28 +0300
committerAndrew Dolgov <[email protected]>2015-07-03 23:25:47 +0300
commit46973af5df23a6b593f5c9c5e33a3ec25fd315f4 (patch)
tree66992491eafa218d4fa1de352812045ac0b0c4aa /include/functions.php
parent1599996d14e898dd52b3221e49290c2d8e747610 (diff)
smart_date_time: add special case when article date is within current hour
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php4
1 files changed, 3 insertions, 1 deletions
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);