From 138a8e8dc90c3e07bc88b445864418ece1432fad Mon Sep 17 00:00:00 2001 From: JinUng41 Date: Sun, 1 Sep 2024 13:47:46 +0900 Subject: [PATCH] =?UTF-8?q?fix/#353=20'=EB=AA=A8=EC=9E=84=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9D=BC'=20=EC=88=98=EC=A0=95=EB=90=9C=20DateFormat?= =?UTF-8?q?=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/MeetingInfoViewModel.swift | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift b/KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift index 793fa2bb..f5ac6d14 100644 --- a/KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift +++ b/KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift @@ -57,7 +57,33 @@ extension MeetingInfoViewModel: ViewModelType { } .disposed(by: disposeBag) - let info = infoRelay.asDriver(onErrorJustReturn: nil) + let info = infoRelay + .map { info -> MeetingInfoModel? in + guard let info else { + print("MeetingInfoModel이 존재하지 않습니다.") + return nil + } + + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" + + guard let date = dateFormatter.date(from: info.createdAt) else { + print("서버의 date가 형식에 맞지 않습니다.") + return nil + } + + dateFormatter.dateFormat = "yyyy.MM.dd" + let dateString = dateFormatter.string(from: date) + + return MeetingInfoModel( + meetingID: info.meetingID, + name: info.name, + createdAt: dateString, + metCount: info.metCount, + invitationCode: info.invitationCode + ) + } + .asDriver(onErrorJustReturn: nil) let memberCount = meetingMemberModelRelay .compactMap { $0?.memberCount }