Validation: Fixed worklog comment: ...

This commit is contained in:
Igor Scheller 2023-01-21 01:41:55 +01:00
parent f5a7598a45
commit 37a26c123e
3 changed files with 9 additions and 4 deletions

View File

@ -140,7 +140,7 @@ class UserWorkLogController extends BaseController
'work_hours' => $work_hours,
'comment' => $comment,
'is_edit' => $is_edit,
]
] + $this->getNotifications()
);
}

View File

@ -2,7 +2,7 @@
namespace Engelsystem\Http\Validation\Rules;
use DateTime;
use Engelsystem\Helpers\Carbon;
use Illuminate\Support\Str;
use Throwable;
@ -27,11 +27,11 @@ trait StringInputLength
protected function isDateTime(mixed $input): bool
{
try {
new DateTime($input);
$date = Carbon::make($input);
} catch (Throwable $e) {
return false;
}
return true;
return !is_null($date);
}
}

View File

@ -29,7 +29,12 @@ class StringInputLengthTest extends TestCase
['TEST', 4],
['?', 1],
['2042-01-01 00:00', '2042-01-01 00:00'],
['2042-01-01', '2042-01-01'],
['12:42', '12:42'],
['3', '3'],
['...', 3],
['Test Tester', 11],
['com', 3],
];
}
}