All eazyBI for Jira eazyBI for Confluence Private eazyBI

Due date timestamp changes
eazyBI for Jira

This custom field will return the new value (as a timestamp) from a due date change for each issue. It will be mapped to "Time" dimension, and you can use it to create new calculated measure to show the Due date history by Time periods

Account-specific calculated field

Account specific calculated fields are defined in Source Data → Import options.

Settings for the new field

Internal name

ddtstch

Display nameDue date timestamp changes
Data type

decimal 

Measure

Additional advanced settings
multiple_dates = true

Custom JavaScript code:

dateChangeStrings = [];
whenDateChanged = issue.fields.created;
newDateChange = null;
duedateAsTimeChangeStamp = null;
issue.changelog.histories.forEach(function(history){
 history.items.forEach(function(historyItem){
  if (historyItem.field == "duedate" ) {
   newDateChange = historyItem.from;
   if(newDateChange){
     duedateAsTimeChangeStamp = Date.parse(newDateChange);
     dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + duedateAsTimeChangeStamp/1000);
     dateChangeStrings.push(history.created.toString().substr(0,10) + "," + -duedateAsTimeChangeStamp/1000);
   }
   whenDateChanged = history.created;
  }
  });
});
if (issue.fields.duedate) {
  dateChangeStrings.push(whenDateChanged.toString().substr(0,10) + "," + 
  Date.parse(issue.fields.duedate)/1000) ;
}
return dateChangeStrings.join("\n");

Global calculated field

Global calculated fields are defined in eazyBI advanced settings.

Here are the settings for the new field definitions. You should insert the JavaScript (the code given above) below the line // Insert here the Custom JavaScript codeKeep the opening and closing quotation marks. ''', do not delete them.

[jira.customfield_ddtstch]
name = "Due date timestamp changes"
data_type = "decimal"
measure = true
multiple_dates = true
javascript_code = '''
// Insert here the Custom JavaScript code
'''