Date Formatting Bug in Anime with Only a Year

Issue #32 resolved
Michael Johnson created an issue

Found this in the server error logs:

PHP Fatal error: Call to a member function format() on a non-object in ***/src/Atarashii/APIBundle/Parser/AnimeParser.php on line 131

That's the start date parser.

Looking at the access logs, I'm not seeing any anime detail requests around that time, but I do see a search for "no no pessimist". Since that returns a single result (anime #23029), the standard anime parser would be run. That show only has a year listed, so it looks like that's tripping up the parser.

Comments (11)

  1. Ratan Dhawtal

    Can you put me in charge of this issue? I found a few other exceptions & I got the feeling that you're busy.

  2. Michael Johnson reporter
    • changed status to open

    Not fully fixed. Dates with only a year now return the current month and day. I'm not sure if we want to do this.

  3. Michael Johnson reporter

    The old Ruby API just returns the year. Maybe we should do so as well.

    Actually, ISO 8601 allows for just a year, so it would be valid for the future as well. We'd just need to make sure that returning a reduced date will work properly in our reference application (Atarashii).

  4. Ratan Dhawtal

    The same problem exists with the result that only return the month. The formatter is also returning the day.

    I'm not sure how Atarashii is formatting the dates. If we change it into a year the formatter will probably crash.

    I can create a simpleformatter that is using the switch method depending on the date length for Atarashii. We could release then the beta 2 an push a few days later the fix to the server.

    Note: I think atarashii isn't using the dates...I will test it later.

  5. Michael Johnson reporter

    I don't think the dates are used for the anime. Manga doesn't currently provide dates, although it would be nice to do so once the API starts changing.

  6. Log in to comment