Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeParseException on POST /images #223

Open
kamathprasad9 opened this issue Jun 24, 2024 · 1 comment
Open

DateTimeParseException on POST /images #223

kamathprasad9 opened this issue Jun 24, 2024 · 1 comment

Comments

@kamathprasad9
Copy link

I am trying to make the POST /images call from Field Book which uses the BrAPI Java client package. I noticed an issue regarding the timestamps that Breedbase is sending back for the call:
org.brapi.client.v2.model.exceptions.ApiException: j$.time.format.DateTimeParseException: Text '2024-06-17T15:16:24-0400' could not be parsed, unparsed text found at index 22

The abovementioned timestamp follows the formats mentioned in the BrAPI docs, but still we are not able to parse the response as intended. We can make a quick fix by changing the response from Breedbase, but I feel it is best if we address this issue in BrAPI client package

@bellerbrock
Copy link

bellerbrock commented Jun 26, 2024

Here's a PR that should fix the issue in breedbase

In this codebase we could also update TimeAdapter.java with a custom formatter to handle the absence of : in the offset, but I think it'd be better to keep it as it is and instead update the BrAPI docs to match the offset options allowed by the java DateTimeFormatter

It's already pretty flexible, and includes

Z - for UTC (ISO-8601)
+hh:mm or -hh:mm - if the seconds are zero (ISO-8601)
+hh:mm:ss or -hh:mm:ss - if the seconds are non-zero (not ISO-8601)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants