Commit c6a6bd2b authored by Daniel Weisser's avatar Daniel Weisser
Browse files

Start parsing from longest string (max 5)

parent 0a54f6e4
......@@ -30,7 +30,7 @@ SugarDueExtension.prototype.parsingFunction = function (line) {
var match = null;
// Try to parse a valid date until the end of the text
for (var i = 1; i <= words.length; i++) {
for (var i = Math.max(5, words.length); i > 0; i--) {
match = words.slice(0, i).join(" ");
dueDate = Sugar.Date.create(match);
if (Sugar.Date.isValid(dueDate)) {
......
Supports Markdown
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