feat(user-channel): 유저 채널의 라이브 아이템 UI 수정
This commit is contained in:
@@ -7,6 +7,7 @@ import java.text.NumberFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Currency
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
|
||||
fun String.convertDateFormat(
|
||||
from: String,
|
||||
@@ -67,3 +68,31 @@ fun String.formatMoney(currencyCode: String, locale: Locale = Locale.getDefault(
|
||||
val bd = this.toBigDecimal()
|
||||
return nf.format(bd)
|
||||
}
|
||||
|
||||
fun String.parseUtcIsoLocalDateTime(): Map<String, String> {
|
||||
// 1. 서버가 내려준 포맷: "yyyy-MM-dd'T'HH:mm:ss"
|
||||
val utcFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault())
|
||||
utcFormat.timeZone = TimeZone.getTimeZone("UTC") // 서버가 UTC 기준으로 보낸 것
|
||||
|
||||
// 2. Date 객체 생성
|
||||
val date = utcFormat.parse(this)!!
|
||||
|
||||
// 3. 월 (1~12)
|
||||
val month = SimpleDateFormat("M", Locale.getDefault()).format(date)
|
||||
|
||||
// 4. 일 (1~31)
|
||||
val day = SimpleDateFormat("d", Locale.getDefault()).format(date)
|
||||
|
||||
// 5. 요일 (예: "Mon", "목")
|
||||
val dayOfWeek = SimpleDateFormat("E", Locale.getDefault()).format(date)
|
||||
|
||||
// 6. 시간 (예: "AM 05:00")
|
||||
val time = SimpleDateFormat("a hh:mm", Locale.getDefault()).format(date)
|
||||
|
||||
return mapOf(
|
||||
"month" to month,
|
||||
"day" to day,
|
||||
"dayOfWeek" to dayOfWeek,
|
||||
"time" to time
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user