Skip to content

fix(zh): parse three-character Chinese numeral days in zh.hant dates - #682

Open
b84330808 wants to merge 1 commit into
wanasit:masterfrom
b84330808:fix/zh-hant-three-char-numeral-day
Open

b84330808 wants to merge 1 commit into
wanasit:masterfrom
b84330808:fix/zh-hant-three-char-numeral-day

Conversation

@b84330808

Copy link
Copy Markdown

The zh.hant date parser only allows one or two Chinese numerals for the day, so any day written with three characters gets cut off:

  • 十月二十四日 → Oct 20 (expected Oct 24)
  • 十二月三十一號 → Dec 30 (expected Dec 31)

Because the match stops early, a following time also doesn't merge: 十月二十四日下午三點 comes back as two separate results.

zh.hans already allows up to three numerals here and parses these correctly, so this change makes the zh.hant day group match it ({1,2} → {1,3}). The month group stays as is since months never need three characters.

Added a test to zh_hant_date.test.ts covering both examples; it fails on master and passes with this change. The full test suite passes.

I used Claude Code to write this change.

The zh.hant date parser only accepted one or two Chinese numerals for the
day, so days such as 二十四 or 三十一 were cut short: "十月二十四日" was
read as October 20 and "十二月三十一號" as December 30. Allow up to three
numerals, as the zh.hans parser already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant