mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-26 23:11:34 +08:00
send along a local datetime so that the creation date is saved correctly including the timezone
This commit is contained in:
parent
d3539ec9d7
commit
7a42d7e229
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -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();
|
Loading…
x
Reference in New Issue
Block a user