configure first day of week for calendar and date-picker (#1952)

This commit is contained in:
Kevin Papst
2020-09-05 18:31:37 +02:00
committed by GitHub
parent ed528eb19a
commit 217960de60
30 changed files with 195 additions and 71 deletions

View File

@@ -9,6 +9,7 @@
namespace App\Entity;
use App\Constants;
use App\Export\Annotation as Exporter;
use App\Utils\StringHelper;
use Doctrine\Common\Collections\ArrayCollection;
@@ -69,7 +70,8 @@ class User extends BaseUser implements UserInterface
public const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
public const DEFAULT_ROLE = self::ROLE_USER;
public const DEFAULT_LANGUAGE = 'en';
public const DEFAULT_LANGUAGE = Constants::DEFAULT_LOCALE;
public const DEFAULT_FIRST_WEEKDAY = 'monday';
public const AUTH_INTERNAL = 'kimai';
public const AUTH_LDAP = 'ldap';
@@ -367,6 +369,11 @@ class User extends BaseUser implements UserInterface
$this->setPreferenceValue(UserPreference::LOCALE, $language);
}
public function getFirstDayOfWeek(): string
{
return $this->getPreferenceValue(UserPreference::FIRST_WEEKDAY, User::DEFAULT_FIRST_WEEKDAY);
}
public function setTimezone(?string $timezone)
{
if ($timezone === null) {