It's all about the answers!

Ask a question

work item attribute customization: how to set current date in timestamp attribute

Milan Krivic (9809171139) | asked May 16 '13, 9:03 a.m.

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:


(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

permanent link
Jim Ruehlin (79114) | answered May 16 '13, 5:04 p.m.
 Hi Milan,

You need to use 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 = Date(godina, mjesec, datum), {milliseconds:true, zulu:true});
Milan Krivic selected this answer as the correct answer

One other answer

permanent link
Milan Krivic (9809171139) | answered May 17 '13, 4:00 a.m.
 Hi Jim,

this works :)

Thank you very much..

Your answer

Register or to post your answer.