1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

fix offset

This commit is contained in:
Daniel Waxweiler
2023-05-21 16:11:24 +02:00
parent 1866e75f70
commit 063458b2c9
4 changed files with 18 additions and 18 deletions

View File

@ -18,17 +18,17 @@ final class DateTimeWrapper {
$this->timeZone = new \DateTimeZone($timeZone);
}
public function get24Time(): string {
$formatter = \IntlDateFormatter::create($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, $this->timeZone);
return $formatter->format($this->dateTime);
}
public function getShortDate(): string {
$formatter = \IntlDateFormatter::create($this->locale, \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE, $this->timeZone);
return $formatter->format($this->dateTime);
}
public function getOffset(): string {
return $this->timeZone->getOffset($this->dateTime);
}
public function get24Time(): string {
$formatter = \IntlDateFormatter::create($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, $this->timeZone);
return $formatter->format($this->dateTime);
public function getTimeZoneName(): string {
return $this->timeZone->getName();
}
}

View File

@ -8,7 +8,7 @@ final class Formatter
$dateText = $startDateTime->getShortDate();
$dateText .= ' ' . $startDateTime->get24Time();
if (!$end && $isShortOffsetNameShown) {
$dateText .= ' (' . $startDateTime->getOffset() . ')';
$dateText .= ' (' . $startDateTime->getTimeZoneName() . ')';
}
if ($end) {
$endDateTime = new DateTimeWrapper($end, $locale, $timeZone);
@ -20,7 +20,7 @@ final class Formatter
}
$dateText .= $endDateTime->get24Time();
if ($isShortOffsetNameShown) {
$dateText .= ' (' . $endDateTime->getOffset() . ')';
$dateText .= ' (' . $endDateTime->getTimeZoneName() . ')';
}
}
return $dateText;