Calendar Validation
The Calendar control prevents users from selecting values outside the range determined by the min and max properties.
In many cases, however, not all dates in the range are valid. To handle these situations, the Calendar control has an itemValidator property. This property represents a function that takes a date as a parameter and returns true if the date is valid for selection, or false otherwise.
The calendar below demonstrates this. It prevents users from selecting dates on weekends and holidays:
April 2025
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
30 | 31 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 1 | 2 | 3 |
The current date is Tuesday, April 8, 2025.