I have two date fields, CommenceDate and EndDate, and I’m trying to write a JavaScript code to validate the EndDate field so that the date selected for that field can never be more than 1100 days after the date selected for CommenceDate.
I want the EndDate field to throw an error message when you try to enter a date that’s more than 1100 days from the date in CommenceDate and for the CommenceDate field to throw an error if the date in that field is changed to a date that will make the date in EndDate field more than 1100 days.
I’m doing this for a public webform and trying to use moment.js but my code isn’t working.
Thank you, Margarita, the code works although I had to change "validators.push" to .addValidator to get it to work. Do you have any idea why that is?
Thank you again.