DO NOT MERGE! example implementation of binding java.time types#5022
Closed
DO NOT MERGE! example implementation of binding java.time types#5022
Conversation
ewaterman
commented
Jan 31, 2025
| // WE SHOULD BE DOING THIS! I commented it out though because it has big implications for everywhere else that | ||
| // we parse in dates. We should definitely review this though. Without it, the default timezone that we parse | ||
| // dates to will change depending on where the app is hosted. | ||
| // TimeZone.setDefault(TimeZone.getTimeZone(ZoneOffset.UTC)) |
Member
Author
There was a problem hiding this comment.
This is probably worth discussion
ewaterman
commented
Jan 31, 2025
| givenDate || expectedResult | expectedToStringResult | scenario | ||
| // See how we input no tz information, but the server decides to treat it as local time (which for me currently | ||
| // is CST). If someone runs this test against a server in a different tz, it'll fail. Bad! | ||
| // To fix this, we need to add "TimeZone.setDefault(TimeZone.getTimeZone(ZoneOffset.UTC))" to BootStrap.groovy |
Member
Author
There was a problem hiding this comment.
This scenario is demonstrable right here in this PR. The tests fail in the GitHub Action because the Action runner is running in a different timezone than I am (UTC). https://github.com/openboxes/openboxes/actions/runs/13077910108/job/36494469201?pr=5022#step:4:13857
Base automatically changed from
ft/OBPIH-6965-support-binding-java-time-types
to
develop
February 12, 2025 15:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE!
This PR is an example implementation of how we could use the new java.time classes in our domain objects.
PR that adds data binding support of Instant and LocalDate: #5023
The main piece of information here is TestingDatesApiSpec, which I've commented on explaining the drawbacks of java.util.Date, mainly around the timezone that it defaults to. I also demonstrate how Instant and LocalDate fix the issue.
Feel free to leave comments here as well.
Once my other PR gets merged, I'll close this one. I only created it so we'd have something to reference when reviewing the other PR.