Fix Date time immutable issues on forms

This commit is contained in:
Xbird
2022-04-26 19:40:52 +00:00
parent f95c9c1bac
commit 47b0aa1ca2
4 changed files with 22 additions and 8 deletions

View File

@@ -1,3 +1,3 @@
{ {
"version": "0.1.3" "version": "0.1.4"
} }

View File

@@ -4,7 +4,6 @@ namespace App\Form;
use App\Entity\Bracelet; use App\Entity\Bracelet;
use App\Form\DocumentType; use App\Form\DocumentType;
use App\Form\Type\DateTimeVisionType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -14,7 +13,10 @@ class BraceletType extends DocumentType
{ {
parent::buildForm($builder, $options); parent::buildForm($builder, $options);
$builder $builder
->add('removingDate', DateTimeVisionType::class, ['label' => 'form_label_removing_date']) ->add('removingDate', null, [
'label' => 'form_label_removing_date',
'view_timezone' => array_key_exists('TZ', $_ENV) ? $_ENV['TZ'] : false
])
; ;
} }

View File

@@ -19,13 +19,21 @@ class JailType extends DocumentType
$builder $builder
->add( ->add(
'arrestedAt', 'arrestedAt',
DateTimeVisionType::class, null,
['label' => 'form_label_arrested_at', 'help' => 'form_help_arrested_at'] [
'label' => 'form_label_arrested_at',
'help' => 'form_help_arrested_at',
'view_timezone' => array_key_exists('TZ', $_ENV) ? $_ENV['TZ'] : false
]
) )
->add( ->add(
'jailedAt', 'jailedAt',
DateTimeVisionType::class, null,
['label' => 'form_label_jailed_at', 'help' => 'form_help_jailed_at'] [
'label' => 'form_label_jailed_at',
'help' => 'form_help_jailed_at',
'view_timezone' => array_key_exists('TZ', $_ENV) ? $_ENV['TZ'] : false
]
) )
->add('lawyer', CheckboxType::class, ['label' => 'form_label_asked_for_lawyer', 'required' => false]) ->add('lawyer', CheckboxType::class, ['label' => 'form_label_asked_for_lawyer', 'required' => false])
->add('medic', CheckboxType::class, ['label' => 'form_label_asked_for_medic', 'required' => false]) ->add('medic', CheckboxType::class, ['label' => 'form_label_asked_for_medic', 'required' => false])

View File

@@ -19,7 +19,11 @@ class LicenceWithdrawalType extends DocumentType
$builder $builder
->add('type', VehicleType::class) ->add('type', VehicleType::class)
->add('until', DateTimeVisionType::class, ['label' => 'form_label_until', 'help' => 'form_help_until']) ->add('until', null, [
'label' => 'form_label_until',
'help' => 'form_help_until',
'view_timezone' => array_key_exists('TZ', $_ENV) ? $_ENV['TZ'] : false
])
; ;
} }