mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
Merge pull request #6734 from mermaid-js/6730-gantt-excludes-datetime-format
6730: Fix excluded dates ignored in YYYY-MM-DD HH:mm:ss date format in gantt diagram
This commit is contained in:
@@ -167,7 +167,10 @@ export const getTasks = function () {
|
||||
};
|
||||
|
||||
export const isInvalidDate = function (date, dateFormat, excludes, includes) {
|
||||
if (includes.includes(date.format(dateFormat.trim()))) {
|
||||
const formattedDate = date.format(dateFormat.trim());
|
||||
const dateOnly = date.format('YYYY-MM-DD');
|
||||
|
||||
if (includes.includes(formattedDate) || includes.includes(dateOnly)) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
@@ -180,7 +183,7 @@ export const isInvalidDate = function (date, dateFormat, excludes, includes) {
|
||||
if (excludes.includes(date.format('dddd').toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
return excludes.includes(date.format(dateFormat.trim()));
|
||||
return excludes.includes(formattedDate) || excludes.includes(dateOnly);
|
||||
};
|
||||
|
||||
export const setWeekday = function (txt) {
|
||||
|
@@ -581,17 +581,11 @@ export const draw = function (text, id, version, diagObj) {
|
||||
|
||||
rectangles
|
||||
.append('rect')
|
||||
.attr('id', function (d) {
|
||||
return 'exclude-' + d.start.format('YYYY-MM-DD');
|
||||
})
|
||||
.attr('x', function (d) {
|
||||
return timeScale(d.start) + theSidePad;
|
||||
})
|
||||
.attr('id', (d) => 'exclude-' + d.start.format('YYYY-MM-DD'))
|
||||
.attr('x', (d) => timeScale(d.start.startOf('day')) + theSidePad)
|
||||
.attr('y', conf.gridLineStartPadding)
|
||||
.attr('width', function (d) {
|
||||
const renderEnd = d.end.add(1, 'day');
|
||||
return timeScale(renderEnd) - timeScale(d.start);
|
||||
})
|
||||
.attr('width', (d) => timeScale(d.end.endOf('day')) - timeScale(d.start.startOf('day')))
|
||||
|
||||
.attr('height', h - theTopPad - conf.gridLineStartPadding)
|
||||
.attr('transform-origin', function (d, i) {
|
||||
return (
|
||||
|
Reference in New Issue
Block a user