$appSpecificPasswords = DBA::toArray($appSpecificPasswordsStmt);
array_walk($appSpecificPasswords, function (&$value) {
- $value['ago'] = Temporal::getRelativeDate($value['last_used'] ?? '');
+ $value['ago'] = Temporal::getRelativeDate($value['last_used']);
$value['utc'] = $value['last_used'] ? DateTimeFormat::utc($value['last_used'], 'c') : '';
$value['local'] = $value['last_used'] ? DateTimeFormat::local($value['last_used'], 'r') : '';
});
*
* @return string with relative date
*/
- public static function getRelativeDate(string $posted_date, string $format = null): string
+ public static function getRelativeDate(string $posted_date = null, string $format = null): string
{
- $localtime = $posted_date . ' UTC';
+ if (empty($posted_date) || $posted_date <= DBA::NULL_DATETIME) {
+ return DI::l10n()->t('never');
+ }
+ $localtime = $posted_date . ' UTC';
$abs = strtotime($localtime);
- if (empty($posted_date) || $posted_date <= DBA::NULL_DATETIME || $abs === false) {
+ if ($abs === false) {
return DI::l10n()->t('never');
}