Unverified Commit aa5051d0 authored by Daniel Weisser's avatar Daniel Weisser Committed by GitHub
Browse files

Interpret ambigous dates - ransome1/sleek#199 (#200)

parent 0284c430
...@@ -33,7 +33,7 @@ SugarDueExtension.prototype.parsingFunction = function (line) { ...@@ -33,7 +33,7 @@ SugarDueExtension.prototype.parsingFunction = function (line) {
// Try to parse a valid date until the end of the text // Try to parse a valid date until the end of the text
for (var i = Math.max(5, words.length); i > 0; i--) { for (var i = Math.max(5, words.length); i > 0; i--) {
match = words.slice(0, i).join(" "); match = words.slice(0, i).join(" ");
dueDate = Sugar.Date.create(match); dueDate = Sugar.Date.create(match, {future: true});
if (Sugar.Date.isValid(dueDate)) { if (Sugar.Date.isValid(dueDate)) {
return [dueDate, line.replace("due:" + match, ''), Sugar.Date.format(dueDate, '%Y-%m-%d')]; return [dueDate, line.replace("due:" + match, ''), Sugar.Date.format(dueDate, '%Y-%m-%d')];
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment