Skip to content

Commit

Permalink
Add support for threshold dates in filter query expressions (#197)
Browse files Browse the repository at this point in the history
* clean out the non-source file filterlang.mjs which should not be in repo

* add filter query support for threshold dates

* support ISO dates with single digit month, day and intervals with no number, just unit

* if there are command-line args, use first one as todo file name

* weisserd's fix to sugar due date extension to force future due dates

* handle t: (threshold date) tag in recurrences
  • Loading branch information
zerodat authored Jul 12, 2021
1 parent 623441b commit 8fe8508
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 2,092 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ package-lock.json
.vscode/
.stylelintrc.json
src/css/
src/js/filterlang.mjs
6 changes: 3 additions & 3 deletions src/js/datePicker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { translations, userData } from "../render.js";
import { _paq } from "./matomo.mjs";
import { resizeInput } from "./form.mjs";
import { RecExtension, SugarDueExtension } from "./todotxtExtensions.mjs";
import { RecExtension, SugarDueExtension, ThresholdExtension } from "./todotxtExtensions.mjs";
import "../../node_modules/jstodotxt/jsTodoExtensions.js";
import "../../node_modules/jstodotxt/jsTodoTxt.js";
import Datepicker from "../../node_modules/vanillajs-datepicker/js/Datepicker.js";
Expand All @@ -21,7 +21,7 @@ datePickerInput.addEventListener("changeDate", function (e) {
// we only update the object if there is a date selected. In case of a refresh it would throw an error otherwise
if(e.detail.date) {
// generate the object on what is written into input, so we don't overwrite previous inputs of user
let todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new SugarDueExtension(), new HiddenExtension(), new RecExtension() ]);
let todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new SugarDueExtension(), new HiddenExtension(), new RecExtension(), new ThresholdExtension() ]);
todo.due = new Date(e.detail.date);
todo.dueString = new Date(e.detail.date.getTime() - (e.detail.date.getTimezoneOffset() * 60000 )).toISOString().split("T")[0];
// if suggestion box was open, it needs to be closed
Expand Down Expand Up @@ -53,7 +53,7 @@ const datePicker = new Datepicker(datePickerInput, {
}
});
document.querySelector(".datepicker .clear-btn").onclick = function() {
let todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new SugarDueExtension(), new HiddenExtension(), new RecExtension() ]);
let todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new SugarDueExtension(), new HiddenExtension(), new RecExtension(), new ThresholdExtension() ]);
todo.due = undefined;
todo.dueString = undefined;
document.getElementById("modalFormInput").value = todo.toString();
Expand Down
Loading

0 comments on commit 8fe8508

Please sign in to comment.