Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Chron's avatar
Level 6

time with date and after_or_equal validation returns an error

I have this:

'date' =>      'required|date|after_or_equal:today',
'time' =>      'required|date_format:H:i|after_or_equal:today',

It's currently 13:42, 2020-07-06.

For example, I entered 2020-07-07, which is tomorrow, in date field, and 07:30 in time field, it returns an error that says the time must be a date after or equal to today., which is expected.

But is there a way to include the date when validating time?

So the time field would check the time with the date? So it will go to validation like this: 2020-07-07 07:30

0 likes
3 replies
mabdullahsari's avatar

Where are these rules located? The controller itself or a form request?

Chron's avatar
Level 6

In the controller itself.

Chron's avatar
Level 6

I want it to be like this:

'date' =>      'required|date|after_or_equal:today',
'time' => 'required|date|after_or_equal:today,'.$request['date'].' '.$request['time']

Please or to participate in this conversation.