라이브 예약 표시를 UTC 기준으로 변경

This commit is contained in:
Yu Sung
2026-01-21 17:27:26 +09:00
parent a743fecfdd
commit 9223e26a07
16 changed files with 37 additions and 52 deletions

View File

@@ -11,7 +11,6 @@ struct GetRoomListResponse: Decodable, Hashable {
let roomId: Int
let title: String
let content: String
let beginDateTime: String
let beginDateTimeUtc: String
let numberOfParticipate: Int
let numberOfPeople: Int

View File

@@ -368,20 +368,17 @@ final class LiveViewModel: ObservableObject {
}
self.isShowPasswordDialog = true
} else {
let fromFormatter = DateFormatter()
fromFormatter.dateFormat = "yyyy.MM.dd EEE hh:mm a"
fromFormatter.locale = Locale(identifier: "en_US_POSIX")
let beginDate = fromFormatter.date(from: $0.beginDateTime)!
let now = Date()
let timeInterval = now.timeIntervalSince(beginDate)
let hours = Int(timeInterval / 3600)
let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60)
if hours >= 1 {
self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm")
self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm")
self.paymentDialogDesc2 = "라이브를 시작한 지 \(hours)시간 \(minutes)분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다."
if let beginDate = $0.beginDateTimeUtc.parseUtcIsoDate() {
let now = Date()
let timeInterval = now.timeIntervalSince(beginDate)
let hours = Int(timeInterval / 3600)
let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60)
if hours >= 1 {
self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm")
self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm")
self.paymentDialogDesc2 = "라이브를 시작한 지 \(hours)시간 \(minutes)분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다."
}
}
self.paymentDialogTitle = "유료 라이브 입장"

View File

@@ -135,7 +135,6 @@ struct LiveNowAllItemView_Previews: PreviewProvider {
roomId: 99,
title: "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
content: "testtest",
beginDateTime: "2022.05.23 Mon 03:00 PM",
beginDateTimeUtc: "2025-08-10T15:00:00",
numberOfParticipate: 3,
numberOfPeople: 5,
@@ -154,4 +153,3 @@ struct LiveNowAllItemView_Previews: PreviewProvider {
)
}
}

View File

@@ -106,7 +106,6 @@ struct LiveNowItemView_Previews: PreviewProvider {
roomId: 99,
title: "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest",
content: "testtest",
beginDateTime: "2022.05.23 Mon 03:00 PM",
beginDateTimeUtc: "2025-08-10T15:00:00",
numberOfParticipate: 3,
numberOfPeople: 5,

View File

@@ -33,7 +33,10 @@ struct LiveReservationAllItemView: View {
HStack(alignment: .top, spacing: 0) {
VStack(alignment: .leading, spacing: 0) {
Text(item.beginDateTime)
let beginDateText = item.beginDateTimeUtc
.parseUtcIsoDate()?
.convertDateFormat(dateFormat: "yyyy.MM.dd EEE hh:mm a") ?? item.beginDateTimeUtc
Text(beginDateText)
.font(.custom(Font.medium.rawValue, size: 9.3))
.foregroundColor(Color(hex: "ffd300"))

View File

@@ -126,7 +126,6 @@ struct LiveReservationItemView_Previews: PreviewProvider {
roomId: 99,
title: "test",
content: "testtest",
beginDateTime: "2022.05.23 Mon 03:00 PM",
beginDateTimeUtc: "2025-08-10T15:00:00",
numberOfParticipate: 0,
numberOfPeople: 5,

View File

@@ -185,7 +185,6 @@ struct MyLiveReservationItemView_Previews: PreviewProvider {
roomId: 99,
title: "test",
content: "testtest",
beginDateTime: "2022.05.23 Mon 03:00 PM",
beginDateTimeUtc: "2025-08-10T15:00:00",
numberOfParticipate: 0,
numberOfPeople: 5,

View File

@@ -18,7 +18,6 @@ struct GetRoomDetailResponse: Decodable {
let password: String?
let tags: [String]
let channelName: String?
let beginDateTime: String
let beginDateTimeUtc: String
let numberOfParticipants: Int
let numberOfParticipantsTotal: Int

View File

@@ -94,7 +94,7 @@ struct LiveDetailView: View {
.padding(.top, 6.7)
HStack(spacing: 0) {
let beginDateText = room.beginDateTimeUtc.parseUtcIsoDate()?.localizedDateTimeString() ?? room.beginDateTime
let beginDateText = room.beginDateTimeUtc.parseUtcIsoDate()?.localizedDateTimeString() ?? room.beginDateTimeUtc
Text(beginDateText)
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "bbbbbb"))

View File

@@ -55,15 +55,6 @@ final class LiveRoomEditViewModel: ObservableObject {
if let beginDate = room!.beginDateTimeUtc.parseUtcIsoDate() {
reservationDate = beginDate
reservationTime = beginDate
} else {
let fromFormatter = DateFormatter()
fromFormatter.dateFormat = "yyyy.MM.dd EEE hh:mm a"
fromFormatter.locale = Locale(identifier: "en_US_POSIX")
if let legacyDate = fromFormatter.date(from: room!.beginDateTime) {
reservationDate = legacyDate
reservationTime = legacyDate
}
}
let beginDate = reservationDate.convertDateFormat(dateFormat: "yyyy-MM-dd")