Due date validation is not working between current date(System generated date) post noon(Saudi Time)
Dear Team,
We have implemented java scrip in RTC workitem for date validation. It satisfies the condition that due date should be greater than or equal to current date(System generated Date). We are observing the following limitations
1) (Due Date >= Current Date), this condition works fine till Mid noon(Saudi Time) but it doesn’t work post noon during creation of RTC workitem.
We are not clear on what exactly is the reason behind this issue. Can anyone help me out on this regard?.
FYI: The below one is the created script for workitem date validation.
dojo.provide("DueDateValidation");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes"); // To access the work item attributes
dojo.require("com.ibm.team.workitem.api.common.Status"); // To create a status object to return
dojo.require("com.ibm.team.workitem.api.common.Severity"); // To create a severity for the status
dojo.require("dojo.date"); // We need the date class from Dojo to compare two dates
dojo.require("dojo.date.stamp"); // We need the stamp class to work with ISO date strings
(function() {
var Severity = com.ibm.team.workitem.api.common.Severity;
var Status = com.ibm.team.workitem.api.common.Status;
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var DateValidator = dojo.declare("DueDateValidation", null, {
validate: function(attributeId, workItem, configuration) {
var severity = "ERROR";
var message = "Due Date cannot be less then Current Date";
var GetCurrentDate = new Date();
var CurrentDate = GetCurrentDate.getTime().toString();
var GetDueDate = dojo.date.stamp.fromISOString(workItem.getValue(com.ibm.team.workitem.api.common.WorkItemAttributes.DUE_DATE));
var duedate = GetDueDate.getTime().toString();
var PHED = dojo.date.stamp.fromISOString(workItem.getValue("HandoverPlannedEndDate"));
var StringPHED = PHED.getTime().toString();
// Compare the two dates and make sure DueDate is not earlier than CurrentDate
if ((workItem.getValue(WorkItemAttributes.TYPE)=="change_request") && (duedate >= CurrentDate)) {
return Status.OK_STATUS;
}else {
return new Status(Severity[severity], message);
}
}
});
})();
Thanks,
Rajiv
Comments
Arjun Pande
Apr 13 '16, 5:13 a.m.How do u configure this to make it work in templates?