라이브 예약 표시를 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

@@ -60,7 +60,6 @@ struct LiveRoomResponse: Decodable {
let title: String
let content: String
let isPaid: Bool
let beginDateTime: String
let beginDateTimeUtc: String
let coverImageUrl: String
let isAdult: Bool

View File

@@ -203,20 +203,17 @@ final class UserProfileViewModel: 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 = I18n.MemberChannel.elapsedLiveWarning(hours: hours, minutes: minutes)
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 = I18n.MemberChannel.elapsedLiveWarning(hours: hours, minutes: minutes)
}
}
self.paymentDialogTitle = I18n.MemberChannel.paidLiveEnterTitle

View File

@@ -66,7 +66,6 @@ struct HomeLiveItemView: View {
roomId: 1,
title: "네네코 마사로네네코 마사로네네코 마사로네네코 마사로",
content: "테스트",
beginDateTime: "2025-08-10 15:00:00",
beginDateTimeUtc: "2025-08-10T15:00:00",
numberOfParticipate: 1,
numberOfPeople: 10,

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")

View File

@@ -85,7 +85,10 @@ struct LiveReservationCancelView: View {
.cornerRadius(4.7)
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

@@ -14,6 +14,6 @@ struct GetLiveReservationResponse: Decodable, Hashable {
let coverImageUrl: String
let price: Int
let masterNickname: String
let beginDateTime: String
let beginDateTimeUtc: String
let cancelable: Bool
}

View File

@@ -29,7 +29,10 @@ struct LiveReservationStatusItemView: View {
.cornerRadius(4.7)
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"))
@@ -102,7 +105,7 @@ struct LiveReservationStatusItemView_Previews: PreviewProvider {
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
price: 0,
masterNickname: "사냥꾼1004",
beginDateTime: "2021.05.20 SUN 10p.m",
beginDateTimeUtc: "2021-05-20T22:00:00",
cancelable: false
)
)