In a JIRA filter, when using issueFunction in expression to calculate the minutes between two dates, the result is off by 60 minutes if the dates span a Daylight Savings Time switch (2 minutes might be calculated as 62 minutes or as -58 minutes).
Is there a workaround for this, or a way to have the query account for that? I've been able to address it with a calculated field, but I also need to be able to do this in a query directly (e.g., show me all issues where (custom date 1) is more than 30 minutes after (custom date 2), if there's a DST split in between.
Here's my scripted field, if it's useful (populates a calculated field called "Duration"):
def start = getCustomFieldValue("Incident Start Date")
def end = getCustomFieldValue("Incident End Date")
if (start && end) {
def minutesToAdjust = Math.abs(start.getTimezoneOffset()) - Math.abs(end.getTimezoneOffset())
return new Double((end.getTime() - start.getTime())/1000/60 + minutesToAdjust)
}
else {
return null
}and, if those dates cross a DST boundary, here's a query that returns results that it shouldn't (just as an example... I actually need to use a similar query in a situation where I don't have a scripted custom field):
issueFunction in expression("project = ABC", "(IncidentEndDate - IncidentStartDate) != (Duration * 1000 * 60)")