diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt index 22ceef6bfa..94e9b21839 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/AnilistApi.kt @@ -87,10 +87,10 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { val response = responseToJson(netResponse) try { val media = response["data"]["SaveMediaListEntry"].asJsonObject - if (track.started_reading_date == 0L) { + if (track.started_reading_date <= 0L) { track.started_reading_date = parseDate(media, "startedAt") } - if (track.finished_reading_date == 0L) { + if (track.finished_reading_date <= 0L) { track.finished_reading_date = parseDate(media, "completedAt") } } catch (e: Exception) { @@ -236,6 +236,11 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) { } private fun createDate(dateValue: Long): JsonObject? { + if (dateValue == -1L) return jsonObject( + "year" to null, + "month" to null, + "day" to null, + ) if (dateValue == 0L) return null val calendar = Calendar.getInstance() calendar.timeInMillis = dateValue diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt index bb7cb8c47b..6f3d953f82 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt @@ -222,7 +222,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI } private fun convertToIsoDate(epochTime: Long): String? { - if (epochTime == 0L) { + if (epochTime <= 0L) { return "" } return try { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt index 5dc315c4aa..8701e972a7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt @@ -67,7 +67,7 @@ class SetTrackReadingDatesDialog : DialogController listener.setReadingDate(item, dateToUpdate, date.timeInMillis) } .neutralButton(R.string.remove) { - listener.setReadingDate(item, dateToUpdate, 0L) + listener.setReadingDate(item, dateToUpdate, -1L) }.apply { getSuggestedDate()?.let { message(