Feature: [docgen] Add a new variable createdAtDate, which contains date

without date and time

This is useful when generating a letter, to fill the today's date in the
letter's header.
This commit is contained in:
Julien Fastré 2022-10-19 16:07:12 +02:00
parent ea5f8c9d08
commit 719256913c

View File

@ -42,6 +42,9 @@ class BaseContextData
$data['createdAt'] = $this->normalizer->normalize(new DateTimeImmutable(), 'docgen', [
'docgen:expects' => DateTimeImmutable::class, 'groups' => ['docgen:read'],
]);
$data['createdAtDate'] = $this->normalizer->normalize(new DateTimeImmutable('today'), 'docgen', [
'docgen:expects' => DateTimeImmutable::class, 'groups' => ['docgen:read'],
]);
$data['location'] = $this->normalizer->normalize(
$user instanceof User ? $user->getCurrentLocation() : null,
'docgen',