diff options
author | Simon Rettberg | 2019-01-02 15:26:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-02 15:26:04 +0100 |
commit | bfe34ff61df650b02610767af673644144f015eb (patch) | |
tree | 47760d7b129ffd6003d08b2b1f445edcb9b88625 /inc | |
parent | [locations] Fix invalid array access (diff) | |
download | slx-admin-bfe34ff61df650b02610767af673644144f015eb.tar.gz slx-admin-bfe34ff61df650b02610767af673644144f015eb.tar.xz slx-admin-bfe34ff61df650b02610767af673644144f015eb.zip |
[inc/Util] Improve prettyTime year cutoff logic
Closes #3518
Diffstat (limited to 'inc')
-rw-r--r-- | inc/util.inc.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/inc/util.inc.php b/inc/util.inc.php index 9f6f63db..1a5cbefe 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -495,7 +495,7 @@ SADFACE; settype($ts, 'int'); if ($ts === 0) return '???'; - static $TODAY = false, $ETODAY = false, $YESTERDAY = false, $YEAR = false; + static $TODAY = false, $ETODAY = false, $YESTERDAY = false, $YEARCUTOFF = false; if (!$ETODAY) $ETODAY = strtotime('today 23:59:59'); if ($ts > $ETODAY) // TODO: Do we need strings for future too? return date('d.m.Y H:i', $ts); @@ -505,8 +505,8 @@ SADFACE; if (!$YESTERDAY) $YESTERDAY = strtotime('yesterday 0:00'); if ($ts >= $YESTERDAY) return Dictionary::translate('lang_yesterday') . ' ' . date('H:i', $ts); - if (!$YEAR) $YEAR = strtotime('this year 1/1'); - if ($ts >= $YEAR) + if (!$YEARCUTOFF) $YEARCUTOFF = min(strtotime('-3 month'), strtotime('this year 1/1')); + if ($ts >= $YEARCUTOFF) return date('d.m. H:i', $ts); return date('d.m.Y', $ts); } |