@internationalized/number: NumberParser misparses Arabic-digit numbers that use . , or ، (sd parses ١٬٢٣٤.٥ as 12345)

オープン 初心者向け
#10,936 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@itsrayeedscodespace がすでに取り組んでいます。

2026年11月8日 から。

  • #10939 @itsrayeedscodespace による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript

調査の方向性

まず @internationalized/number のソースにある NumberParserImpl.sanitize() を読み、数体系 arab の分岐と、ロケールの小数記号および桁区切り記号の処理に注目してください。提供された Node.js スクリプトで issue のケースを再現し、関連する parser テストを確認して、期待される網羅性を確かめてください。完了の条件は、列挙された sd、pa-u-nu-arab、ur-u-nu-arab のケースで書式化された値が round-trip し、ar との比較も引き続き正しいことです。

索引モデルが issue の本文から書いたものです。

説明

Provide a general summary of the issue here

NumberParser.parse does not round-trip the output of NumberFormatter for locales whose numbering system is arab but whose separators are ., , or ، (U+060C). This includes Sindhi (sd), where arab is the default.

🤔 Expected Behavior?

parse(format(x)) === x: 1234.5, 12.5, 0.25 and 1234.5 for the cases below.

😯 Current Behavior
١٬٢٣٤.٥
12345
1250
25
NaN
1234.5

(Lines 2 to 5 should be 1234.5, 12.5, 0.25, 1234.5; the last line is ar for comparison and is correct.)

StackBlitz Reproduction

Not applicable: the bug is in @internationalized/number alone and reproduces with the plain Node.js script below.

🖥️ Steps to Reproduce
import {NumberFormatter, NumberParser} from "@internationalized/number";

const roundTrip = (locale, options, value) =>
  new NumberParser(locale, options).parse(new NumberFormatter(locale, options).format(value));

console.log(new NumberFormatter("sd").format(1234.5));
console.log(roundTrip("sd", {}, 1234.5));
console.log(roundTrip("sd", {style: "currency", currency: "USD"}, 12.5));
console.log(roundTrip("pa-u-nu-arab", {}, 0.25));
console.log(roundTrip("ur-u-nu-arab", {}, 1234.5));
console.log(roundTrip("ar", {}, 1234.5));

Run with node rt.mjs.

💁 Possible Solution

In NumberParserImpl.sanitize(), the numberingSystem === 'arab' branch always replaces , and ، with the decimal symbol and . with the group symbol. For sd/pa-u-nu-arab, . is already the decimal symbol and gets turned into a group separator; for ur-u-nu-arab, , is the group symbol and becomes a second decimal. Skipping a replacement when the character is already the locale's decimal or group symbol would keep the ar keyboard fallback working.

🔦 Context

Parsing numbers that the same package formatted, e.g. in a NumberField for these locales.

Version

@internationalized/[email protected], also main at 82959b6a9ac4ea717228636b99fc8fd24736a7f4 (src run directly)

What browsers are you seeing the problem on?

Other

If other, please specify.

Node.js v26.13.0 (ICU 78.3, CLDR 48.0)

What operating system are you using?

Linux (Debian 12)

🧢 Your Company/Team

N/A

🕷 Tracking Issue

N/A

Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.

Credit: https://ucsbplse.github.io/

主要言語
TypeScript
スター
16k
フォーク
1.6k
平均マージ
4日 3時間
マージ済み PR(30日)
39

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

adobe/react-spectrum のほかの issue

adobe/react-spectrum の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。