Skip to content

Commit

Permalink
Add feedback for invalid due-date.
Browse files Browse the repository at this point in the history
Fix #88
  • Loading branch information
Thor77 committed Sep 28, 2016
1 parent 5e2dcf1 commit f168d51
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wunderline-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ function main () {
dueDate = moment().add(1, 'day').format('YYYY-MM-DD')
}

if (app.due && /\d{4}\-\d{2}\-\d{2}/.test(app.due)) {
dueDate = app.due
if (app.due) {
if (/\d{4}\-\d{2}\-\d{2}/.test(app.due)) {
dueDate = app.due
} else {
console.error('Invalid due date!')
process.exit(1)
}
}

if (app.starred) {
Expand Down

0 comments on commit f168d51

Please sign in to comment.