Consistently handle the 'smart' display of default/never dates.
This commit is contained in:
@@ -191,10 +191,6 @@ class Counters {
|
||||
$ts = 0;
|
||||
}
|
||||
|
||||
// hide default un-updated timestamp i.e. 1970-01-01 (?) -fox
|
||||
if ((int)date('Y') - (int)date('Y', strtotime($line['last_updated'] ?? '')) > 2)
|
||||
$last_updated = '';
|
||||
|
||||
$cv = [
|
||||
"id" => $id,
|
||||
"updated" => $last_updated,
|
||||
|
||||
+1
-2
@@ -152,8 +152,7 @@ class Feeds extends Handler_Protected {
|
||||
$feed_title = $qfh_ret[1];
|
||||
$feed_site_url = $qfh_ret[2];
|
||||
$last_error = $qfh_ret[3];
|
||||
$last_updated = str_contains($qfh_ret[4] ?? "", '1970-') ?
|
||||
__("Never") : TimeHelper::make_local_datetime($qfh_ret[4], false);
|
||||
$last_updated = TimeHelper::make_local_datetime($qfh_ret[4], false);
|
||||
$highlight_words = $qfh_ret[5];
|
||||
$reply['first_id'] = $qfh_ret[6];
|
||||
$reply['is_vfeed'] = $qfh_ret[7];
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
class TimeHelper {
|
||||
|
||||
static function smart_date_time(int $timestamp, int $tz_offset = 0, ?int $owner_uid = null, bool $eta_min = false): string {
|
||||
// i.e. if the Unix epoch
|
||||
if ($timestamp - $tz_offset === 0)
|
||||
return __('Never');
|
||||
|
||||
if (!$owner_uid) $owner_uid = $_SESSION['uid'];
|
||||
$profile = isset($_SESSION['uid']) && $owner_uid == $_SESSION['uid'] && isset($_SESSION['profile']) ? $_SESSION['profile'] : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user