File tree Expand file tree Collapse file tree
wcfsetup/install/files/lib/system/form/builder/field Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,21 +301,30 @@ public function readValue()
301301 // string to omit the time zone entirely.
302302 //
303303 // This is an incorrect behavior of the JS component which we
304- // cannot fix for compatibility reasons. We therefore implicitly
305- // assume Zulu time here.
304+ // cannot fix for compatibility reasons.
305+ $ isValidTime = false ;
306306 if (
307307 $ this ->supportsTime ()
308308 && $ this ->hasFieldAttribute ('data-ignore-timezone ' )
309309 && $ this ->getFieldAttribute ('data-ignore-timezone ' ) === 'true '
310310 ) {
311- $ value .= 'Z ' ;
312- $ this ->value = $ value ;
311+ $ dateTime = \DateTime::createFromFormat (
312+ 'Y-m-d\TH:i:s ' ,
313+ $ this ->getValue (),
314+ new \DateTimeZone ('UTC ' )
315+ );
316+
317+ if ($ dateTime !== false ) {
318+ $ isValidTime = true ;
319+
320+ $ this ->value = $ dateTime ->format (self ::TIME_FORMAT );
321+ }
313322 }
314323
315- if ($ this ->getValueDateTimeObject () === null ) {
324+ if (! $ isValidTime && $ this ->getValueDateTimeObject () === null ) {
316325 try {
317326 $ this ->value ($ value );
318- } catch (\InvalidArgumentException ) {
327+ } catch (\InvalidArgumentException $ e ) {
319328 $ this ->value = null ;
320329 }
321330 }
You can’t perform that action at this time.
0 commit comments