Skip to content

Build your personal knowledge base with Trilium Notes

send along a local datetime so that the creation date is saved correctly including the timezone

zadam7a42d7e22911
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index b2bdec2d71..fdf1fc87c0 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
diff --git a/trilium_server_facade.js b/trilium_server_facade.js
index 952fc7db91..0daa1d2ebd 100644
--- a/trilium_server_facade.js
+++ b/trilium_server_facade.js
@@ -54,7 +54,7 @@ class TriliumServerFacade {
this.setTriliumSearch({ status: 'searching' });
const startingPort = await this.getStartingPort();
-
+
for (let testedPort = startingPort; testedPort < startingPort + 10; testedPort++) {
try {
console.debug('Trying port ' + testedPort);
@@ -163,6 +163,7 @@ class TriliumServerFacade {
await this.waitForTriliumSearch();
fetchOptions.headers.Authorization = this.triliumSearch.token || "";
+ fetchOptions.headers['trilium-local-now-datetime'] = this.localNowDateTime();
const url = this.triliumSearch.url + "/api/clipper/" + path;
@@ -184,6 +185,16 @@ class TriliumServerFacade {
return null;
}
}
+
+ localNowDateTime() {
+ const date = new Date();
+ const off = date.getTimezoneOffset();
+ const absoff = Math.abs(off);
+ return (new Date(date.getTime() - off * 60 * 1000).toISOString().substr(0,23).replace("T", " ") +
+ (off > 0 ? '-' : '+') +
+ (absoff / 60).toFixed(0).padStart(2,'0') + ':' +
+ (absoff % 60).toString().padStart(2,'0'));
+ }
}
-window.triliumServerFacade = new TriliumServerFacade();
\ No newline at end of file
+window.triliumServerFacade = new TriliumServerFacade();