It's all about the answers!

Ask a question

Attribute type "Timestamp" update default time for attributes with type timestamp

nannette Mori (50252) | asked Jan 11 '18, 10:42 a.m.

When I manually update a date field, the default time is 12 00 00 00 pm.  Is there a way to change the default time gobally for all date/timestamp fields?

Example If I Update the approval date manually using the calendar popup the default time is 12 00 00 00 pm - can that be changed without having to update the time manually when updating the date.

Donald Nong commented Jan 12 '18, 2:37 a.m.

I don't quite understand what you want to achieve? Do you want a "day only" attribute?

Ian Wark commented Jan 12 '18, 2:38 a.m.

I don't think so. I believe the date picker hard codes the default time as 12 noon. You can choose whether to make a timestamp a date or a date + time field initially in the editor presentation, but I think that is all. And the approval one is already there, so you can't customize it.

I get that impression from here:

Ian Wark commented Jan 12 '18, 2:52 a.m.

You might be able to define a default timestamp via Script-based default values. I haven't tested this with a timestamp type though. In this case you won't have to use the picker to choose a date. You can't specify a default timestamp value without writing your own Javascript, though. It isn't one of the options provided.

One answer

permanent link
Ian Wark (79513149) | answered Jan 16 '18, 8:32 a.m.
edited Jan 16 '18, 8:36 a.m.

I'm going to have a go at answering your question. Please tell us if your question was different.

You can change the hour, minutes of all the Timestamp type attributes in a work item (bar those in Approvals tab -- that object can't be broken down) by defining an attribute customization for a Calculated Value of provider type Script-based Calculated Value. You do that by following the below link and writing a little snippet of Javascript.

Calculated Values

For example, you could write something like the below to remove the time portion whenever saving a work item:



(function() {
var WorkItemAttributes=;
dojo.declare("com.example.common.RemoveTimeCalc", null, {

    getValue: function(attributeId, workItem, configuration) {

        var currentDate=;
        //console.log("The value of currentDate is: " + currentDate);

        if (currentDate != null) {

            var isoDate=, {milliseconds:true, zulu:true});
            return isoDate;
        } else { return null; }

You need to alter the WorkItemAttributes.DUE_DATE bit so that it matches the field you are applying it to. But the rest of the script, except for the name can be reused for each Timestamp field.

1. Go to the project area configuration in Eclipse under Workitems > Attribute Customization and add an entry under Calculated Value.
2. Paste the script as is here into the script section on the right.
3. Go to Workitems > Types and Attributes > select the correct work item type > scroll down to your attribute > Edit > add your new calculated value to the Due Date field
4. Repeat steps 1-3 changing the name of the script each time and altering the attribute name. For built-in attributes you can use WorkItemAttributes.XXXXXXX type name, as per .

Your answer

Register or to post your answer.