mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Simplify to codeclimate
This commit is contained in:
parent
6e846ac3e5
commit
8ce658416b
@ -73,8 +73,12 @@ const isInvalidDate = function (date, dateFormat, excludes) {
|
||||
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
|
||||
fixTaskDates(task, dateFormat, excludes)
|
||||
}
|
||||
|
||||
const fixTaskDates = function (task, dateFormat, excludes) {
|
||||
let startTime = moment(task.startTime)
|
||||
startTime.add(1, 'd')
|
||||
let endTime = moment(task.endTime)
|
||||
@ -239,7 +243,7 @@ const compileData = function (prevTask, dataStr) {
|
||||
if (endTimeData) {
|
||||
task.endTime = getEndDate(task.startTime, dateFormat, endTimeData)
|
||||
task.manualEndTime = endTimeData === moment(task.endTime).format(dateFormat.trim())
|
||||
fixTaskDates(task, dateFormat, excludes)
|
||||
checkTaskDates(task, dateFormat, excludes)
|
||||
}
|
||||
|
||||
return task
|
||||
@ -378,7 +382,7 @@ const compileTasks = function () {
|
||||
if (rawTasks[pos].endTime) {
|
||||
rawTasks[pos].processed = true
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user