fix: truncate asDate timestamps with 24-hour clock#10773
Merged
tglman merged 1 commit intoMay 11, 2026
Merged
Conversation
asDate() cleared Calendar.HOUR, leaving the PM marker unchanged for afternoon Date and millisecond inputs. That normalized 15:30 to 12:00 instead of 00:00. Use HOUR_OF_DAY when clearing the time portion and cover both Date and numeric timestamp conversions.
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.
What does this PR do?
Fixes
asDate()soDateand numeric timestamp inputs are truncated withCalendar.HOUR_OF_DAY, producing midnight instead of noon for PM inputs. Adds regression coverage for both input paths.Motivation
asDate()cleared the 12-hourCalendar.HOURfield and preserved the PM marker. Afternoon timestamps such as2024-01-02 15:30:45.123normalized to2024-01-02 12:00:00.000instead of00:00:00.000.Related issues
Fixes #10772
Additional Notes
Validation:
git diff --checkmvn -pl core -am -Dtest=OSQLFunctionConvertTest -Dsurefire.failIfNoSpecifiedTests=false testmvn -pl core -am test(2,798 tests, 0 failures, 0 errors, 44 skipped)Checklist
[ ] I have run the build using
mvn clean packagecommand[x] My unit tests cover both failure and success scenarios