configure am/pm time-format as user preference (#2789)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user