Skip to content

Commit

Permalink
Fix MAL search results not showing start dates (#1098)
Browse files Browse the repository at this point in the history
The previous approach would always throw an Exception because
`SimpleDateFormat.format()` expects the input to be of type `Date` or
`Number`, not `String`.
  • Loading branch information
MajorTanya authored Aug 11, 2024
1 parent 9240ece commit 97c81fa
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ class MyAnimeListApi(
obj["status"]!!.jsonPrimitive.content.replace("_", " ")
publishing_type =
obj["media_type"]!!.jsonPrimitive.content.replace("_", " ")
start_date = try {
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
outputDf.format(obj["start_date"]!!)
} catch (e: Exception) {
""
}
start_date = obj["start_date"]?.jsonPrimitive?.content ?: ""
}
}
}
Expand Down

0 comments on commit 97c81fa

Please sign in to comment.