Skip to content

Build your personal knowledge base with Trilium Notes

fixed sorting of recent changes

azivner5d4c06a22936
diff --git a/TODO b/TODO
index 8730ffefcd..fd65506013 100644
--- a/TODO
+++ b/TODO
@@ -6,6 +6,12 @@ New features:
deterministic to allow lookup by cipher text
- recent changes - link to note should lead to the revision
- db upgrade / migration
+- db backup into directory
+- recent notes can either go to or add link
+- might do the same thing with alt-j and alt-l
+- ctrl-b nad linkem by mohlo byt goto do notu
+- potencialne nova navigace back - forward
+- javascript editor
Refactorings:
- modularize frontend
@@ -22,6 +28,7 @@ Encryption:
Bugs:
- deleting cloned nodes ends with 500 (probably only on folders)
- Uncaught Error: cannot call methods on fancytree prior to initialization; attempted to call method 'getTree'
+- recent changes sorts 1st october to the end
Others:
- dates should be stored in UTC to work correctly with time zones
diff --git a/static/js/recent_changes.js b/static/js/recent_changes.js
index 7adc5d3d4b..ae093cf0d4 100644
--- a/static/js/recent_changes.js
+++ b/static/js/recent_changes.js
@@ -21,26 +21,33 @@ $(document).bind('keydown', 'alt+r', function() {
}
}
- const dateModified = getDateFromTS(row.date_modified);
- const formattedDate = formatDate(dateModified);
+ const dateDay = getDateFromTS(row.date_modified);
+ dateDay.setHours(0);
+ dateDay.setMinutes(0);
+ dateDay.setSeconds(0);
+ dateDay.setMilliseconds(0);
- if (!groupedByDate[formattedDate]) {
- groupedByDate[formattedDate] = [];
+ const dateDayTS = dateDay.getTime(); // we can't use dateDay as key because complex objects can't be keys
+
+ if (!groupedByDate[dateDayTS]) {
+ groupedByDate[dateDayTS] = [];
}
- groupedByDate[formattedDate].push(row);
+ groupedByDate[dateDayTS].push(row);
}
const sortedDates = Object.keys(groupedByDate);
sortedDates.sort();
sortedDates.reverse();
- for (const formattedDay of sortedDates) {
+ for (const dateDayTS of sortedDates) {
const changesListEl = $('<ul>');
- const dayEl = $('<div>').append($('<b>').html(formattedDay)).append(changesListEl);
+ const formattedDate = formatDate(getDateFromTS(groupedByDate[dateDayTS][0].date_modified));
+
+ const dayEl = $('<div>').append($('<b>').html(formattedDate)).append(changesListEl);
- for (const dayChanges of groupedByDate[formattedDay]) {
+ for (const dayChanges of groupedByDate[dateDayTS]) {
const formattedTime = formatTime(getDateFromTS(dayChanges.date_modified));
const noteLink = $("<a>", {