Sign in to Community
Sign in to view all badges
Expand my Community achievements bar.
I want to validate a date field so that it accepts only dates less than the current date .It shouldnt take the current date also.
Pls provide me the script to do the same..
I tried something but its accepting current date also.
I would guess you have to remove the time part of the date before doing the comparision.
Something like this, which I have in the exit event.
if (this.formattedValue === this.rawValue) // this assumes there is a display pattern defined
app.alert("Invalid date format");
var thisDate = util.scand("yyyy-mm-dd", this.rawValue).setHours(0,0,0,0); // Make sure there is no time component
if (thisDate >= new Date().setHours(0,0,0,0))
app.alert("Date must be in the past");