fix genkan year timestamp (#5638)

timestamp longer than 1 year shows as current year
This commit is contained in:
Riztard Lanthorn 2021-02-05 20:02:30 +07:00 committed by GitHub
parent c1da304544
commit 9e9e3593eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Genkan (multiple sources)'
pkgNameSuffix = 'all.genkan'
extClass = '.GenkanFactory'
extVersionCode = 24
extVersionCode = 25
libVersion = '1.2'
}

View File

@ -143,6 +143,7 @@ abstract class Genkan(
val calendar = Calendar.getInstance()
when (trimmedDate[1]) {
"year" -> calendar.apply { add(Calendar.YEAR, -trimmedDate[0].toInt()) }
"month" -> calendar.apply { add(Calendar.MONTH, -trimmedDate[0].toInt()) }
"week" -> calendar.apply { add(Calendar.WEEK_OF_MONTH, -trimmedDate[0].toInt()) }
"day" -> calendar.apply { add(Calendar.DAY_OF_MONTH, -trimmedDate[0].toInt()) }