Return timestamp into custom attribute
I have a custom attribute with type of timestamp. I am trying to just return the current date into it from calculated value script here:
dojo.provide("cr.DateInitiated.genInfo");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("cr.DateInitiated.genInfo", null, {
getValue: function(attribute, workItem, configuration) {
var currentDate = new Date();
var currentDateString= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
var date = dojo.date.stamp.fromISOString(currentDateString);
return date;
}
});
})();
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
dojo.declare("cr.DateInitiated.genInfo", null, {
getValue: function(attribute, workItem, configuration) {
var currentDate = new Date();
var currentDateString= dojo.date.stamp.toISOString(currentDate, {milliseconds:true, zulu:true});
var date = dojo.date.stamp.fromISOString(currentDateString);
return date;
}
});
})();
One answer
This has worked for me:
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2011. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
dojo.provide("com.team.example.CurrentDate");
dojo.require("dojo.date"); // We need the date class from Dojo
dojo.require("dojo.date.stamp"); // We need the stamp class to work with ISO date strings
(function() {
dojo.declare("com.team.example.CurrentDate", null, {
getDefaultValue: function(attribute, workItem, configuration) {
var now=new Date();
var date= dojo.date.stamp.toISOString(now, {milliseconds:true, zulu:true});
console.log("Now is: " + date);
return date;
}
});
})();
Comments
showing 5 of 9
show 4 more comments