Skip to content

Commit

Permalink
fix/#353 '모임 생성일' 수정된 DateFormat 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
JinUng41 committed Sep 1, 2024
1 parent d7f31ed commit 138a8e8
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 138a8e8

Please sign in to comment.