format('Y-m-d') !== $value) { throw new InvalidArgumentException("Not a Y-m-d date: {$value}"); } return $date; } public static function hours(?string $value): ?EstimatedHours { $value = $value === null ? '' : trim($value); return $value === '' ? null : EstimatedHours::fromString($value); } }