Check if year is in the future in EDC/CDMS
To validate whether a year is in the future you can use the following calculation template:
var year = moment('{year_field}').format('YYYY');
var year_now = moment().format('YYYY');
if (year > year_now) {
"The year cannot be in the future";
} else {
"The year is correct";
}
Test it here in the calculation helper.
Alternatively, you can use the following template and set up data validation rules based on the output 1 or 2.
var year = moment('{year_field}').format('YYYY');
var year_now = moment().format('YYYY');
if (year > year_now) {
1;
} else {
2;
}