Skip to content

Conversation

@JymDyerIBI
Copy link
Contributor

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

Short time format for locale en_US generates a string designating hours and minutes, followed by an ASCII space and then "AM" or "PM". As of JDK 20, this space is replaced with narrow non-breaking space (NNBSP), so unit tests of strings containing these formatted times break.

An earlier fix used regular expressions for both formats (e.g. "[\\u202f ]PM") but this proved to be cumbersome and new unit tests were introduced with new hardcoded strings that also broke.

This fix introduces a helper method to test formatted strings against hardcoded strings that include a NNBSP, with a backup retry with a string that has a regular ASCII space. Our unit test cases are easier to read and maintain.

…formats that use "AM" or "PM" can be compared regardless of which JDK formatted the string.
…gex strings to handle JDK differences, and now use DateTimeUtils#equalsAmPm() for the comparison.
…ateTimeUtils#equalsAmPm() to do a string comparison that will work for multiple JDKs.
@JymDyerIBI JymDyerIBI self-assigned this Oct 10, 2025
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

Successfully merging this pull request may close these issues.

2 participants