mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 09:44:51 +01:00
Simplify to codeclimate
This commit is contained in:
@@ -73,8 +73,12 @@ const isInvalidDate = function (date, dateFormat, excludes) {
|
|||||||
return excludes.indexOf(date.format(dateFormat.trim())) >= 0
|
return excludes.indexOf(date.format(dateFormat.trim())) >= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const fixTaskDates = function (task, dateFormat, excludes) {
|
const checkTaskDates = function (task, dateFormat, excludes) {
|
||||||
if (!excludes.length || task.manualEndTime) return
|
if (!excludes.length || task.manualEndTime) return
|
||||||
|
fixTaskDates(task, dateFormat, excludes)
|
||||||
|
}
|
||||||
|
|
||||||
|
const fixTaskDates = function (task, dateFormat, excludes) {
|
||||||
let startTime = moment(task.startTime)
|
let startTime = moment(task.startTime)
|
||||||
startTime.add(1, 'd')
|
startTime.add(1, 'd')
|
||||||
let endTime = moment(task.endTime)
|
let endTime = moment(task.endTime)
|
||||||
@@ -239,7 +243,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)
|
checkTaskDates(task, dateFormat, excludes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return task
|
return task
|
||||||
@@ -378,7 +382,7 @@ const compileTasks = function () {
|
|||||||
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)
|
checkTaskDates(rawTasks[pos], dateFormat, excludes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user