Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

date validation


Level 4

Hi All,

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.

Pls help



1 Reply


Level 10

Hi Abhiram,

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.isNull)


    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");