mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
use local dates in the recent changes
This commit is contained in:
parent
586d6b4557
commit
7ea53d468e
@ -32,10 +32,10 @@ export async function showDialog(ancestorNoteId) {
|
|||||||
for (const [dateDay, dayChanges] of groupedByDate) {
|
for (const [dateDay, dayChanges] of groupedByDate) {
|
||||||
const $changesList = $('<ul>');
|
const $changesList = $('<ul>');
|
||||||
|
|
||||||
const dayEl = $('<div>').append($('<b>').html(utils.formatDate(dateDay))).append($changesList);
|
const dayEl = $('<div>').append($('<b>').text(dateDay)).append($changesList);
|
||||||
|
|
||||||
for (const change of dayChanges) {
|
for (const change of dayChanges) {
|
||||||
const formattedTime = utils.formatTime(utils.parseDate(change.date));
|
const formattedTime = change.date.substr(11, 5);
|
||||||
|
|
||||||
let $noteLink;
|
let $noteLink;
|
||||||
|
|
||||||
@ -82,7 +82,12 @@ export async function showDialog(ancestorNoteId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$changesList.append($('<li>')
|
$changesList.append($('<li>')
|
||||||
.append(formattedTime + ' - ')
|
.append(
|
||||||
|
$("<span>")
|
||||||
|
.text(formattedTime)
|
||||||
|
.attr("title", change.date)
|
||||||
|
)
|
||||||
|
.append(' - ')
|
||||||
.append($noteLink));
|
.append($noteLink));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,23 +97,9 @@ export async function showDialog(ancestorNoteId) {
|
|||||||
|
|
||||||
function groupByDate(result) {
|
function groupByDate(result) {
|
||||||
const groupedByDate = new Map();
|
const groupedByDate = new Map();
|
||||||
const dayCache = {};
|
|
||||||
|
|
||||||
for (const row of result) {
|
for (const row of result) {
|
||||||
let dateDay = utils.parseDate(row.date);
|
const dateDay = row.date.substr(0, 10);
|
||||||
dateDay.setHours(0);
|
|
||||||
dateDay.setMinutes(0);
|
|
||||||
dateDay.setSeconds(0);
|
|
||||||
dateDay.setMilliseconds(0);
|
|
||||||
|
|
||||||
// this stupidity is to make sure that we always use the same day object because Map uses only
|
|
||||||
// reference equality
|
|
||||||
if (dayCache[dateDay]) {
|
|
||||||
dateDay = dayCache[dateDay];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dayCache[dateDay] = dateDay;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!groupedByDate.has(dateDay)) {
|
if (!groupedByDate.has(dateDay)) {
|
||||||
groupedByDate.set(dateDay, []);
|
groupedByDate.set(dateDay, []);
|
||||||
|
@ -13,17 +13,17 @@ async function getRecentChanges(req) {
|
|||||||
SELECT * FROM (
|
SELECT * FROM (
|
||||||
SELECT note_revisions.noteId,
|
SELECT note_revisions.noteId,
|
||||||
note_revisions.noteRevisionId,
|
note_revisions.noteRevisionId,
|
||||||
note_revisions.utcDateCreated AS date
|
note_revisions.dateLastEdited AS date
|
||||||
FROM note_revisions
|
FROM note_revisions
|
||||||
ORDER BY note_revisions.utcDateCreated DESC
|
ORDER BY note_revisions.dateLastEdited DESC
|
||||||
)
|
)
|
||||||
UNION ALL SELECT * FROM (
|
UNION ALL SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
notes.noteId,
|
notes.noteId,
|
||||||
NULL AS noteRevisionId,
|
NULL AS noteRevisionId,
|
||||||
utcDateModified AS date
|
dateModified AS date
|
||||||
FROM notes
|
FROM notes
|
||||||
ORDER BY utcDateModified DESC
|
ORDER BY dateModified DESC
|
||||||
)
|
)
|
||||||
ORDER BY date DESC`);
|
ORDER BY date DESC`);
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ async function getRecentChanges(req) {
|
|||||||
notes.title AS current_title,
|
notes.title AS current_title,
|
||||||
notes.isProtected AS current_isProtected,
|
notes.isProtected AS current_isProtected,
|
||||||
note_revisions.title,
|
note_revisions.title,
|
||||||
note_revisions.utcDateCreated AS date
|
note_revisions.dateCreated AS date
|
||||||
FROM
|
FROM
|
||||||
note_revisions
|
note_revisions
|
||||||
JOIN notes USING(noteId)
|
JOIN notes USING(noteId)
|
||||||
@ -60,7 +60,7 @@ async function getRecentChanges(req) {
|
|||||||
notes.title AS current_title,
|
notes.title AS current_title,
|
||||||
notes.isProtected AS current_isProtected,
|
notes.isProtected AS current_isProtected,
|
||||||
notes.title,
|
notes.title,
|
||||||
notes.utcDateModified AS date
|
notes.dateModified AS date
|
||||||
FROM
|
FROM
|
||||||
notes
|
notes
|
||||||
WHERE noteId = ?`, [noteRow.noteId]));
|
WHERE noteId = ?`, [noteRow.noteId]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user