MID-11078 Fix false dateTime updates due to seconds normalization in admin GUI#583
Open
MID-11078 Fix false dateTime updates due to seconds normalization in admin GUI#583
Conversation
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.
The admin GUI date picker operates at minute precision and drops seconds/milliseconds on submit.
The existing guard in XmlGregorianCalendarModel used GregorianCalendar.equals(...), which compares full calendar state (including timezone), not just the actual time value.
This caused false differences when:
-stored value contained seconds (e.g. 09:32:12),
-GUI round-trip produced 09:32:00,
-or calendars differed only in internal representation (e.g. timezone/configuration),
-even though both represented the same effective minute.
As a result, the GUI incorrectly overwrote values and preview showed spurious changes.
Solution
Replace strict GregorianCalendar.equals(...) with comparison of normalized minute-precision timestamps using getTimeInMillis() after stripping seconds and milliseconds.
This ensures:
-no change is produced when only GUI precision differs,
-false differences caused by calendar metadata (including timezone representation) are avoided,
-real differences in actual time are still detected.
In particular:
-real timezone differences → still cause update (correct)
-fake differences from calendar equality → no longer cause update (fixed)