mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
resolve PR comments
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) {
|
||||
|
@@ -554,14 +554,12 @@ export const draw = function (text, id, version, diagObj) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedExcludes = excludes.map((d) => dayjs(d).format('YYYY-MM-DD'));
|
||||
const normalizedIncludes = includes.map((d) => dayjs(d).format('YYYY-MM-DD'));
|
||||
const dateFormat = diagObj.db.getDateFormat();
|
||||
const excludeRanges = [];
|
||||
let range = null;
|
||||
let d = dayjs(minTime);
|
||||
while (d.valueOf() <= maxTime) {
|
||||
const dStr = d.format('YYYY-MM-DD');
|
||||
if (normalizedExcludes.includes(dStr) && !normalizedIncludes.includes(dStr)) {
|
||||
if (diagObj.db.isInvalidDate(d, dateFormat, excludes, includes)) {
|
||||
if (!range) {
|
||||
range = {
|
||||
start: d,
|
||||
|
Reference in New Issue
Block a user