Skip to content

fix: truncate asDate timestamps with 24-hour clock#10773

Merged
tglman merged 1 commit into
orientechnologies:developfrom
officialasishkumar:fix_asdate_midnight_truncation
May 11, 2026
Merged

fix: truncate asDate timestamps with 24-hour clock#10773
tglman merged 1 commit into
orientechnologies:developfrom
officialasishkumar:fix_asdate_midnight_truncation

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes asDate() so Date and numeric timestamp inputs are truncated with Calendar.HOUR_OF_DAY, producing midnight instead of noon for PM inputs. Adds regression coverage for both input paths.

Motivation

asDate() cleared the 12-hour Calendar.HOUR field and preserved the PM marker. Afternoon timestamps such as 2024-01-02 15:30:45.123 normalized to 2024-01-02 12:00:00.000 instead of 00:00:00.000.

Related issues

Fixes #10772

Additional Notes

Validation:

  • git diff --check
  • mvn -pl core -am -Dtest=OSQLFunctionConvertTest -Dsurefire.failIfNoSpecifiedTests=false test
  • mvn -pl core -am test (2,798 tests, 0 failures, 0 errors, 44 skipped)

Checklist

[ ] I have run the build using mvn clean package command
[x] My unit tests cover both failure and success scenarios

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.
@tglman tglman merged commit 0a013b6 into orientechnologies:develop May 11, 2026
19 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

asDate() normalizes afternoon timestamps to noon instead of midnight

2 participants