diff --git a/.gitignore b/.gitignore index a0825f7b..118ccc89 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ tmp/ # css is compiled from scss in /styles public/main.css +package-lock.json diff --git a/lib/parse/promise.js b/lib/parse/promise.js index f21afac9..5f5bdbe9 100644 --- a/lib/parse/promise.js +++ b/lib/parse/promise.js @@ -30,7 +30,17 @@ export const parsePromise = ({ const { tini, tdue: dueDate, tfin } = promise const text = parseText({ text: urtext }) - const { eventTitle, isAllDay, startDate } = parseSherlock({ text, timezone }) + let { eventTitle, isAllDay, startDate } = parseSherlock({ text, timezone }) + + if ( moment(startDate).isBefore(moment().subtract(1, 'years')) ) { +<<<<<<< HEAD + log.warn('parsePromise rejected, past due date:', startDate) + startDate = null // clear startDate if more than a year ago +======= + log.debug('Caught and fixed promise with old parsed start date of:', startDate) + startDate = null; // clear startDate if more than a year ago +>>>>>>> 9cc7fb723ff8ffe9392ad605ffe3ae22362c6d63 + } const tdue = dueDate || (startDate && moment(startDate) .add(+isAllDay, 'days') // turn boolean into 1 or 0