work item attribute customization: how to set current date in timestamp attribute
Hi,
I would like to set current date as default value in DUE DATE attribute. I 've done this script, and it works for simple text string attribute, but not for DUE DATE:
dojo.provide("com.apisit.providers.TrenDatum");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("com.apisit.providers.TrenDatum", null, {
getDefaultValue: function(attribute, workItem, configuration) {
var currentDate= new Date();
var datum = currentDate.getDate();
var mjesec = currentDate.getMonth() + 1;
var godina = currentDate.getFullYear();
var cijeli = datum+"."+mjesec+"."+godina+".";
return cijeli;
}
});
})();
|
Accepted answer
Hi Milan,
You need to use dojo.date.stamp to convert the JavaScript date to an RTC timestamp (which is an ISO 8601 string). You also need to set the milliseconds and zulu options to be true. Try something like this:
var cijeli = dojo.date.stamp.toISOString(new Date(godina, mjesec, datum), {milliseconds:true, zulu:true}); Milan Krivic selected this answer as the correct answer
|
One other answer
Hi Jim,
this works :)
Thank you very much..
|
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.