Fix wrong DateTransformer timezone param for non-UTC configuration. #12808
This commit is contained in:
parent
0a09eaf609
commit
0104f15e50
@ -57,8 +57,8 @@ class DateType extends AbstractType
|
||||
|
||||
if ('single_text' === $options['widget']) {
|
||||
$builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
|
||||
'UTC',
|
||||
'UTC',
|
||||
null,
|
||||
null,
|
||||
$dateFormat,
|
||||
$timeFormat,
|
||||
$calendar,
|
||||
@ -73,7 +73,7 @@ class DateType extends AbstractType
|
||||
\Locale::getDefault(),
|
||||
$dateFormat,
|
||||
$timeFormat,
|
||||
'UTC',
|
||||
null,
|
||||
$calendar,
|
||||
$pattern
|
||||
);
|
||||
@ -105,7 +105,7 @@ class DateType extends AbstractType
|
||||
->add('month', $options['widget'], $monthOptions)
|
||||
->add('day', $options['widget'], $dayOptions)
|
||||
->addViewTransformer(new DateTimeToArrayTransformer(
|
||||
'UTC', 'UTC', array('year', 'month', 'day')
|
||||
null, null, array('year', 'month', 'day')
|
||||
))
|
||||
->setAttribute('formatter', $formatter)
|
||||
;
|
||||
@ -113,15 +113,15 @@ class DateType extends AbstractType
|
||||
|
||||
if ('string' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToStringTransformer('UTC', 'UTC', 'Y-m-d')
|
||||
new DateTimeToStringTransformer(null, null, 'Y-m-d')
|
||||
));
|
||||
} elseif ('timestamp' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToTimestampTransformer('UTC', 'UTC')
|
||||
new DateTimeToTimestampTransformer(null, null)
|
||||
));
|
||||
} elseif ('array' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToArrayTransformer('UTC', 'UTC', array('year', 'month', 'day'))
|
||||
new DateTimeToArrayTransformer(null, null, array('year', 'month', 'day'))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class TimeType extends AbstractType
|
||||
}
|
||||
|
||||
if ('single_text' === $options['widget']) {
|
||||
$builder->addViewTransformer(new DateTimeToStringTransformer('UTC', 'UTC', $format));
|
||||
$builder->addViewTransformer(new DateTimeToStringTransformer(null, null, $format));
|
||||
} else {
|
||||
$hourOptions = $minuteOptions = $secondOptions = array(
|
||||
'error_bubbling' => true,
|
||||
@ -109,20 +109,20 @@ class TimeType extends AbstractType
|
||||
$builder->add('second', $options['widget'], $secondOptions);
|
||||
}
|
||||
|
||||
$builder->addViewTransformer(new DateTimeToArrayTransformer('UTC', 'UTC', $parts, 'text' === $options['widget']));
|
||||
$builder->addViewTransformer(new DateTimeToArrayTransformer(null, null, $parts, 'text' === $options['widget']));
|
||||
}
|
||||
|
||||
if ('string' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToStringTransformer('UTC', 'UTC', 'H:i:s')
|
||||
new DateTimeToStringTransformer(null, null, 'H:i:s')
|
||||
));
|
||||
} elseif ('timestamp' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToTimestampTransformer('UTC', 'UTC')
|
||||
new DateTimeToTimestampTransformer(null, null)
|
||||
));
|
||||
} elseif ('array' === $options['input']) {
|
||||
$builder->addModelTransformer(new ReversedTransformer(
|
||||
new DateTimeToArrayTransformer('UTC', 'UTC', $parts)
|
||||
new DateTimeToArrayTransformer(null, null, $parts)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user