fix date column in export (#5308)

This commit is contained in:
Kevin Papst
2025-01-20 16:09:29 +01:00
committed by GitHub
parent f2fb338539
commit 9d7b418d99
7 changed files with 128 additions and 24 deletions

View File

@@ -0,0 +1,26 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Export\Package\CellFormatter;
final class DateStringFormatter implements CellFormatterInterface
{
public function formatValue(mixed $value): mixed
{
if ($value instanceof \DateTimeInterface) {
return $value->format('Y-m-d');
}
if ($value === null) {
return null;
}
throw new \InvalidArgumentException('Only DateTimeInterface can be formatted');
}
}