How to validate startDate and endDate

Hi Team,

Please advise me how can use Date Validator for start and end date validation.
End date should be greater than startdate.

Regards,
Nagendra.

Hello,
Predefined validators are intended for validating a single value. But you are able to implement your own DateRangeValidator.
The simplest way to perform date range validation is to check that the given values are correct dates, convert dates to timestamps and compare them as numbers.
Best regards,
Daniil.

Hi Daniil,

We can create custom validator for Date validation. we have two dates one is start date and another is end date.

So we have to create validator for end date. Here my question is how to get the start date in end date validator.

Regards,
Nagendra.

Hello,

Please clarify your question - are you having problems with an implementing of the two dates validator?

To get the start date in the end date validator you should pass the start date to the end date validator.

If you use java.util.Date you use this simple snippet:

Date d1 = ...
Date d2 = ...

// convert dates to timestamps and compare them
d1.getTime() < d2.getTime()

Best regards,
Daniil