php - Laravel 4.2 Date Validation
760
How do I validate a date in such a way that it only accepts today and any date older than today? I knowbefore:today
accepts older dates whileafter:today
accepts dates starting tomorrow on-wards.
$rules = [
'start_at' => 'required|date|date_format:Y-m-d|after:yesterday',
'end_at' => 'required|date|date_format:Y-m-d|after:start_at',
];
I want to be able to start a task today and end today.
Answer
Solution:
From my understanding, you want the
end_at
to on the same date or afterstart_at
but not beforestart_at
.What I have done so far, The
end_at
need to be relevant with thestart_at
(same or after thestart_at
).strtotime
PHP function.