Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-18400: Don't use YYYY when formatting/parsing dates in Java client #18404

Merged
merged 4 commits into from
Jan 11, 2025

Conversation

kirktrue
Copy link
Collaborator

@kirktrue kirktrue commented Jan 6, 2025

Changing documented date format to be ISO 8601 vs. SimpleDateFormat.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Correcting documented use of YYYY to be yyyy as used by SimpleDateFormat format.
@kirktrue
Copy link
Collaborator Author

kirktrue commented Jan 6, 2025

Needs unit tests.

@github-actions github-actions bot added triage PRs from the community tools small Small PRs labels Jan 6, 2025
Copy link
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I understand the distinction between year and week year, and it is certainly the case that the formatting and parsing should be using year (yyyy) and not week-year (YYYY). However, I feel the change of capitalisation of the format examples in the help messages is unhelpful to actual humans. If you want to be really pedantic about the use of SimpleDateFormat, the seconds and milliseconds should be ss.SSS, not SS.sss. However, in the help string, it's pretty clear what is meant.

@github-actions github-actions bot removed the triage PRs from the community label Jan 7, 2025
Copy link
Member

@AndrewJSchofield AndrewJSchofield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are correcting YYYY to yyyy, you should also correct SS.sss to ss.SSS since "s" is seconds and "S" is milliseconds for SimpleDateFormat.

@kirktrue kirktrue marked this pull request as ready for review January 9, 2025 22:08
@kirktrue
Copy link
Collaborator Author

kirktrue commented Jan 9, 2025

The format that is used to parse the user-supplied timestamp is ISO 8601-based. The question is: Should we present to the user the date format in terms of the ISO spec or that of SimpleDateFormat? I don't want to bikeshed this PR, but my preference is to keep the internals separate from the user-facing documentation.

@AndrewJSchofield
Copy link
Member

The format that is used to parse the user-supplied timestamp is ISO 8601-based. The question is: Should we present to the user the date format in terms of the ISO spec or that of SimpleDateFormat? I don't want to bikeshed this PR, but my preference is to keep the internals separate from the user-facing documentation.

I agree. I think what you've done here is appropriate.

@AndrewJSchofield AndrewJSchofield merged commit 403fe71 into apache:trunk Jan 11, 2025
9 checks passed
askew pushed a commit to askew/kafka that referenced this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants