From ccf66ecb5db2dc0cc3091156b46446bb98dd8390 Mon Sep 17 00:00:00 2001 From: Muness Castle <931+muness@users.noreply.github.com> Date: Tue, 26 Dec 2023 00:53:04 -0500 Subject: [PATCH] Reverse time zone offset calculation because this is what AM's API expects --- src/main.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 8730979..92b4e3c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,8 +21,11 @@ import { } from "obsidian-daily-notes-interface"; import { amTaskWatcher } from "./amTaskWatcher"; import { AddTaskModal } from "./addTaskModal"; +import { time } from "console"; -let noticeTimeout: NodeJS.Timeout; +function getAMTimezoneOffset() { + return new Date().getTimezoneOffset() * -1; +} const animateNotice = (notice: Notice) => { let message = notice.noticeEl.innerText; @@ -37,7 +40,7 @@ const animateNotice = (notice: Notice) => { message = message.replace(" ...", " "); } notice.setMessage(message); - noticeTimeout = setTimeout(() => animateNotice(notice), 500); + setTimeout(() => animateNotice(notice), 500); }; const CONSTANTS = { @@ -164,7 +167,7 @@ export default class AmazingMarvinPlugin extends Plugin { let requestBody: any = { title: taskTitle, - timeZoneOffset: new Date().getTimezoneOffset(), + timeZoneOffset: getAMTimezoneOffset(), }; if (catId && catId !== '' && catId !== 'root' && catId !== '__inbox-faux__') { @@ -222,7 +225,7 @@ export default class AmazingMarvinPlugin extends Plugin { const opt = this.settings; const requestBody = { itemId: taskId, - timeZoneOffset: new Date().getTimezoneOffset() + timeZoneOffset: getAMTimezoneOffset() }; try {