fix(agent-assignment): 소속 시각 UTC 변환을 적용한다
This commit is contained in:
@@ -2,6 +2,10 @@ package kr.co.vividnext.sodalive.extensions
|
||||
|
||||
import java.time.Duration
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
|
||||
private val DEFAULT_KST_ZONE_ID: ZoneId = ZoneId.of("Asia/Seoul")
|
||||
private val UTC_ZONE_ID: ZoneId = ZoneId.of("UTC")
|
||||
|
||||
fun LocalDateTime.getTimeAgoString(): String {
|
||||
val now = LocalDateTime.now()
|
||||
@@ -16,3 +20,9 @@ fun LocalDateTime.getTimeAgoString(): String {
|
||||
else -> "${duration.toDays() / 365}년전"
|
||||
}
|
||||
}
|
||||
|
||||
fun LocalDateTime.convertToUtc(timeZone: ZoneId = DEFAULT_KST_ZONE_ID): LocalDateTime {
|
||||
return atZone(timeZone)
|
||||
.withZoneSameInstant(UTC_ZONE_ID)
|
||||
.toLocalDateTime()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user