zBulu - fix date parsing (#3951)

This commit is contained in:
Mike 2020-07-29 22:49:55 -04:00 committed by GitHub
parent ff635bd624
commit ee1db2fbb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'zBulu' extName = 'zBulu'
pkgNameSuffix = 'all.zbulu' pkgNameSuffix = 'all.zbulu'
extClass = '.ZbuluFactory' extClass = '.ZbuluFactory'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -151,7 +151,7 @@ abstract class Zbulu(
setUrlWithoutDomain(it.attr("href").addTrailingSlash()) setUrlWithoutDomain(it.attr("href").addTrailingSlash())
name = it.text() name = it.text()
} }
date_upload = element.select("div.chapter-date")?.text()?.let { parseChapterDate(it) } ?: 0 date_upload = element.select("div.chapter-date")?.text().toDate()
} }
} }
@ -161,8 +161,12 @@ abstract class Zbulu(
} }
} }
private fun parseChapterDate(string: String): Long { private fun String?.toDate(): Long {
return dateFormat.parse(string).time return if (this.isNullOrEmpty()) {
0
} else {
dateFormat.parse(this)?.time ?: 0
}
} }
// Pages // Pages