fix: Fixed MAL start date parsing

The previous approach would always throw an Exception because
`SimpleDateFormat.format()` expects the input to be of type `Date` or
`Number`, not `String`.
This commit is contained in:
MajorTanya 2024-08-11 18:55:13 +02:00 committed by Ahmad Ansori Palembani
parent c0059846b7
commit 0b1ed293f3
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 2 additions and 6 deletions

View file

@ -42,6 +42,7 @@
- Fixed kitsu tracker issue due to domain change - Fixed kitsu tracker issue due to domain change
- Fixed entry custom cover won't load if entry doesn't have cover from source - Fixed entry custom cover won't load if entry doesn't have cover from source
- Fixed unread badge doesn't work properly for some sources (notably Komga) - Fixed unread badge doesn't work properly for some sources (notably Komga)
- Fixed MAL start date parsing (@MajorTanya)
## Translation ## Translation
- Update Japanese translation (@akir45) - Update Japanese translation (@akir45)

View file

@ -116,12 +116,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
tracking_url = "https://myanimelist.net/manga/$media_id" tracking_url = "https://myanimelist.net/manga/$media_id"
publishing_status = obj["status"]!!.jsonPrimitive.content.replace("_", " ") publishing_status = obj["status"]!!.jsonPrimitive.content.replace("_", " ")
publishing_type = obj["media_type"]!!.jsonPrimitive.content.replace("_", " ") publishing_type = obj["media_type"]!!.jsonPrimitive.content.replace("_", " ")
start_date = try { start_date = obj["start_date"]?.jsonPrimitive?.content ?: ""
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
outputDf.format(obj["start_date"]!!)
} catch (e: Exception) {
""
}
} }
} }
} }