feat(creator-profile): 라이브 섹션 UI 변경
This commit is contained in:
@@ -117,50 +117,9 @@ struct LiveReservationItemView: View {
|
||||
.background(Color(hex: "263238"))
|
||||
.cornerRadius(16)
|
||||
.onAppear {
|
||||
self.dateDic = parseUtcIsoLocalDateTime(item.beginDateTimeUtc)
|
||||
self.dateDic = item.beginDateTimeUtc.parseUtcIsoLocalDateTime()
|
||||
}
|
||||
}
|
||||
|
||||
func parseUtcIsoLocalDateTime(_ utcString: String) -> [String: String] {
|
||||
// 1. 서버에서 내려온 포맷: "yyyy-MM-dd'T'HH:mm:ss"
|
||||
let utcFormatter = DateFormatter()
|
||||
utcFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
|
||||
utcFormatter.locale = Locale.current
|
||||
utcFormatter.timeZone = TimeZone(abbreviation: "UTC")
|
||||
|
||||
// 2. 문자열 → Date 객체
|
||||
guard let date = utcFormatter.date(from: utcString) else {
|
||||
return [:] // 파싱 실패 시 빈 딕셔너리 반환
|
||||
}
|
||||
|
||||
// 3~6. 출력용 Formatter (로컬 시간 기준)
|
||||
let localFormatter = DateFormatter()
|
||||
localFormatter.locale = Locale.autoupdatingCurrent
|
||||
localFormatter.timeZone = TimeZone.current
|
||||
|
||||
// 3. 월 (1~12)
|
||||
localFormatter.dateFormat = "M"
|
||||
let month = localFormatter.string(from: date)
|
||||
|
||||
// 4. 일 (1~31)
|
||||
localFormatter.dateFormat = "d"
|
||||
let day = localFormatter.string(from: date)
|
||||
|
||||
// 5. 요일 (예: "Mon", "목")
|
||||
localFormatter.dateFormat = "E"
|
||||
let dayOfWeek = localFormatter.string(from: date)
|
||||
|
||||
// 6. 시간 (예: "AM 05:00")
|
||||
localFormatter.dateFormat = "a hh:mm"
|
||||
let time = localFormatter.string(from: date)
|
||||
|
||||
return [
|
||||
"month": month,
|
||||
"day": day,
|
||||
"dayOfWeek": dayOfWeek,
|
||||
"time": time
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
struct LiveReservationItemView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user