Commit 65d63e09 authored by ransome1's avatar ransome1
Browse files

Merge branch 'master' into develop

parents cd5ce69f 16609281
......@@ -59,10 +59,11 @@
]
},
"icon": "assets/icons/sleek.icns",
"category": "public.app-category.productivity"
"category": "public.app-category.productivity",
"artifactName": "${productName}-${version}-mac.${ext}"
},
"nsis": {
"artifactName": "${productName}-${version}-Setup.${ext}"
"artifactName": "${productName}-${version}-win-setup.${ext}"
},
"win": {
"target": [
......
......@@ -6,16 +6,27 @@ import { convertDate, isFuture } from "./date.mjs";
function splitRecurrence(recurrence) {
let mul = 1;
let period = recurrence;
let plus = false;
if(recurrence !== undefined && recurrence.length > 1) {
mul = Number(recurrence.substr(0, recurrence.length - 1));
if (recurrence.substr(0,1) == "+") {
plus = true;
if (recurrence.length > 2)
mul = Number(recurrence.substr(1, recurrence.length - 2));
} else {
mul = Number(recurrence.substr(0, recurrence.length - 1));
}
if (mul == 0) {
mul = 1;
}
period = recurrence.substr(-1);
}
return {
mul: mul,
period: period,
plus: plus,
toString: function() {
return this.mul == 1 || this.period === undefined ?
this.period : this.mul + this.period;
this.period : (this.plus ? "+" : "") + this.mul + this.period;
}
};
}
......@@ -27,8 +38,8 @@ function generateRecurrence(todo) {
recurringTodo.completed = null;
// if the item to be duplicated has been completed before the due date, the recurring item needs to be set incomplete again
recurringTodo.date = new Date;
recurringTodo.due = getRecurrenceDate(recurringTodo.date, todo.rec);
recurringTodo.dueString = convertDate(getRecurrenceDate(recurringTodo.date, todo.rec));
recurringTodo.due = getRecurrenceDate(todo.due, todo.rec);
recurringTodo.dueString = convertDate(recurringTodo.due);
// get index of recurring todo
const index = items.objects.map(function(item) {return item.toString().replaceAll(String.fromCharCode(16)," "); }).indexOf(recurringTodo.toString().replaceAll(String.fromCharCode(16)," "));
// only add recurring todo if it is not already in the list
......@@ -47,6 +58,11 @@ function generateRecurrence(todo) {
}
function getRecurrenceDate(due, recurrence) {
let recSplit = splitRecurrence(recurrence);
if (!recSplit.plus) {
// no plus in recurrence expression, so do the default "non-strict" recurrence.
// (Otherwise we will use the previous due date, for strict recurrence.)
due = new Date(); // use today's date as base for recurrence
}
let days = 0;
let months = 0;
switch (recSplit.period) {
......
......@@ -4,7 +4,7 @@ function RecExtension() {
RecExtension.prototype = new TodoTxtExtension();
RecExtension.prototype.parsingFunction = function(line) {
var rec = null;
var recRegex = /rec:([hbdwmy]|[1-9][0-9]*[hbdwmy])/;
var recRegex = /rec:(\+?[0-9]*[hbdwmy])/;
var matchRec = recRegex.exec(line);
if ( matchRec !== null ) {
rec = matchRec[1];
......
......@@ -6128,9 +6128,9 @@ write-file-atomic@^3.0.0:
typedarray-to-buffer "^3.1.5"
ws@^7.2.3, ws@^7.4.4:
version "7.4.5"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.5.tgz#a484dd851e9beb6fdb420027e3885e8ce48986c1"
integrity sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==
version "7.4.6"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==
xdg-basedir@^4.0.0:
version "4.0.0"
......
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