Date calculation


#1

Hi,

I have an date-input-formfield and I want to show an object (error message) when the entered date is older than 1 year. How can I do this?

Thanks,
Max.


#2

Hi, you can use the math function.

I use the Date.parse(dateString) of the input date and the Now.getTime() to compare these two. If the difference is bigger than what you wish, you show a validation text. I used this on the lostFocus event.

You can enter a date older than a year and the validation text will show. If it is less old no validation text will show.

Here is a sample:

ValidateDate.rp (43.0 KB)


#3

Hi BrunoH,

thanks a lot for the solution!

Best,
Max.