It's all about the answers!

Ask a question

Due date validation is not working between current date(System generated date) post noon(Saudi Time)

Rajiv Gandhi (34812) | asked Jun 16 '15, 11:01 a.m.

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.require(""); // To access the work item attributes
dojo.require(""); // To create a status object to return
dojo.require(""); // To create a severity for the status
dojo.require(""); // We need the date class from Dojo to compare two dates
dojo.require(""); // We need the stamp class to work with ISO date strings

(function() {
var Severity =;
var Status =;
var 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 =;
    var duedate = GetDueDate.getTime().toString();
    var PHED ="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);



Arjun Pande commented Apr 12 '16, 11:09 p.m. | edited Apr 13 '16, 5:13 a.m.

How do u configure this to make it work in templates?

Accepted answer

permanent link
Rajiv Gandhi (34812) | answered Feb 18 '16, 2:35 a.m.
After using the below time functionality, my script is working fine as expected 

//Get current date without time information like YYYY/MM/dd
    var Date(),{datePattern: "yyyy/MM/dd", selector: "date"});
Ralph Schoon selected this answer as the correct answer

Your answer

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.