Closed
Description
Here are my rules:
public function rules()
{
return [
'date_start' => 'date|date_format:d-m-Y|before:date_finish',
'date_finish' => 'date|date_format:d-m-Y|after:date_start',
];
}
Outcomes from varying input:
- Expected
Input
date_start: 10-10-2015
date_finish: 10-10-2016
Messages
date_start: "The date start must be a date before date finish."
date_finish: Nothing
- Erroneous
Input
date_start: 10-10-2017
date_finish: 10-10-2016
Messages
date_start: "The date start must be a date before date finish."
date_finish: Nothing
- Same
Input
date_start: 10-10-2016
date_finish: 10-10-2016
Messages
date_start: "The date start must be a date before date finish."
date_finish: Nothing
Please note I've tried with my rules like this
public function rules()
{
return [
'date_start' => 'before:date_finish',
'date_finish' => 'after:date_start',
];
}
and this
public function rules()
{
return [
'date_start' => 'date|date_format:Y-m-d|before:date_finish',
'date_finish' => 'date|date_format:Y-m-d|after:date_start',
];
}
Any guidance if I'm doing something wrong would be most appreciated! Excellent package btw, big thanks to the creator.