mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-03 23:56:44 +02:00
Standard
This commit is contained in:
@@ -74,7 +74,7 @@ const isInvalidDate = function (date, dateFormat, excludes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fixTaskDates = function (task, dateFormat, excludes) {
|
const fixTaskDates = function (task, dateFormat, excludes) {
|
||||||
if (excludes.length && ! task.manualEndTime) {
|
if (excludes.length && !task.manualEndTime) {
|
||||||
let startTime = moment(task.startTime).add(1, 'd')
|
let startTime = moment(task.startTime).add(1, 'd')
|
||||||
let endTime = moment(task.endTime)
|
let endTime = moment(task.endTime)
|
||||||
while (startTime.date() <= endTime.date()) {
|
while (startTime.date() <= endTime.date()) {
|
||||||
@@ -233,7 +233,7 @@ const compileData = function (prevTask, dataStr) {
|
|||||||
|
|
||||||
if (endTimeData) {
|
if (endTimeData) {
|
||||||
task.endTime = getEndDate(task.startTime, dateFormat, endTimeData)
|
task.endTime = getEndDate(task.startTime, dateFormat, endTimeData)
|
||||||
task.manualEndTime = endTimeData == moment(task.endTime).format(dateFormat.trim())
|
task.manualEndTime = endTimeData === moment(task.endTime).format(dateFormat.trim())
|
||||||
fixTaskDates(task, dateFormat, excludes)
|
fixTaskDates(task, dateFormat, excludes)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,8 +371,8 @@ const compileTasks = function () {
|
|||||||
rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data)
|
rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data)
|
||||||
if (rawTasks[pos].endTime) {
|
if (rawTasks[pos].endTime) {
|
||||||
rawTasks[pos].processed = true
|
rawTasks[pos].processed = true
|
||||||
rawTasks[pos].manualEndTime = rawTasks[pos].raw.endTime.data == moment(rawTasks[pos].endTime).format(dateFormat.trim());
|
rawTasks[pos].manualEndTime = rawTasks[pos].raw.endTime.data === moment(rawTasks[pos].endTime).format(dateFormat.trim())
|
||||||
fixTaskDates(rawTasks[pos], dateFormat, excludes);
|
fixTaskDates(rawTasks[pos], dateFormat, excludes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -208,6 +208,5 @@ describe('when using the ganttDb', function () {
|
|||||||
expect(tasks[4].endTime).toEqual(moment('2019-02-21', 'YYYY-MM-DD').toDate())
|
expect(tasks[4].endTime).toEqual(moment('2019-02-21', 'YYYY-MM-DD').toDate())
|
||||||
expect(tasks[4].id).toEqual('id5')
|
expect(tasks[4].id).toEqual('id5')
|
||||||
expect(tasks[4].task).toEqual('test5')
|
expect(tasks[4].task).toEqual('test5')
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user