Skip to content

Commit 9993e78

Browse files
authored
fix date (codesandbox#3799)
1 parent 32dce9d commit 9993e78

File tree

1 file changed

+3
-2
lines changed
  • packages/app/src/app/overmind/namespaces/comments

1 file changed

+3
-2
lines changed

packages/app/src/app/overmind/namespaces/comments/actions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CommentsFilterOption } from '@codesandbox/common/lib/types';
22
import { CodeReference, CommentFragment } from 'app/graphql/types';
33
import { Action, AsyncAction } from 'app/overmind';
4+
import { utcToZonedTime } from 'date-fns-tz';
45

56
import { OPTIMISTIC_COMMENT_ID } from './state';
67

@@ -194,7 +195,7 @@ export const createComment: AsyncAction = async ({ state, effects }) => {
194195

195196
const id = OPTIMISTIC_COMMENT_ID;
196197
const sandboxId = state.editor.currentSandbox.id;
197-
const now = new Date().toString();
198+
const now = utcToZonedTime(new Date().toISOString(), 'Etc/UTC');
198199
let codeReference: CodeReference | null = null;
199200
const selection = state.live.currentSelection;
200201
if (selection) {
@@ -281,7 +282,7 @@ export const addComment: AsyncAction<{
281282

282283
const id = OPTIMISTIC_COMMENT_ID;
283284
const sandboxId = state.editor.currentSandbox.id;
284-
const now = new Date().toString();
285+
const now = utcToZonedTime(new Date().toISOString(), 'Etc/UTC');
285286
const comments = state.comments.comments;
286287

287288
if (!comments[sandboxId]) {

0 commit comments

Comments
 (0)