configure am/pm time-format as user preference (#2789)

This commit is contained in:
Kevin Papst
2021-11-14 18:18:26 +01:00
committed by GitHub
parent dce0578a2b
commit 8b0962e192
32 changed files with 216 additions and 260 deletions

View File

@@ -430,6 +430,20 @@ class User implements UserInterface, EquatableInterface, \Serializable
return null;
}
public function getTimeFormat(): string
{
if ($this->is24Hour()) {
return 'H:i';
}
return 'h:i A';
}
public function is24Hour(): bool
{
return (bool) $this->getPreferenceValue(UserPreference::HOUR_24, true);
}
public function getLocale(): string
{
return $this->getPreferenceValue(UserPreference::LOCALE, User::DEFAULT_LANGUAGE);