Skip to content

Commit

Permalink
feat: Add recent upload status
Browse files Browse the repository at this point in the history
  • Loading branch information
210-reverof committed Sep 21, 2024
1 parent 277e2eb commit 7592073
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.time.temporal.ChronoUnit

object GroupViewStatusUtil {
private const val PIC_ON_PROGRESS = "쉿 PIC하는 중"
private const val RECENT_UPDATE = "최근 업데이트"
private const val DAYS_AGO_UPDATE = "%d일 전 업데이트"
private const val WEEK_AGO_UPDATE = "일주일 전 업데이트"
private const val TWO_WEEKS_AGO_UPDATE = "이주일 전 업데이트"
Expand All @@ -18,9 +19,9 @@ object GroupViewStatusUtil {
return PIC_ON_PROGRESS
}

val daysSinceUpdate = ChronoUnit.DAYS.between(lastEvent.date.toLocalDate(), LocalDateTime.now().toLocalDate())

val daysSinceUpdate = ChronoUnit.DAYS.between(lastEvent.createdAt.toLocalDate(), LocalDateTime.now().toLocalDate())
return when {
daysSinceUpdate == 0L -> RECENT_UPDATE.format(daysSinceUpdate)
daysSinceUpdate in 1..6 -> DAYS_AGO_UPDATE.format(daysSinceUpdate)
daysSinceUpdate == 7L -> WEEK_AGO_UPDATE
daysSinceUpdate in 8..13 -> DAYS_AGO_UPDATE.format(daysSinceUpdate)
Expand Down

0 comments on commit 7592073

Please sign in to comment.