Skip to content

Date rule not parsed as string<date> #691

@YournameITManoah

Description

@YournameITManoah

Regression of #79

I have a Form Request with a date attribute with the date rule. It should be parsed as a string<date>, but it's parsed as a regular string.

The Form Request:

class StoreTimeLogRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, ValidationRule|array|string>
     */
    public function rules(): array
    {
        $current = $this->route('time_log');
        return [
            'project_id' => ['required', 'integer', Rule::exists('user_tasks')->where(function (Builder $query) {
                return $query->where('user_id', \Auth::id());
            })],
            'task_id' => ['required', 'integer', new ValidUserTask()],
            'date' => 'required', 'date', 'after_or_equal:1 year ago', 'before_or_equal:now'],
            'start_time' => ['required', new Time(), new UniqueTimeLogFrame($current)],
            'stop_time' => ['required', new Time(), 'after:start_time', new UniqueTimeLogFrame($current)],
        ];
    }
}

The output:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions