#10701 closed defect (fixed)
type:percent parsing problem in number.parse
Reported by: | Douglas Hays | Owned by: | Adam Peller |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | Core | Version: | 1.4.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I'm trying to add type:percent support to NumberTextBox? but I can't get some simple examples to work.
dojo.number.parse("12%", {places:0, locale: "en-us", type: "percent"}) returns 0.12 so that seems right except places:0 must only apply to the input format and not the output. dojo.number.parse("12.3%", {places:0, locale: "en-us", type: "percent"}) returns NaN so I guess that's because of places:0. dojo.number.parse("12.3%", {places:1, locale: "en-us", type: "percent"}) returns NaN and I don't understand why.
It looks like percent only works with places:0 .
Getting this to work is a prereq for #10582.
Change History (5)
comment:1 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Status: | new → assigned |
comment:2 Changed 11 years ago by
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 Changed 11 years ago by
Note: See
TracTickets for help on using
tickets.
Apparently this stems from the fact that percentFormat in the CLDR is given as "#,##0%" which the code interprets as accepting only whole numbers, regardless of the decimal setting. "#,##0.###%" would seem more consistent with numberFormat. We may need to provide a special case in the code here.