jikan-me / jikan

Unofficial MyAnimeList PHP+REST API which provides functions other than the official API
https://jikan.moe
MIT License
854 stars 94 forks source link

Added animeAiredString property to Anime model #489

Closed ToshY closed 1 year ago

ToshY commented 1 year ago

Related to #486, following comment.

@irfan-dahir Related to this issue, there currently is no property in the Anime model which allows to get the raw airdate string. So I would suggest adding a property there, which can use the the getAnimeAiredString from the AnimeParser. If you're okay with that, I can make the PR.

irfan-dahir commented 1 year ago

Hi, you can get raw airdate by typecasting string to the DateRange object

It's returned like that in the RESTAPI as well: https://github.com/jikan-me/jikan-rest/blob/16560d3634c6a9116ad7234985aa4e84a11bd683/app/Providers/SerializerFactory.php#L69

'string' => (string)$obj,

In this case you'd have to typecast the following property when getting it: https://github.com/jikan-me/jikan/blob/ff4200940e1ab11a282a769ad32705e43972e813/src/Model/Anime/Anime.php#L97

(string) $anime->getAired()
ToshY commented 1 year ago

Totally missed that. Thanks @irfan-dahir !