Mermaid Gantt will not accept variable for task end date

I have a Mermaid Gantt chart that plots correctly when hard coded start and end dates are used for a task.
I can substitute a variable for the start date.
If a variable is used for the end date, the bar fails to plot. The label and the rest of the chart display properly.

Steps to reproduce

  1. Set up a note with two user defined properties YearOpen and YearClose as date types with valid dates. Values I used given below.
  2. Modify line 25 (task 1 of section 1) of code below to see effect.
  3. Chart will plot properly using variable for start date of task. See first screenshot below.
  4. Change hard coded end date of 2012-03-02 to variable ${dClose}. Plot will not show bar. See second screenshot below.
  5. Revert both dates to hard code to confirm. Chart will plot properly.
//Section Names
const vS1 ="Dolly Varden"
const vS2 = "Caledon"

const vt1 = "First Task"
const vt2 = "2nd Task"
const vt3 = "Task at Caledon "
const vt4 = "A Milestone"

//Assign dates to variables.
//Pick up from a user defined property currently set to 2012-01-01
const dOpen= dv.current().YearOpen 
//Pick up from a user defined property currently set to 2012-03-02
const dClose= dv.current().YearClose 

dv.paragraph("```mermaid" +
     title A Gantt Diagram\n
     dateFormat YYYY-MM-DD\n
     tickInterval 1month
     axisFormat %y-%m
     section ${vS1}\n
        ${vt1}  :a1,${dOpen}, 2012-03-02\n
        ${vt2}  :after a1, 20d\n
        Critical Task    :crit, 24d
     section ${vS2}\n
        ${vt3} :2012-03-12, 12d\n
        another task    :24d\n
        ${vt4} :milestone, 2012-05-15\n`


Obsidian version: v1.6.3
Installer version: v1.5.11
Operating system: Windows 10 Pro 10.0.22631
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 9
Plugins enabled: 2
1: Dataview v0.5.66
2: Mermaid Tools v1.1.3

Additional information

Gantt chart with correct display.

Gantt chart with missing task bar.

we don’t take bug reports involving third party plugins. moved to help.

Third party plugin? Mermaid is neither a community plugin, nor a core plugin.

Mermaid is shipped as an integral part of Obsidian. If the Mermaid part of Obsidian doesn’t work as specified, it’s an Obsidian problem.

If you want users think of Mermaid as a plugin, please package Obsidian as a plugin.

if you’re rendering markdown with dataview already why not resolve variables as strings in the dv.paragraph so it’s resolved before you get to mermaid

Ok. Sorry. I’m new at Obsidian and not a programmer.

The user information for Mermaid Tools 1.1.3 which I installed from Community Plugin in settings says:
:warning: Please note that rendering Mermaid is Obsidian’s feature, and not implemented by this plugin.
This plugin has no control over how Mermaid is rendered .
All bugs concerning rendering of diagrams should be posted to official forums.”

So I thought it was appropriate to post to Obsidian.

Is there another forum specifically for Mermaid Tools I should have posted to?
If so, could you please the information to reflect that.

1 Like

Thank you. I’m not a programmer but I’ll read up on your points and see if I can implement that.

I agree that Mermaid bugs are Obsidian bugs.

But your original post doesn’t show code that Mermaid alone could render. It’s a script that requires some third party plugin to run.

Could you provide a version of the code that is only Mermaid, so that we can check if this is actually a Mermaid rendering problem?

I only have the script. I have just discovered Live Editor, so once I learn how to use it I can try making a Mermaid only version.