Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,891
Community Members
 
Community Events
176
Community Groups

Bar duration in roadmap-planner storage format

Dear all,

 

I'd like to automatically update roadmap-planner macros via the REST API. However, it seems that the choice of representation is a bit roundabout:

{
// ...
lanes: [
{
title: 'Some Lane',
color: { bar: 'red', count: 1, lane: 'blue', text: 'black' },
bars: [
{
title: 'Some Bar',
description: '',
startDate: '2017-01-01T00:00:00.000Z',
duration: 3.456, // <========= PROBLEM
rowIndex: 0,
id: '57ab0b36-7ba5-4f89-957b-d83bd5ff7e3f'
},
// ...
]
},
// ...
],
// ...
}

The problem for me with this format is that the duration needs to be specified either as a fraction of weeks or months, depending on the roadmap display option.

However, if selecting months, given a start and end date, it seems to be quite non-trivial to compute the months fraction, since not all months are equal length. If I understand the plugin source code it looks like this calculation is based on the milliseconds in a month.

So, here the questions:

  • Anybody got experience automatically updating the roadmap? How do you handle the duration?
  • Isn't this model overcomplicating things? Wouldn't it be much more natural to specify an end-date? Would such a feature-request in the issue tracker have a chance?

1 comment

Besides my questions which I still hold up, here is a function which seems to accurately compute the months duration as expected by Confluence with the help of moment.js:

function countMonths(start, end)
{
  var s = moment(start);
  var e = moment(end);

  var sbom = moment(start).startOf('month');
  var seom = moment(start).endOf('month');

  var ebom = moment(end).startOf('month');
  var eeom = moment(end).endOf('month');

  var count = Math.round(ebom.diff(seom, 'months', true)) + 1;
  count += seom.diff(s) / seom.diff(sbom);
  count += e.diff(eeom) / eeom.diff(ebom);
  return count;
}

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events