Calculating period field error

Hi, i have strange problem with Period type field.

I've created such a workflow to track time of issue:

action: function(ctx) {
var issue = ctx.issue;
var field = issue.fields;
var est = field["Планируемая дата устранения"] - field["Дата выявления"];
field.Estimation = timeDate.toPeriod(est);
});

When i check value of est variable - it's correct in ms = 144000000, and correct in period = PT40H, but when i put  this var in field i want, it changes to 1w.

 

0
1 comment
Official comment

Hi,

This happens because period takes into consideration your working days and business hours. SO, having 5 working days, each of 8 hours, you will have 40 hours as one week. 

To avoid this, you should either set your working days and business hours as 24/7 (all days are working ones, working day duration is 24 hours) or adjust your script to take into account your working hours. 

Hope it helps. 

Please sign in to leave a comment.