fix locale date format in report header and more (#2520)

* fix problem with empty end datetime in edit time
* fixed calendar creation with tags in "pre-defined tags" mode
* fix locale date format in report header
This commit is contained in:
Kevin Papst
2021-04-21 22:23:32 +02:00
committed by GitHub
parent 305a2fd4f6
commit ff7a402bd4
5 changed files with 14 additions and 13 deletions

View File

@@ -32,11 +32,16 @@ final class TimesheetEntry implements DragAndDropEntry
public function getData(): array public function getData(): array
{ {
$tags = null;
if (!empty($this->timesheet->getTagsAsArray())) {
$tags = implode(',', $this->timesheet->getTagsAsArray());
}
return [ return [
'description' => $this->timesheet->getDescription(), 'description' => $this->timesheet->getDescription(),
'activity' => $this->timesheet->getActivity() !== null ? $this->timesheet->getActivity()->getId() : null, 'activity' => $this->timesheet->getActivity() !== null ? $this->timesheet->getActivity()->getId() : null,
'project' => $this->timesheet->getProject() !== null ? $this->timesheet->getProject()->getId() : null, 'project' => $this->timesheet->getProject() !== null ? $this->timesheet->getProject()->getId() : null,
'tags' => implode(',', $this->timesheet->getTagsAsArray()), 'tags' => $tags,
]; ];
} }

View File

@@ -28,19 +28,14 @@ class TimesheetApiEditForm extends TimesheetEditForm
if ($builder->has('user')) { if ($builder->has('user')) {
$builder->get('user')->setRequired(false); $builder->get('user')->setRequired(false);
} }
}
/** if ($builder->has('tags')) {
* Method added to prevent API BC breaks. $builder->remove('tags');
* // @deprecated for BC reasons here, arrays will be supported in 2.0
* @param FormBuilderInterface $builder $builder->add('tags', TagsInputType::class, [
*/
protected function addTags(FormBuilderInterface $builder)
{
$builder
->add('tags', TagsInputType::class, [
'required' => false, 'required' => false,
]); ]);
}
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)

View File

@@ -39,7 +39,7 @@
{% for day in days %} {% for day in days %}
<th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}"> <th class="text-center text-nowrap{% if day.day is weekend %} weekend{% endif %}">
{{ day.day|day_name(true) }}<br> {{ day.day|day_name(true) }}<br>
{{ day.day|date_format('d.m') }} {{ day.day|format_date('short') }}
</th> </th>
{% endfor %} {% endfor %}
</tr> </tr>

View File

@@ -24,7 +24,7 @@
{% for day in days %} {% for day in days %}
<th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}"> <th class="text-center text-nowrap{% if day is weekend %} weekend{% endif %}">
{{ day|day_name(true) }}<br> {{ day|day_name(true) }}<br>
{{ day|date_format('d.m') }} {{ day|format_date('short') }}
</th> </th>
{% endfor %} {% endfor %}
</tr> </tr>

View File

@@ -248,6 +248,7 @@
{ {
if (durationMoment === null) { if (durationMoment === null) {
getDurationField().value = ''; getDurationField().value = '';
return;
} }
if (!durationMoment.isValid()) { if (!durationMoment.isValid()) {