mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Starting task after milestone doesn't work with >1 milestone

Open jodavaho opened this issue 2 years ago • 1 comments

Description

Here's a gantt that starts two tasks after a milestone, and another task after a second milestone

gantt
    title  plan 2023
    dateFormat YYYY-MM-DD
    axisFormat %m/%y
    excludes weekends

    M1, :milestone, 2023-01-01, m1
    M2, :milestone, 2023-02-01, m2

    Task 1 :t1, after m1, 30d
    Task 2 :t2, after m1, 15d
    Task 3 :t3, after m2, 10d

image

But if I change task 3 to start after m1, everything is fine:

image

Now lets start everything after m2

gantt
    title  plan 2023
    dateFormat YYYY-MM-DD
    axisFormat %m/%y
    excludes weekends

    M1, :milestone, 2023-01-01, m1
    M2, :milestone, 2023-02-01, m2

    Task 1 :t1, after m2, 30d
    Task 2 :t2, after m2, 15d
    Task 3 :t3, after m2, 10d

image

Steps to reproduce

See above.

Screenshots

Above.

Code Sample

Above.

Setup

Mermaid.live: https://mermaid.live/edit#pako:eNptkLFqwzAQhl9FCLLJ1JbporWmm6DQLgUth3VORSQ5WGeaEPLuvUQpuNBDg_i_Dx36L3KcPUoj95CJXBY8FCiisG8v4hghC93qvgIPhK_zkoDEJ09jbTMMFcEplAfapafduaZ4GuPqsYhvxANmX1yuwHZKmBQiFpozqvuOpu34KJG6h6P_c3R19O9LH1AOohOGOIWJcGGmRN_6DdaM9RZ3z1vcM-7_4NZLJRPyd4Lnbi432Un6woROGr56nGCN5KTLV1Zhpfn9nEdpaFlRyfV4q2oIsF8gSTNBLJyiDzQvtvZ9r_36AwEdcy8

Additional Context

Also broken on github, gitlab. Didn't try CLI version.

jodavaho avatar Feb 21 '23 13:02 jodavaho

There's perhaps a few things going on:

  1. There' s a logic error in the parser
  2. There's an undiagnosed error in my syntax (no error msg)
  3. There's an undocumented "feature" going on here

For example, it works if I do this:

title  plan 2023
    dateFormat YYYY-MM-DD
    axisFormat %m/%y
    excludes weekends

    M1, :milestone, m1, 2023-01-01,
    M2, :milestone, m2, 2023-02-01,

    Task 1 :t1, after m1, 30d
    Task 2 :t2, after m1, 15d
    Task 3 :t3, after m2, 10d

Why do I need a comma on the end? No idea.

jodavaho avatar Feb 21 '23 13:02 jodavaho

An indicator might be that the syntax of milestones requires a "duration":

As you may notice, the exact location of the milestone is determined by the initial date for the milestone and the "duration" of the task

Final milestone : milestone, m2, 18:14, 2min

Thus, the correct code should be

gantt
    title  plan 2023
    dateFormat YYYY-MM-DD
    %%% axisFormat YYYY-MM-DD
    excludes weekends

    M1 :milestone, m1, 2023-01-01, 0d
    M2 :milestone, m2, 2023-02-01, 0d

    Task 1 :t1, after m1, 30d
    Task 2 :t2, after m1, 15d
    Task 3 :t3, after m2, 10d

koppor avatar Feb 28 '23 19:02 koppor