Skip to content

Commit

Permalink
[lexical-playground] Bug Fix: fix comment timestamps (#6555)
Browse files Browse the repository at this point in the history
  • Loading branch information
irahopkinson authored Aug 26, 2024
1 parent 5d56371 commit 8dafdb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/lexical-playground/src/commenting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export function createComment(
content,
deleted: deleted === undefined ? false : deleted,
id: id === undefined ? createUID() : id,
timeStamp: timeStamp === undefined ? performance.now() : timeStamp,
timeStamp:
timeStamp === undefined
? performance.timeOrigin + performance.now()
: timeStamp,
type: 'comment',
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ function CommentsPanelListComment({
rtf: Intl.RelativeTimeFormat;
thread?: Thread;
}): JSX.Element {
const seconds = Math.round((comment.timeStamp - performance.now()) / 1000);
const seconds = Math.round(
(comment.timeStamp - (performance.timeOrigin + performance.now())) / 1000,
);
const minutes = Math.round(seconds / 60);
const [modal, showModal] = useModal();

Expand Down

0 comments on commit 8dafdb1

Please sign in to comment.