modify gitignore

This commit is contained in:
safwansamsudeen 2024-12-02 15:53:50 +05:30
parent 8152f5ad17
commit d87022eb3f
2 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View File

@ -31,3 +31,4 @@ node_modules
.DS_Store .DS_Store
gh-pages gh-pages
feedback.md

View File

@ -81,13 +81,13 @@ export default class Gantt {
// prepare tasks // prepare tasks
this.tasks = tasks this.tasks = tasks
.map((task, i) => { .map((task, i) => {
// invalid flag if (!task.start) {
if (!task.start || !task.end) { console.error(
console.error(`task "${task.id}" doesn't have valid dates`); `task "${task.id}" doesn't have a start date`,
);
return false; return false;
} }
// convert to Date objects
task._start = date_utils.parse(task.start); task._start = date_utils.parse(task.start);
if (task.end === undefined && task.duration !== undefined) { if (task.end === undefined && task.duration !== undefined) {
task.end = task._start; task.end = task._start;
@ -99,6 +99,10 @@ export default class Gantt {
task.end = date_utils.add(task.end, duration, scale); task.end = date_utils.add(task.end, duration, scale);
}); });
} }
if (!task.end) {
console.error(`task "${task.id}" doesn't have an end date`);
return false;
}
task._end = date_utils.parse(task.end); task._end = date_utils.parse(task.end);
let diff = date_utils.diff(task._end, task._start, 'year'); let diff = date_utils.diff(task._end, task._start, 'year');