smart_date_time: add special case when article date is within current hour

This commit is contained in:
Andrew Dolgov 2015-07-03 23:25:28 +03:00
parent 1599996d14
commit 46973af5df
1 changed files with 3 additions and 1 deletions

View File

@ -960,7 +960,9 @@
function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false) { function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false) {
if (!$owner_uid) $owner_uid = $_SESSION['uid']; 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); return date("G:i", $timestamp);
} else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) { } else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) {
$format = get_pref('SHORT_DATE_FORMAT', $owner_uid); $format = get_pref('SHORT_DATE_FORMAT', $owner_uid);