diff --git a/src/App.svelte b/src/App.svelte index e406dae..6168b35 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -20,7 +20,10 @@ days: getDaysInMonth(date.getFullYear(), date.getMonth()), }) - const fromNostrTime = seconds => new Date(seconds * 1000).toISOString().slice(0, -5).split("T") + + const getTimezoneOffset = () => new Date().getTimezoneOffset() * 60000 + + const fromNostrTime = seconds => new Date(seconds * 1000 - getTimezoneOffset()).toISOString().slice(0, -5).split("T") const toNostrTime = (date, time) => dateToSeconds(new Date(`${date}T${time}`)).toString() @@ -167,7 +170,7 @@ await event.publish() - events = events.filter(e => e.id !== event.id).concat(event) + events = events.filter(e => getMeta(e).d !== draft.id).concat(event) key = Math.random() draft = null @@ -198,7 +201,7 @@ if (confirm("Are you sure you want to delete this event?")) { await draft.event.delete() - events = events.filter(e => e.id !== event.id) + events = events.filter(e => getMeta(e).d !== draft.id) key = Math.random() draft = null @@ -229,7 +232,7 @@
{#key key} {#each month.days as date, i} -
+
{date.getDate()} @@ -238,17 +241,18 @@ {@const meta = getMeta(event)} {@const isContinuation = eventIsInRange(changeDay(date, -1), event)} {@const isContinued = eventIsInRange(changeDay(date, 1), event)} + {@const isOwn = event.pubkey === user?.hexpubkey()}