mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
72.45k stars 6.6k forks source link

Dates in `excludes` are ignored in Gantt diagrams #3761

Open gerukin opened 2 years ago

gerukin commented 2 years ago

Description

In Gantt diagrams, while excluding Saturdays or Weekends works, specific dates (ex: 2022-11-10) are ignored. Both with no styling and with no impact on task end dates.

Steps to reproduce

  1. Add a Gantt diagram with an excluded date:

    ```mermaid
    gantt
      excludes 2022-11-08
    
      Task :2022-11-06, 4d
    ```mermaid
    gantt
      excludes 2022-11-08
    
      Task :2022-11-06, 4d
  2. Unexpectedly matches the same diagram without the excluded date:
    ```mermaid
    gantt
      Task :2022-11-06, 4d
    ```mermaid
    gantt
      Task :2022-11-06, 4d

Screenshots

No response

Code Sample

gantt
  excludes 2022-11-08

  Task :2022-11-06, 4d

Setup

Desktop

Additional Context

Live editor (with date):

gerukin commented 1 year ago

Additional context...

It does work if the date format is explicitly given (even if using the default format):

gantt
    axisFormat %m-%d
    dateFormat YYYY-MM-DD
    excludes 2023-02-23, Weekends

    Span :active, span, 2023-02-22, 2d
    A :active, a, 2023-02-22, 1d
    B :after a, 2d
gantt
    axisFormat %m-%d
    dateFormat YYYY-MM-DD
    excludes 2023-02-23, Weekends

    Span :active, span, 2023-02-22, 2d
    A :active, a, 2023-02-22, 1d
    B :after a, 2d

Even there, there is still a failure case, when the start of the task is set to the excluded date, which is no longer skipped:

gantt
    axisFormat %m-%d
    dateFormat YYYY-MM-DD
    excludes 2023-02-23, Weekends

    Span :active, span, 2023-02-23, 2d