Skip to content

Fix date formatter patterns and text block equivalence#14

Merged
brunoborges merged 3 commits intomainfrom
copilot/fix-java-code-flaws
Feb 17, 2026
Merged

Fix date formatter patterns and text block equivalence#14
brunoborges merged 3 commits intomainfrom
copilot/fix-java-code-flaws

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Reddit feedback identified two code correctness issues: incorrect ISO-8601 date patterns and non-equivalent text block examples.

Changes

DateTimeFormatter pattern: yyyy-MM-dduuuu-MM-dd

DateTimeFormatter should use uuuu (proleptic year) for ISO-8601 compliance, not yyyy (year-of-era). SimpleDateFormat retains yyyy as it doesn't support uuuu.

Before:

DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");

After:

DateTimeFormatter fmt = DateTimeFormatter.ofPattern("uuuu-MM-dd");

Files: date-formatting.html, java-time-basics.html, hex-format.html, duration-and-period.html, index.html, data/snippets.json

Text block closing delimiter placement

Text blocks had trailing newlines before """, making them non-equivalent to their concatenated counterparts.

Before (produces extra trailing newline):

String sql = """
    SELECT u.name
    ORDER BY u.name
    """;

After (equivalent output):

String sql = """
    SELECT u.name
    ORDER BY u.name""";

Files: text-blocks-for-multiline-strings.html, multiline-json-sql.html, data/snippets.json

Screenshots

Text Blocks Fix

Text blocks comparison

Date Formatting Fix

Date formatting fixed

Multiline SQL Fix

Multiline SQL fixed

Original prompt

This section details on the original issue you should resolve

<issue_title>Issues from reddit</issue_title>
<issue_description>1. Stream::toList mentionen twice. Not that it matters much in practice, but DateTimeFormatter.ofPattern("yyyy-MM-dd") should probably be DateTimeFormatter.ofPattern("uuuu-MM-dd").

  1. The java code has flaws. For example, the code selections for multiline strings are not equivalent. I only checked a few of them.

Plus, the content is AI slop:

"Why the modern way wins: point one, point two, point three"

  1. The one for Compact Source Files is wrong. It should be IO.println, not println.

  2. Things like Files.newBufferedReader and default UTF-8 are also nice to mention.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 17, 2026 00:22
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
…matter

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues in Java code related to formatting and selections Fix date formatter patterns and text block equivalence Feb 17, 2026
Copilot AI requested a review from brunoborges February 17, 2026 00:26
@brunoborges brunoborges marked this pull request as ready for review February 17, 2026 00:34
@brunoborges brunoborges merged commit fef2e26 into main Feb 17, 2026
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.

Issues from reddit

2 participants