Skip to content

Commit

Permalink
feat: remove due/defer date from note once used
Browse files Browse the repository at this point in the history
  • Loading branch information
ksalzke committed Oct 22, 2021
1 parent 0aa6186 commit 4c0a254
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Resources/templateLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,14 @@
tasksWithDueDates.forEach(task => {
const dueString = task.note.match(/\$DUE=(.*?)$/m)[1]
task.dueDate = Formatter.Date.withStyle(Formatter.Date.Style.Full).dateFromString(dueString)
task.note = task.note.replace(task.note.match(/\$DUE=(.*?)$/m)[0], '')
})

const tasksWithDeferDates = [created, ...created.flattenedTasks].filter(task => task.note.includes('$DEFER='))
tasksWithDeferDates.forEach(task => {
const deferString = task.note.match(/\$DEFER=(.*?)$/m)[1]
task.deferDate = Formatter.Date.withStyle(Formatter.Date.Style.Full).dateFromString(deferString)
task.note = task.note.replace(task.note.match(/\$DEFER=(.*?)$/m)[0], '')
})

return created
Expand Down

0 comments on commit 4c0a254

Please sign in to comment.