drawio_mermaid_plugin icon indicating copy to clipboard operation
drawio_mermaid_plugin copied to clipboard

Mermaid Gantt Chart doesn't use specified activity date

Open i2ocketguy opened this issue 4 years ago • 6 comments

Working with the Draw.io Integration Mermaid plugin (v0.1.4) in VS Code (v1.57.1) to make Gantt charts, when applying the mermaid edits with an activity's specified start date, this start date appears to be ignored and the activity starts on the current (today's) date. See images and process below:

New Draw.io file and choosing the default Mermaid Gantt Chart template.

choosing_mermaid_gantt

Loading the default Gantt Chart. Notice that the date shown in the activities list uses today's date, 7/04/2021.

default_mermaid_gantt

Diving into the Mermaid code, the activities clearly define start dates in the year 2017. However, after applying this set up, the start date using today's date is not changed. It appears that the activities' start dates are ignored.

mermaid_gantt_code

i2ocketguy avatar Jul 04 '21 23:07 i2ocketguy

seems to be an issue with mermaid itself. will update the mermaid version and see if this fixes the bug

nopeslide avatar Jul 08 '21 08:07 nopeslide

@i2ocketguy could you check if your problem still exists in the new version?

nopeslide avatar Oct 23 '21 12:10 nopeslide

Hi nopeslide,

The problem does still seem to persist while using Draw.io Integration Mermaid plugin (v0.1.5) in VS Code (v1.62.2). I think I've narrowed down the issue to the start date syntax itself and the use of the "dateFormat" mermaid tag. Using the date format of MM-DD-YYYY, everything seems to work so long as the dateFormat tag is not used. However, if I do use the dateFormat tag and try to input dates of YYYY-MM-DD, the start date is ignored if the day is is given as two digits. For instance, when I have the example below (taken from the mermaid documentation/ examples)

gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD
    section Section
    A task :a1, 2014-01-01, 30d
    Another task:after a1  , 20d
    section Another
    Task in sec :2014-01-12  , 12d
    another task :24d

the start dates all begin on today's date. See example

image

Then, if I remove the dateFormat tag and change the dates to MM-DD-YYYY format, it works. It is important to note that so long as I keep the day to single digits (1-9), then with the dateFormat tag, things are shown correctly. But if I try to represent the day with two digits, like "01, 25, etc" the specified start date is ignored.

Removing the dateFormat tag and using MM-DD-YYYY format:

gantt
    title A Gantt Diagram
    section Section
    A task:a1, 01-01-2014, 30d
    Another task:after a1  , 20d
    section Another
    Task in sec: 01-12-2014 , 12d
    another task: 24d

image

So to summarize, there seems to be an issue with using "dateFormat" and any other date format other than MM-DD-YYYY? At least from what I have tried/ tested.

i2ocketguy avatar Oct 23 '21 16:10 i2ocketguy

I'm irritated. the mermaid live editor renders it correctly. my plugin (should be the same mermaid version) renders it wrong

nopeslide avatar Oct 24 '21 10:10 nopeslide

even more irritating is the fact, that the drawio-desktop plugin works fine, but not the wrapper for vscode-drawio, which essentially just includes the drawio-desktop plugin

nopeslide avatar Oct 24 '21 13:10 nopeslide