From e287f0878983bae371d604cb334ff8504ea13ca2 Mon Sep 17 00:00:00 2001 From: MajorTanya <39014446+MajorTanya@users.noreply.github.com> Date: Tue, 4 Aug 2026 12:48:08 +0200 Subject: [PATCH] Fix MAL error when list entries have partial dates (#3573) This has the side effect of forcing the date to something concrete. For Year-only: 1st of January that year Ex: 2025 -> 2025-01-01 For Year+Month: 1st of said month Ex: 2024-11 -> 2024-11-01 MAL allows setting Day+Month and Day+Year, but both of those are sent as `null` in the API, which means Mihon will not show a date at all. This has the side effect of Mihon sending up the date as `null` the next time info is sent to MAL, which will clear the date fields completely. Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> --- CHANGELOG.md | 1 + .../tachiyomi/data/track/myanimelist/MyAnimeListApi.kt | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 296e34f2c..cf9fbb69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - Fixed extension installation with shizuku installer ([@NGB-Was-Taken](https://github.com/NGB-Was-Taken)) ([#3676](https://github.com/mihonapp/mihon/pull/3676)) - Fixed `X-Requested-With` spoofing leaking to unrelated callers ([@AntsyLich](https://github.com/AntsyLich)) ([#3678](https://github.com/mihonapp/mihon/pull/3678)) - Fixed reader loading indefinitely in some scenarios ([@AntsyLich](https://github.com/AntsyLich)) ([#3686](https://github.com/mihonapp/mihon/pull/3686)) +- Fix MyAnimeList error for list entries with partial start/finish reading dates by setting those dates to either Jan 1st or 1st of the month ([@MajorTanya](https://github.com/MajorTanya)) ([#3573](https://github.com/mihonapp/mihon/pull/3573)) ## [v0.20.2] - 2026-08-01 ### Added 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 9cb79e2ce..c7e441788 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 @@ -245,7 +245,13 @@ class MyAnimeListApi( } private fun parseDate(isoDate: String): Long { - return SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(isoDate)?.time ?: 0L + val pattern = when (isoDate.length) { + 10 -> "yyyy-MM-dd" + 7 -> "yyyy-MM" + 4 -> "yyyy" + else -> throw IllegalArgumentException("Unsupported date format: \"$isoDate\"") + } + return SimpleDateFormat(pattern, Locale.US).parse(isoDate)?.time ?: 0L } private fun convertToIsoDate(epochTime: Long): String? {