Skip to content

Commit

Permalink
Fixed UTC issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Dec 10, 2024
1 parent dcfc114 commit 9d6880f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/tame-brooms-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"evalite": patch
"@evalite/core": patch
---

Fixed a bug where the UI was showing times in UTC.
7 changes: 6 additions & 1 deletion apps/evalite-ui/app/components/ui/live-date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ export const LiveDate = (props: { date: string; className?: string }) => {
}, ONE_MINUTE);
return () => clearInterval(interval);
}, []);

const utcDate = new Date(props.date + "Z");

return (
<span className={props.className}>
{formatDistance(props.date, new Date(), { addSuffix: true })}
{formatDistance(utcDate, new Date(), {
addSuffix: true,
})}
</span>
);
};

0 comments on commit 9d6880f

Please sign in to comment.