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);

View File

@@ -30,6 +30,7 @@ class UserPreference
public const INTERNAL_RATE = 'internal_rate';
public const SKIN = 'skin';
public const LOCALE = 'language';
public const HOUR_24 = 'hours_24';
public const TIMEZONE = 'timezone';
public const FIRST_WEEKDAY = 'first_weekday';