Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Validate current year

Avatar

Former Community Member
Hi,



I want to validate a specific year in a text field. The format must be CCYY, the year can be from 1999 and up. The year must be limited to the current year +1 (eg. 2008).





How do I do this?



Regards,



Chris Fourie
1 Reply

Avatar

Former Community Member
Javascript:



var today = new Date();

var year = today.getFullYear();



if(field.rawValue <= year)

{

error, year too big

}