It's all about the answers!

Ask a question

Validation Script for date should be greater than current date


Pallavi Deore (38150) | asked Aug 01 '18, 7:52 a.m.
edited Aug 01 '18, 7:53 a.m.

 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. 

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.