Skip to content

Commit

Permalink
Merge pull request #247 from Yanol-Market/feature/chat-created-at
Browse files Browse the repository at this point in the history
fix: 채팅 작성 시간 한국시간으로 변환 로직 오류 해결
  • Loading branch information
dldmldlsy authored Jan 28, 2024
2 parents ff23160 + fdbcd74 commit 9c83064
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import static site.goldenticket.common.response.ErrorCode.USER_NOT_FOUND;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -326,15 +322,12 @@ public ChatRoomDetailResponse getChatRoomDetail(Long userId, Long chatRoomId) {
chat.setViewedByBuyer(true);
}
chatRepository.save(chat); // *확인 필요
ZoneId koreaZoneId = ZoneId.of("Asia/Seoul");
ZonedDateTime koreaZonedDateTime = chat.getCreatedAt().atZone(koreaZoneId);
LocalDateTime koreaLocalDateTime = koreaZonedDateTime.toLocalDateTime();
ChatResponse chatResponse = ChatResponse.builder()
.chatId(chat.getId())
.senderType(chat.getSenderType())
.userId(chat.getUserId())
.content(chat.getContent())
.createdAt(koreaLocalDateTime)
.createdAt(chat.getCreatedAt().plusHours(9))
.viewed(true)
.build();
chatResponseList.add(chatResponse);
Expand Down

0 comments on commit 9c83064

Please sign in to comment.