diff options
Diffstat (limited to 'classes/TimeHelper.php')
| -rw-r--r-- | classes/TimeHelper.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/classes/TimeHelper.php b/classes/TimeHelper.php index 07df3b87c..c39391eea 100644 --- a/classes/TimeHelper.php +++ b/classes/TimeHelper.php @@ -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; @@ -22,7 +26,10 @@ class TimeHelper { } } - static function make_local_datetime(?string $timestamp, bool $long, ?int $owner_uid = null, + /** + * @param bool $long Whether to display the datetime in a 'long' format. Only used if $no_smart_dt is true. + */ + static function make_local_datetime(?string $timestamp, bool $long = false, ?int $owner_uid = null, bool $no_smart_dt = false, bool $eta_min = false): string { if (!$owner_uid) $owner_uid = $_SESSION['uid']; |