Skip to content

Commit

Permalink
fix: make date filed unix time
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinho1011 committed Dec 25, 2023
1 parent 80ed3b7 commit 0da5675
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/Home/Comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const Comment = React.memo(({ comment }: CommentProps) => {
0
);

const startDate = new Date(comment.createdAt);
const startDate = new Date(comment.createdAt * 1000);
const distance = getDateDistance(startDate, new Date());
const distanceText = getDateDistanceText(distance, {
hours: (t: TimeUnits) => t.days < 1,
minutes: (t: TimeUnits) => t.hours < 1,
hours: (t: TimeUnits) => t.hours > 0 && t.days < 1,
minutes: (t: TimeUnits) => t.minutes > 0 && t.hours < 1,
seconds: (t: TimeUnits) => t.minutes < 1,
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/TopicCard/TopicCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const TopicCard = ({ topic }: TopicCardProps) => {
const data = await voteMutation.mutateAsync({
topicId: topic.topicId,
choiceOption: choiceOption,
votedAt: new Date().getTime(),
votedAt: new Date().getTime() / 1000,
});
setLatestComment(data);
};
Expand All @@ -83,7 +83,7 @@ const TopicCard = ({ topic }: TopicCardProps) => {
<Topic>{topic.topicTitle}</Topic>
</TopicContainer>
<UserInfoContainer>
<UserProfileImage src={topic.author.profileImageUrl} />
<UserProfileImage src={topic.author.profileImageUrl || ''} />
<Text size={14} weight={'regular'} color={colors.white_60}>
{topic.author.nickname}
</Text>
Expand Down

0 comments on commit 0da5675

Please sign in to comment.