Hi,
I have tried searching this, but not seeing what I need, apologies if I have missed it.
Is there a way ensure that date A is not before (less than) date B? or do I need to just function this with JS?
Thanks
This question has an accepted answers - jump to answer
If you are asking how to sort dates see this blog.
Kevin
Hi Kevin, no it was more of a validation I was looking for.
If filling in a form, Date A cannot be before Date B
You can use dependent() for that, to compare the two values, and then error the field with field().error() if it's before. You can use Moment.js for the calculation, as it's excellent for all time/date based operations.
dependent()
field().error()
Colin
Thanks Colin.
It looks like you're new here. If you want to get involved, click one of these buttons!
Answers
If you are asking how to sort dates see this blog.
Kevin
Hi Kevin, no it was more of a validation I was looking for.
If filling in a form, Date A cannot be before Date B
You can use
dependent()
for that, to compare the two values, and then error the field withfield().error()
if it's before. You can use Moment.js for the calculation, as it's excellent for all time/date based operations.Colin
Thanks Colin.