Gantt Chart Not Showing Correct Date

1.2k Views Asked by At

I want to display a simple gantt chart. The dates are not shown correctly.

gantt
    title Gantt Chart
    dateFormat  YYYY-MM-DD HH-mm-ss
    axisFormat  %Hh%M:%S:%m

    section one
    task_1: task_1, 2020-11-09 11:44:09 ,  10m
    
    section two
    task_2: task_2, 2020-11-09 13:44:09 ,  10m
    task_3: task_3, 2020-11-09 13:54:09 ,  36m

As you can see task_1 starts at 10h25 which is not correct. It should display it at 11:44:09. When I remove the wole dateFormat it does work, but why is this?

Also how can I add up the time like : 5 hours 15 minutes and 8 seconds. Instead of an exact time of 10m?

1

There are 1 best solutions below

0
On

You have to change your dateformat to it matches to your task date inside the section

HH-mm-ss --> HH:mm:ss

gantt
    title Gantt Chart
    dateFormat  YYYY-MM-DD HH:mm:ss
    axisFormat  %Hh%M:%S:%m

    section one
    task_1: task_1, 2020-11-09 11:44:09 ,  10m
    
    section two
    task_2: task_2, 2020-11-09 13:44:09 ,  10m
    task_3: task_3, 2020-11-09 13:54:09 ,  36m

When the date-time format is fine you can add also

section three
    task_4a: task_4a, 2020-11-09 13:45:12 ,  10m
    task_4b: task_4b, 2020-11-09 13:45:12 ,  2020-11-09 13:55:12

which will show two tasks 4a and 4b with the same duration.

I was not able to add minutes or decimal numbers of hours. Sorry.

section decimals
    task_5a: task_5a, 2020-11-09 12:00:00 ,  1h 30m
    task_5b: task_5b, 2020-11-09 12:00:00 ,  90m
    task_5c: task_5c, 2020-11-09 12:00:00 ,  1.5h

Result

  • 1h 30m --> shows just 1 h
  • 90m --> works
  • 1.5h --> not working