라이브 상세 - 날짜 포맷 yyyy년 MM월 dd일 (E) a hh시 mm분 로 수정
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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"))
|
||||
|
||||
|
Reference in New Issue
Block a user