Calculated Text Field with not expected results.

Issue #626 resolved
Tim Kopperud created an issue

Not sure if this is a bug or wrong use

I have created a Calculated text field with the following configuration:

Parced text.png

config.png

It gives this results which seems wrong. Days turns to weeks which I don't expect. If field 13505 is the same day as current date it seems to give expected result. Do I use the date calculation for shortFormatWorkDuration wrong?

19.png

20.png

22.png

23.png

24.png

Comments (9)

  1. Fidel Castro Armario repo owner

    Hi @Timkopperud,

    Function shortFormatWorkDuration() uses work day instead of natural day. Work day duration is defined in your time tracking settings (Administration > Issues > Time tracking). If your work day is 8 hours, each 8 hours are shown as a whole day.

    If you want to calculate the natural duration (i.e., 1 day = 24 hours), then use function shortFormatDuration().

    BTW, if you want to show a duration you can also use a Calculated Number Field with the following formula: {00057} - {13505} and select Duration in the display settings.

  2. Tim Kopperud reporter

    Hi @fcarmario

    Thanks for swift replay.

    I want work duration. But from what I gets (ref the result list) is that the duration from May 19th to May 24th (now) gives 3 weeks and 12 minutes. The day after May 20th to 24th (now) gives 2 weeks 2 days 12 minutes.

  3. Fidel Castro Armario repo owner

    Please, tell me your time tracking settings:

    • Number of hours per day.
    • Number of days per week.
  4. Fidel Castro Armario repo owner

    Hi @Timkopperud,

    The calculations are correct:

    1. From 19 May 2017 9:00 to 24 May 2017 9:12 is 5 natural days and 12 minutes: 5 * 24 hours + 12 minutes = 120 hours + 12 minutes = 124 / 8 days + 12 minutes = 15 days + 12 minutes = 15 / 5 weeks + 12 minutes = 3 weeks + 12 minutes.

    2. From 20 May 2017 9:00 to 24 May 2017 9:12 is 4 natural days and 12 minutes: 4 * 24 hours + 12 minutes = 96 hours + 12 minutes = 96 / 8 days + 12 minutes = 12 days + 12 minutes = 12 / 5 weeks + 12 minutes = 2.4 weeks + 12 minutes = 2 weeks + 0.4 * 5 days + 12 minutes = 2 weeks + 2 days + 12 minutes.

  5. Tim Kopperud reporter

    I see, then I have misunderstood how work duration worked. I was thinking in "reverse", that it actually subtracted the non-working hours. I now understand it converts the duration to actual work time.

    Thanks for swift and good support.

    I understand based on this in Google groups that you are in progress of releasing an actual work hours calculation which might solve what I'm aiming for here (I try to calculate SLA breach). I will wait for this feature.

  6. Fidel Castro Armario repo owner

    Hi @Timkopperud,

    I have made available 2.2.39_beta_5 which adds a very powerful support for custom schedules.

    You can define a custom schedule using Schedule Definition Grammar (SDG), and then do math-time calculations using functions timeDifference(highTime, lowTime, schedule, timezone) and addTime(base, offset, schedule, timezone).

    You can enter your custom schedule definition at Administration > Add-ons > JIRA WORKFLOW TOOLBOX > Schedules.

    Please, let me know if you need any help to implement your requirements.

  7. Fidel Castro Armario repo owner

    Resolved by just released version 2.2.39.

    Please, reopen the issue if you need help to implement your time calculations using the new feature.

  8. Log in to comment