diff --git a/SodaLive/Sources/Extensions/StringExtension.swift b/SodaLive/Sources/Extensions/StringExtension.swift index fe2ac94..b7e9f0f 100644 --- a/SodaLive/Sources/Extensions/StringExtension.swift +++ b/SodaLive/Sources/Extensions/StringExtension.swift @@ -14,11 +14,15 @@ extension Optional where Wrapped == String { } extension String { - func convertDateFormat(from: String, to: String) -> String { + func convertDateFormat(from: String, to: String, locale: Locale? = nil) -> String { let fromFormatter = DateFormatter() fromFormatter.dateFormat = from fromFormatter.timeZone = TimeZone(identifier: TimeZone.current.identifier) + if let locale = locale { + fromFormatter.locale = locale + } + if let date = fromFormatter.date(from: self) { return date.convertDateFormat(dateFormat: to) } else { diff --git a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift index 821796f..2e5b1b4 100644 --- a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift +++ b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift @@ -94,7 +94,7 @@ struct LiveDetailView: View { .padding(.top, 6.7) HStack(spacing: 0) { - Text(room.beginDateTime) + Text(room.beginDateTime.convertDateFormat(from: "yyyy.MM.dd EEE hh:mm a", to: "yyyy년 MM월 dd일 (E) a hh시 mm분", locale: Locale(identifier: "en_US_POSIX"))) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "bbbbbb"))