This commit is contained in:
João Paulo Poffo 2019-02-07 12:05:09 -02:00
parent 5bfddcc444
commit 58df72984f

View File

@ -74,19 +74,16 @@ const isInvalidDate = function (date, dateFormat, excludes) {
} }
const fixTaskDates = function (task, dateFormat, excludes) { const fixTaskDates = function (task, dateFormat, excludes) {
if (! excludes.length || task.manualEndTime) return; if (!excludes.length || task.manualEndTime) return
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)
while (startTime.date() <= endTime.date()) { while (startTime.date() <= endTime.date()) {
if (isInvalidDate(startTime, dateFormat, excludes)) { if (isInvalidDate(startTime, dateFormat, excludes)) {
endTime.add(1, 'd') endTime.add(1, 'd')
} }
startTime.add(1, 'd') startTime.add(1, 'd')
} }
task.endTime = endTime.toDate() task.endTime = endTime.toDate()
} }