Skip to content

Commit 43a510b

Browse files
Merge branch '4.4' into 5.4
* 4.4: [Workflow] Catch error when trying to get an uninitialized marking Add missing license header Use reference date in reverse transform Fixes #40997 Fix env resolution in lock configuration Fix Symfony not working on SMB share #45990 [Cache] make LockRegistry use static properties instead of static variables fix: return-path has higher priority for envelope address than from address (fixes #41322) [HttpClient] Fix sending content-length when streaming the body [Console] Header with column max width is now well wrap with separator [DependencyInjection] Add TaggedIteratorArgument unit tests
2 parents ad39f82 + e7020a1 commit 43a510b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Extension/Core/Type/TimeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
205205
));
206206
} elseif ('array' === $options['input']) {
207207
$builder->addModelTransformer(new ReversedTransformer(
208-
new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts)
208+
new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts, 'text' === $options['widget'], $options['reference_date'])
209209
));
210210
}
211211
}

Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* This file is part of the symfony/symfony package.
4+
* This file is part of the Symfony package.
55
*
66
* (c) Fabien Potencier <[email protected]>
77
*

Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,27 @@ public function testArrayTimeWithReferenceDoesNotUseReferenceTimeOnZero()
10001000
$this->assertSame($input, $form->getViewData());
10011001
}
10021002

1003+
public function testArrayTimeWithReferenceDoesUseReferenceDateOnModelTransform()
1004+
{
1005+
$input = [
1006+
'hour' => '21',
1007+
'minute' => '45',
1008+
];
1009+
1010+
$form = $this->factory->create(static::TESTED_TYPE, $input, [
1011+
'model_timezone' => 'UTC',
1012+
'view_timezone' => 'Europe/Berlin',
1013+
'reference_date' => new \DateTimeImmutable('01-05-2021 12:34:56', new \DateTimeZone('UTC')),
1014+
'input' => 'array',
1015+
]);
1016+
1017+
$this->assertSame($input, $form->getData());
1018+
$this->assertEquals([
1019+
'hour' => '23',
1020+
'minute' => '45',
1021+
], $form->getViewData());
1022+
}
1023+
10031024
/**
10041025
* @dataProvider provideEmptyData
10051026
*/

0 commit comments

Comments
 (0)