Validation Script for date should be greater than current date
Hi,
I am using RTC 5.0.1, i need date of one attribute should be greater than current date so I used below scripts.
dojo.provide("com.example.Date");
dojo.require("com.ibm.team.workitem.api.common.Severity");
dojo.require("com.ibm.team.workitem.api.common.Status");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
(function() {
var Status= com.ibm.team.workitem.api.common.Status;
dojo.declare("com.example.Date", null, {
validate: function(attribute, workItem, configuration) {
var launchDate = dojo.date.stamp.fromISOString(workItem.getValue("launchDate"));
var currentDate = new Date();
if (launchDate >= currentDate)
{
return Status.OK_STATUS;
}
else
{
return new Status(Severity["ERROR"], "Date should be greater than current date");
}
}
});
})();
I got error message if date is less than current date but when i keep date as None still i got error message.
So any possibility by which i should not get error message if date is None.
How to implement, kindly help me to resolve this.
Thank you.