-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 보틀 목록에서 마지막 활성 시간을 제공한다 (#366)
* feat: 보틀 목록에서 마지막 활성 시간을 제공한다 * feat: 코드리뷰 반영
- Loading branch information
1 parent
80f43f9
commit 4725f2d
Showing
4 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/src/main/kotlin/com/nexters/bottles/api/bottle/util/TimeConvertUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.nexters.bottles.api.bottle.util | ||
|
||
import java.time.LocalDateTime | ||
import java.time.temporal.ChronoUnit | ||
|
||
fun getLastActivatedAtInKorean(basedAt: LocalDateTime, now: LocalDateTime): String { | ||
val minutesBetween = ChronoUnit.MINUTES.between(basedAt, now) | ||
|
||
return when { | ||
minutesBetween >= 1440 -> "${minutesBetween / 1440}일 전" // 1440분은 24시간 | ||
minutesBetween >= 60 -> "${minutesBetween / 60}시간 전" | ||
else -> "${minutesBetween}분 전" | ||
} | ||
} |