WPComics: Add `monthWords` and `yearWords` (#3477)
* WPComics: Add `monthWords` and `yearWords` * Simplified month & year
This commit is contained in:
parent
88205d95b0
commit
4c4a178b9e
|
@ -2,7 +2,7 @@ plugins {
|
|||
id("lib-multisrc")
|
||||
}
|
||||
|
||||
baseVersionCode = 5
|
||||
baseVersionCode = 6
|
||||
|
||||
dependencies {
|
||||
api(project(":lib:i18n"))
|
||||
|
|
|
@ -163,6 +163,8 @@ abstract class WPComics(
|
|||
val minuteWords = listOf("minute", "phút")
|
||||
val hourWords = listOf("hour", "giờ")
|
||||
val dayWords = listOf("day", "ngày")
|
||||
val monthWords = listOf("month", "tháng")
|
||||
val yearWords = listOf("year", "năm")
|
||||
val agoWords = listOf("ago", "trước")
|
||||
|
||||
return try {
|
||||
|
@ -171,6 +173,8 @@ abstract class WPComics(
|
|||
val calendar = Calendar.getInstance()
|
||||
|
||||
when {
|
||||
yearWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.YEAR, -trimmedDate[0].toInt()) }
|
||||
monthWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.MONTH, -trimmedDate[0].toInt()) }
|
||||
dayWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.DAY_OF_MONTH, -trimmedDate[0].toInt()) }
|
||||
hourWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.HOUR_OF_DAY, -trimmedDate[0].toInt()) }
|
||||
minuteWords.doesInclude(trimmedDate[1]) -> calendar.apply { add(Calendar.MINUTE, -trimmedDate[0].toInt()) }
|
||||
|
|
Loading…
Reference in New Issue