![]() |
@pippuccio76 : You do not need to return the booleans true or false, you can return $date_to_control > $today which evaluates to a boolean.
@InsiteFX :Your code is erroneous InsiteFX. The second parameter of the function doesn't have a $ in front of date2, $date1 > $date2 performs a string comparison not a date comparison and finally applying the ->format method to a string throws a fatal exception. This code is exceedingly error prone. As an aside, whenever you're comparing dates you should use the DateTimeImmutable class rather than DateTime. |
Messages In This Thread |
CI4 validation greater_than on date field - by pippuccio76 - 04-20-2025, 03:33 AM
RE: CI4 validation greater_than on date field - by grimpirate - 04-20-2025, 07:29 AM
RE: CI4 validation greater_than on date field - by pippuccio76 - 04-20-2025, 08:04 AM
RE: CI4 validation greater_than on date field - by InsiteFX - 04-20-2025, 08:59 PM
RE: CI4 validation greater_than on date field - by grimpirate - 04-22-2025, 08:56 PM
RE: CI4 validation greater_than on date field - by InsiteFX - 04-22-2025, 11:21 PM
|