From 47b0aa1ca201f1510b7150aa3612726d738726b3 Mon Sep 17 00:00:00 2001 From: Xbird Date: Tue, 26 Apr 2022 19:40:52 +0000 Subject: [PATCH] Fix Date time immutable issues on forms --- package.json | 2 +- src/Form/BraceletType.php | 6 ++++-- src/Form/JailType.php | 16 ++++++++++++---- src/Form/LicenceWithdrawalType.php | 6 +++++- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0f0a0d9..949ca86 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,3 @@ { - "version": "0.1.3" + "version": "0.1.4" } diff --git a/src/Form/BraceletType.php b/src/Form/BraceletType.php index dfae653..8f1d5bb 100644 --- a/src/Form/BraceletType.php +++ b/src/Form/BraceletType.php @@ -4,7 +4,6 @@ namespace App\Form; use App\Entity\Bracelet; use App\Form\DocumentType; -use App\Form\Type\DateTimeVisionType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -14,7 +13,10 @@ class BraceletType extends DocumentType { parent::buildForm($builder, $options); $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 + ]) ; } diff --git a/src/Form/JailType.php b/src/Form/JailType.php index 7fea41c..2278c03 100644 --- a/src/Form/JailType.php +++ b/src/Form/JailType.php @@ -19,13 +19,21 @@ class JailType extends DocumentType $builder ->add( 'arrestedAt', - DateTimeVisionType::class, - ['label' => 'form_label_arrested_at', 'help' => 'form_help_arrested_at'] + null, + [ + 'label' => 'form_label_arrested_at', + 'help' => 'form_help_arrested_at', + 'view_timezone' => array_key_exists('TZ', $_ENV) ? $_ENV['TZ'] : false + ] ) ->add( 'jailedAt', - DateTimeVisionType::class, - ['label' => 'form_label_jailed_at', 'help' => 'form_help_jailed_at'] + null, + [ + '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('medic', CheckboxType::class, ['label' => 'form_label_asked_for_medic', 'required' => false]) diff --git a/src/Form/LicenceWithdrawalType.php b/src/Form/LicenceWithdrawalType.php index a4a7594..ffaa104 100644 --- a/src/Form/LicenceWithdrawalType.php +++ b/src/Form/LicenceWithdrawalType.php @@ -19,7 +19,11 @@ class LicenceWithdrawalType extends DocumentType $builder ->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 + ]) ; }