Complexity

This commit is contained in:
João Paulo Poffo
2019-02-07 11:27:01 -02:00
parent a99b31a61d
commit 5bfddcc444

View File

@@ -74,17 +74,20 @@ 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) return;
let startTime = moment(task.startTime).add(1, 'd')
let endTime = moment(task.endTime) let startTime = moment(task.startTime)
while (startTime.date() <= endTime.date()) { startTime.add(1, 'd')
if (isInvalidDate(startTime, dateFormat, excludes)) { let endTime = moment(task.endTime)
endTime.add(1, 'd')
} while (startTime.date() <= endTime.date()) {
startTime.add(1, 'd') if (isInvalidDate(startTime, dateFormat, excludes)) {
endTime.add(1, 'd')
} }
task.endTime = endTime.toDate() startTime.add(1, 'd')
} }
task.endTime = endTime.toDate()
} }
const getStartDate = function (prevTime, dateFormat, str) { const getStartDate = function (prevTime, dateFormat, str) {