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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Confluence

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

494 views 18 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you