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,18 +74,21 @@ 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 startTime = moment(task.startTime)
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()
} }
}
const getStartDate = function (prevTime, dateFormat, str) { const getStartDate = function (prevTime, dateFormat, str) {
str = str.trim() str = str.trim()