Validate if the second date is in the same year as the first date.
Hi.
I've created a form in which (among other things) the user has to input two dates, a start date and an end date.
From those two dates the number of weeks worked is calculated.

There is already a custom validation script in place which checks if the date is entered in the right formatting (day, month, year) and gives an error if that's not the case.
What I would like the script to do as well, is to check if the end date is in the same year as the start date.
I've found some examples of scripts that check the date, but can't figure out how to modify and add this in my own script.
This is the script thats in place now:
// JavaScript code for date mask format DD/MM/YYYY
var format = /^[mdy0-9]{2}\/[mdy0-9]{2}\/[mdy0-9]{4}$/
var datespan = util.scand("dd/mm/yyyy", event.value);
//Allow blank space in field
if (event.value !="") {
if (format.test(event.value) == false) {
app.alert ({
cTitle: "Ongeldige datum ingevuld.",
cMsg: "De datum moet u als volgt invullen: dd/mm/jjjj."
});
}
}
(I've also got a document javascript and a custom keystroke script in place since this script doesn't seem to catch all the wrong date formats.)
Does anyone here have an idea how to check the second year against the first, give an error if it's not the same and how to add it to this script?
Thanks for any thoughts on this!
