johndoe555
johndoe555

Reputation: 101

Typo3 : datetime +2 hour gap issue

I have an extension to create events and I can set hours for the start and end of the event.

When I display my hours, there is a gap of +2 hour. When I set 10:00, it display 12:00 .

there is my debug :

debug hour

I display it like that, and I found a temporary but ugly solution by adding "-2 hours" :

 <div class="date mb-4 mb-md-0">
      <f:format.date format="%d %B %Y">{atelier.date}</f:format.date>
      <f:format.date format="H:i" base="{atelier.heuredebut}">-2 hours</f:format.date>
                                -
      <f:format.date format="H:i" base="{atelier.heurefin}">-2 hours</f:format.date>
 </div>

If it can help, there is my model :

    protected $heuredebut;
    
/**
     * @return \DateTime
     */
    public function getHeuredebut()
    {
        return $this->heuredebut;
    }

    /**
     * @param \DateTime $heuredebut
     */
    public function setHeuredebut($heuredebut)
    {
        $this->heuredebut = $heuredebut;
    }

and my TCA :

        'heuredebut' => [
            'exclude' => true,
            'label' => 'LLL:EXT:reservationatelier/Resources/Private/Language/locallang_db.xlf:tx_reservationatelier_domain_model_atelier.heuredebut',
            'config' => [
                'type' => 'input',
                'renderType' => 'inputDateTime',
                'dbType' => 'time',
                'eval' => 'time, int, null',
            ],
        ],

I checked my settings of my server and my php version, everything was ok. So that's not the problem, do you have any idea where it could be? thanks you

Upvotes: 0

Views: 196

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2557

There's a configuration variable $GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’][‘phpTimeZone’]. Start-/Stoptime are calculated based on this timezone.

For instances hosted/maintained in Germany it's $GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’][‘phpTimeZone’] = 'Europe/Berlin' (winter: UTC/GMT +1, summer: UTC/GMT +2).

Upvotes: 1

Related Questions