@internationalized/number: NumberParser misparses Arabic-digit numbers that use . , or ، (sd parses ١٬٢٣٤.٥ as 12345)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
adobe/react-spectrum のほかの issue
-
PreviewTrigger: the preview dialog has no accessible name対応中かも @therealemmanueloppong が 2 日前に担当しました。 オープンaccessibility bug PreviewTrigger
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
adobe/react-spectrum#10917 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
S2 quiet Picker menu is always 192px wide: its width calc() has no unit対応中かも @darshpatel1052 が 5 日前に担当しました。 オープンwaiting on author
難易度 2/5 1時間未満 初心者へのやさしさ 88/100
adobe/react-spectrum#10909 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
DatePicker omits timezone for initially empty fields despite zoned placeholderValue対応中かも @mrlexcoder が 5 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
adobe/react-spectrum#10900 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Separator adds a redundant role="separator" to its default <hr>対応中かも @Janani-bn が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
adobe/react-spectrum#10894 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
ComboBox with selectionMode="multiple": Cmd/Ctrl+A does nothing while the popover is open対応中かも @mangeshraut712 が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
adobe/react-spectrum#10866 ·
メンテナーはふだん 1 日以内に返信
adobe/react-spectrum の issue をすべて見る
似ている issue
-
Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-javascript#26203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytedance/flowgram.ai#1235 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
devswha/herdr-web-ui#3325 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100