Timezone/integer offset

Hello,

I’m currently using the following in Advanced Settings to import Jira Issue timestamps for Hour of Day Created:

[jira.customfield_hour_of_day_created]
name = “Hour of Day Created”
data_type = “integer”
dimension = true
javascript_code = ‘’’
var hours = new Date(Date.parse(issue.fields.created)).getHours();
issue.fields.customfield_hour_of_day_created = hours;’’’

This pulls timestamps according to UTC and I cannot get it to offset for the correct timezone, no matter how I try to modify it. My question is that if I cannot get the Hour of Day Created value to import into EazyBI from Jira accurately, is there a way to alter/offset the integer value displayed in reports when using the associated Calculated Member? Or do you know how to offset that value in the Javascript pasted above?

Thank you

Hi @athundley ,

You can try to retrieve the timezone offset with the JavaScript methode getTimezoneOffset() - Date.prototype.getTimezoneOffset() - JavaScript | MDN.

The JavaScript code could look similar to the one below:

var createDate = new Date(Date.parse(issue.fields.created));
var hours = createDate.getHours() - (createDate.getTimezoneOffset() / 60) ;
issue.fields.customfield_hour_of_day_created = hours;

Best,
Roberts // support@eazybi.com