jsgantt-improved icon indicating copy to clipboard operation
jsgantt-improved copied to clipboard

Change duration format

Open rhuanbarreto opened this issue 4 years ago • 5 comments

Describe the solution you'd like I want to display the duration in the column in hours instead of days.

rhuanbarreto avatar Nov 30 '20 10:11 rhuanbarreto

I think this is dup to https://github.com/jsGanttImproved/jsgantt-improved/issues/253#issuecomment-529994760 right?

mariohmol avatar Nov 30 '20 22:11 mariohmol

No. I don't want an hour view. I want the duration on the column to be shown in hours instead of days, weeks or months depending on the view mode.

rhuanbarreto avatar Nov 30 '20 22:11 rhuanbarreto

Makes sense, so in the day view, when the duration is less than a day, show the duration in hours.

is this correct?

mariohmol avatar Nov 30 '20 22:11 mariohmol

I want to have a fixed duration format independent of view. In my case, all tasks are counted in hours, so in day, week, month and quarter view, the duration will display the value I sent in hours.

rhuanbarreto avatar Nov 30 '20 22:11 rhuanbarreto

I see.. well.. this should not be hard to implement

  1. create a new option for the gantchart will include a durationFormat. https://github.com/jsGanttImproved/jsgantt-improved/blob/master/src/options.ts#L77

  2. You can make a logic here using this durationFormat to change how it calculates: https://github.com/jsGanttImproved/jsgantt-improved/blob/master/src/task.ts#L249

  3. include the hour format here https://github.com/jsGanttImproved/jsgantt-improved/blob/master/src/task.ts#L263

mariohmol avatar Nov 30 '20 22:11 mariohmol