Skip to content

Conversation

@qiichos
Copy link
Contributor

@qiichos qiichos commented Jun 20, 2025

Summary

Fixes a bug where year-less, slash-separated dates (e.g., 6/20(木)) failed to parse correctly when the lang: "ja" option was active.

Details

  • Reorders the conditional checks in the addYearToDateText function to prioritize generic date formats over language-specific ones.
  • The previous logic incorrectly formatted slash-separated dates as 2025年6/20(木), which broke the date parser.
  • The new logic ensures slash (/) and dash (-) formats are handled first, guaranteeing correct year supplementation.

Behavior Before vs. After

With options { useCurrentYearIfMissing: true, currentYear: 2025, lang: "ja" }:

Before

  • Input: "6/20(木)"
  • Result: Fails to detect weekday mismatch.

After

  • Input: "6/20(木)"
  • Result: 6/20(木) mismatch weekday.\n6/20(木) => 6/20(金)

Background

This patch addresses an edge case not covered in the initial implementation of the useCurrentYearIfMissing option (see #14), improving the rule's reliability for common date formats in Japanese.

@azu azu added the Type: Bug Bug or Bug fixes label Jun 20, 2025
Copy link
Member

@azu azu left a comment

Choose a reason for hiding this comment

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

thanks

@azu azu merged commit 7df7c65 into textlint-rule:master Jun 20, 2025
2 checks passed
@azu
Copy link
Member

azu commented Jun 20, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Bug or Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants