Project

General

Profile

Bug #92391

Updated by Daniel Goerz over 3 years ago

I have an object that has a DateTime property.  

 <pre><code class="php"> 
 /** 
  * date 
  *  
  * @var \DateTime 
  */ 
  protected $date = null; 

 /** 
  * Returns the date 
  *  
  * @return \DateTime $date 
  */ 
 public function getDate() 
 { 
     return $this->date; 
 } 

 /** 
  * Sets the date 
  *  
  * @param \DateTime $date 
  * @return void 
  */ 
 public function setDate(\DateTime $date) 
 { 
     $this->date = $date; 
 } 
 </code></pre> 


 This Property is set in a controller action with: 
 <pre><code class="php"> 
 $date = new \DateTime(date('Y-m-d H:i:s'), new \DateTimeZone('Europe/Berlin')); 
 $newOrder->setDate($date); 
 </code></pre> 
 The Date gets stored in the mySQL database, but it is converted to UTC time (-2:00), which is okay, since it is correctly rendered in the frontend by f:formate.date viewhelper. My [SYS][phpTimeZone] = 'Europe/Berlin'. 

 The Problem now is in the backend list view. The Date field is not converted back in the correct time zone which is very confusing to the Editors. But the CRDATE is converted correctly. Both dates should be the same. 

 I think every DateTime property is supposed to be converted to the correct timezone, or am I getting it totally wrong? 

 !https://forge.typo3.org/attachments/download/35479/Bildschirmfoto%202020-09-23%20um%2019.15.39.png! 

Back