@@ -287,11 +287,8 @@ pimcore.workflow.transitionPanel = Class.create({
287287
288288 }
289289
290- if ( typeof field . setValue !== "undefined" ) {
291- field . setValue ( c . defaultValue ) ;
292- } else {
293- field . config . items [ 0 ] ?. setValue ( c . defaultValue ) ;
294- }
290+ this . setDefaultValueForAdditionalField ( field , tag , c ) ;
291+
295292 } catch ( e ) {
296293 console . error ( 'Could not add additional field' ) ;
297294 console . info ( e ) ;
@@ -310,6 +307,38 @@ pimcore.workflow.transitionPanel = Class.create({
310307
311308 } ,
312309
310+ setDefaultValueForAdditionalField : function ( field , tag , c ) {
311+ if ( typeof field . setValue !== "undefined" ) {
312+ if ( c . fieldType === 'date' && intval ( c . defaultValue ) ) {
313+ field . setValue ( this . getDateValueWithRespectTimezoneConfig ( tag , c . defaultValue ) ) ;
314+ } else {
315+ field . setValue ( c . defaultValue ) ;
316+ }
317+ } else if ( c . fieldType === 'datetime' && intval ( c . defaultValue ) ) {
318+ const tmpDate = this . getDateValueWithRespectTimezoneConfig ( tag , c . defaultValue ) ;
319+
320+ field . config . items [ 0 ] ?. setValue ( tmpDate ) ;
321+ field . config . items [ 1 ] ?. setValue ( tmpDate ) ;
322+ } else {
323+ field . config . items [ 0 ] ?. setValue ( c . defaultValue ) ;
324+ }
325+ } ,
326+
327+ getDateValueWithRespectTimezoneConfig : function ( tag , defaultValue ) {
328+
329+ if ( defaultValue ) {
330+ let tmpDate = new Date ( intval ( defaultValue ) * 1000 ) ;
331+
332+ if ( ! tag . isRespectTimezone ( ) ) {
333+ tmpDate = dateToServerTimezone ( tmpDate ) ;
334+ }
335+
336+ return tmpDate ;
337+ }
338+
339+ return null ;
340+ } ,
341+
313342 /**
314343 * Performs the action selected in the Action Form
315344 *
0 commit comments