Fixed timezone issue related to expiration date. Also only date is editable and shown now.

Fixes issue #30.
This commit is contained in:
Jan Böhmer 2020-03-29 19:16:48 +02:00
parent 7c424eb548
commit 7ed1836d59
2 changed files with 5 additions and 2 deletions

View file

@ -50,6 +50,7 @@ use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType; use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -116,9 +117,11 @@ class PartLotType extends AbstractType
'required' => false, 'required' => false,
]); ]);
$builder->add('expirationDate', DateTimeType::class, [ $builder->add('expirationDate', DateType::class, [
'label' => 'part_lot.edit.expiration_date', 'label' => 'part_lot.edit.expiration_date',
'attr' => [], 'attr' => [],
'widget' => 'single_text',
'model_timezone' => 'UTC',
'required' => false, 'required' => false,
]); ]);

View file

@ -36,7 +36,7 @@
<h6> <h6>
{% if lot.expirationDate %} {% if lot.expirationDate %}
<span class="badge badge-info" title="{% trans %}part_lots.expiration_date{% endtrans %}"> <span class="badge badge-info" title="{% trans %}part_lots.expiration_date{% endtrans %}">
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_datetime }} <i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}
</span> </span>
{% endif %} {% endif %}
{% if lot.expired %} {% if lot.expired %}