Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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. 

0 votes


Be the first one to answer this question!

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Aug 01 '18, 7:52 a.m.

Question was seen: 436 times

Last updated: Aug 01 '18, 7:53 a.m.

Confirmation Cancel Confirm