fix parseChapterDate (#1096)

* fix parseChapterDate

* Update build.gradle

* Update Mangahere.kt

Ah sorry my bad
This commit is contained in:
pervertkirito 2019-05-09 18:10:42 +08:00 committed by Carlos
parent 2b3d92981a
commit c0d9d393bf
2 changed files with 24 additions and 7 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Mangahere' appName = 'Tachiyomi: Mangahere'
pkgNameSuffix = 'en.mangahere' pkgNameSuffix = 'en.mangahere'
extClass = '.Mangahere' extClass = '.Mangahere'
extVersionCode = 8 extVersionCode = 9
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -161,11 +161,28 @@ class Mangahere : ParsedHttpSource() {
} }
private fun parseChapterDate(date: String): Long { private fun parseChapterDate(date: String): Long {
return try { return if ("Today" in date || " ago" in date){
SimpleDateFormat("MMM dd,yyyy", Locale.ENGLISH).parse(date).time Calendar.getInstance().apply {
} catch (e: ParseException) { set(Calendar.HOUR_OF_DAY, 0)
0L set(Calendar.MINUTE, 0)
} set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
} else if ("Yesterday" in date) {
Calendar.getInstance().apply {
add(Calendar.DATE, -1)
set(Calendar.HOUR_OF_DAY, 0)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
} else {
try {
SimpleDateFormat("MMM dd,yyyy", Locale.ENGLISH).parse(date).time
} catch (e: ParseException) {
0L
}
}
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
@ -318,4 +335,4 @@ class Mangahere : ParsedHttpSource() {
Genre("Lolicon", 36) Genre("Lolicon", 36)
) )
} }