timezoneAbbreviatedName

This commit is contained in:
Benjamin Takats
2022-12-16 16:51:41 +01:00
parent 265f8c26d8
commit d2218029aa
4 changed files with 21 additions and 8 deletions

View File

@@ -8,19 +8,19 @@ class Carbon extends CarbonImmutable
{
public function asDate(): string
{
$dt = $this->timezone(config('app.timezone'))->locale('de');
$dt = $this->timezone(config('app.user-timezone'))->locale('de');
return str($dt->day)->padLeft(2, '0').'. '.$dt->monthName.' '.$dt->year;
}
public function asTime(): string
{
return $this->timezone(config('app.timezone'))->locale('de')
return $this->timezone(config('app.user-timezone'))->locale('de')
->format('H:i');
}
public function asDateTime(): string
{
$dt = $this->timezone(config('app.timezone'))->locale('de');
$dt = $this->timezone(config('app.user-timezone'))->locale('de');
return sprintf("%s.%s.%s %s (%s)",
str($dt->day)->padLeft(2, '0'),
str($dt->month)->padLeft(2, '0'),