mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
fix offset
This commit is contained in:
@ -4,8 +4,8 @@ namespace MobilizonConnector;
|
|||||||
final class LocalDateTime {
|
final class LocalDateTime {
|
||||||
private $dateTime;
|
private $dateTime;
|
||||||
|
|
||||||
public function __construct(string $text, \DateTimeZone $timeZone) {
|
public function __construct(string $dateTimeString, \DateTimeZone $timeZone) {
|
||||||
$date = new \DateTimeImmutable($text);
|
$date = new \DateTimeImmutable($dateTimeString);
|
||||||
$this->dateTime = $date->setTimezone($timeZone);
|
$this->dateTime = $date->setTimezone($timeZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ final class LocalDateTimeFormatter
|
|||||||
{
|
{
|
||||||
public static function format(LocalDateTime $dateTime, string $format) {
|
public static function format(LocalDateTime $dateTime, string $format) {
|
||||||
$timestamp = $dateTime->getValue()->getTimestamp();
|
$timestamp = $dateTime->getValue()->getTimestamp();
|
||||||
return date_i18n($format, $timestamp);
|
$offset = $dateTime->getValue()->getOffset();
|
||||||
|
$timestampWithOffset = $timestamp + $offset;
|
||||||
|
return date_i18n($format, $timestampWithOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user