var someDate = {CONTROL_DATE}.value;
var today = frevvo.currentDate();
var past = frevvo.addToDate(today, 'y', '-100'); //Calculates 100 years before today (if the current date is 04/12/2000, it gives 04/12/1900)
var future = frevvo.addToDate(someDate, 'm', '3'); //Calculates 3 months from someDate (if the date is a birthday on 04/12/2000, it gives 07/12/2000)
var tomorrow = frevvo.addToDate(today, 'd', '1'); //Calculates tomorrow from today (if the current date is 04/12/2000, it gives 04/13/2000)
// Setting the {CONTROL_DATE} to false if it is not in the past
// Also prints a message to user asking them to enter a valid date before today
if ( someDate >= today ) {
{CONTROL_DATE}.valid = false;
{CONTROL_DATE}.status = "Please enter a valid date before today's date.";
} else {
{CONTROL_DATE}.valid = true;
{CONTROL_DATE}.status = null;
}
|