diff --git a/src/all/komga/CHANGELOG.md b/src/all/komga/CHANGELOG.md index 6717df1cf..9300d5618 100644 --- a/src/all/komga/CHANGELOG.md +++ b/src/all/komga/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.2.18 + +Minimum Komga version required: `0.63.2` + +### Fix + +* use metadata.releaseDate or fileLastModified for chapter date + ## 1.2.17 Minimum Komga version required: `0.63.2` diff --git a/src/all/komga/build.gradle b/src/all/komga/build.gradle index e057c3a43..848244dd7 100644 --- a/src/all/komga/build.gradle +++ b/src/all/komga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Komga' pkgNameSuffix = 'all.komga' extClass = '.KomgaFactory' - extVersionCode = 17 + extVersionCode = 18 libVersion = '1.2' } diff --git a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt index c28f9b4d1..93437e33e 100644 --- a/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt +++ b/src/all/komga/src/eu/kanade/tachiyomi/extension/all/komga/Komga.kt @@ -168,7 +168,8 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() { chapter_number = book.metadata.numberSort name = "${book.metadata.number} - ${book.metadata.title} (${book.size})" url = "$baseUrl/api/v1/books/${book.id}" - date_upload = parseDate(book.lastModified) + date_upload = book.metadata.releaseDate?.let { parseDate(it) } + ?: parseDateTime(book.fileLastModified) } }.sortedByDescending { it.chapter_number } } @@ -219,6 +220,17 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() { } private fun parseDate(date: String?): Long = + if (date == null) + Date().time + else { + try { + SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(date).time + } catch (ex: Exception) { + Date().time + } + } + + private fun parseDateTime(date: String?): Long = if (date == null) Date().time else {