Simplify variable name

This commit is contained in:
Michael 2022-12-11 04:16:58 +00:00
parent 62376d2e62
commit fc1ef084f4

View File

@ -305,14 +305,14 @@ class Temporal
* Results relative to current timezone. * Results relative to current timezone.
* Limited to range of timestamps. * Limited to range of timestamps.
* *
* @param string $posted_date MySQL-formatted date string (YYYY-MM-DD HH:MM:SS) * @param string $posted_date MySQL-formatted date string (YYYY-MM-DD HH:MM:SS)
* @param string $format (optional) Parsed with sprintf() * @param string $format (optional) Parsed with sprintf()
* @param bool $compare_date_time Compare date (false) or datetime (true). "true" is default. * @param bool $compare_time Compare date (false) or date and time (true). "true" is default.
* <tt>%1$d %2$s ago</tt>, e.g. 22 hours ago, 1 minute ago * <tt>%1$d %2$s ago</tt>, e.g. 22 hours ago, 1 minute ago
* *
* @return string with relative date * @return string with relative date
*/ */
public static function getRelativeDate(string $posted_date = null, string $format = null, bool $compare_date_time = true): string public static function getRelativeDate(string $posted_date = null, string $format = null, bool $compare_time = true): string
{ {
if (empty($posted_date) || $posted_date <= DBA::NULL_DATETIME) { if (empty($posted_date) || $posted_date <= DBA::NULL_DATETIME) {
return DI::l10n()->t('never'); return DI::l10n()->t('never');
@ -327,7 +327,7 @@ class Temporal
$now = time(); $now = time();
if (!$compare_date_time) { if (!$compare_time) {
$now = mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now)); $now = mktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now));
$abs = mktime(0, 0, 0, date('m', $abs), date('d', $abs), date('Y', $abs)); $abs = mktime(0, 0, 0, date('m', $abs), date('d', $abs), date('Y', $abs));
} }
@ -336,7 +336,7 @@ class Temporal
$etime = $now - $abs; $etime = $now - $abs;
if ($etime < 1 && $etime >= 0) { if ($etime < 1 && $etime >= 0) {
return $compare_date_time ? DI::l10n()->t('less than a second ago') : DI::l10n()->t('today'); return $compare_time ? DI::l10n()->t('less than a second ago') : DI::l10n()->t('today');
} }
if ($etime < 0){ if ($etime < 0){