It'll be better to use the OOB (out of the box) tools for better performance
I recommend you to configure your validation as follow.
1. click create (in the header bar)>Process>Validate
2. Enter a name for your validation rule
3. In the validation wizard, type your date property name and in the function area you can select several rules, you may select future/past date and set the rule to prevent any future day. The current date will be the date in your environment so you don't need to use another rule to validate or get the current date.
Try to use the PEGA features and prevent any coding since coding is not a best practice because java coding in PEGA has a different context than conventional java coding.
Is there any control Which is directly available in Pega to solve this issue? I want to restrict the Calendar itself instead of user selecting the date and then the validation fires. Or do we have code to write a new control to solve this issue?