Opened 9 years ago
Closed 5 years ago
#14420 closed defect (patchwelcome)
dojo.number.parse() doesn't recognize numbers in "012,677.00" pattern
Reported by: | Evan | Owned by: | Adam Peller |
---|---|---|---|
Priority: | low | Milestone: | 1.13 |
Component: | Core | Version: | 1.6.1 |
Keywords: | number, parse, pattern | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Not sure if this an expected result or a defect, following usage will get a NaN
// ---> NaN dojo.number.parse("01,23.00", {pattern : '00,00.00', locale : 'en'});
While the result is correct for
// ---> 123 dojo.number.parse("1,23.00", {pattern : '00,00.00', locale : 'en'});
Please try the test case to see the observations.
Attachments (1)
Change History (9)
comment:1 Changed 9 years ago by
Cc: | [email protected]… added |
---|
Changed 9 years ago by
Attachment: | 14420 .html added |
---|
comment:2 Changed 9 years ago by
Priority: | normal → high |
---|
comment:3 Changed 9 years ago by
comment:4 Changed 9 years ago by
The Java number format syntax is a little odd. The common usage is 0 for required decimal places, and a single 0 to the left of the decimal point, with #'s everywhere else to represent optional digits. Usually you'd only put enough digits to show the first separator (i.e. thousands: #,##0) Anything beyond that is probably not used unless there's a second thousands separator -- to support the Indian number format which uses a mixture of two different groupings, something like #,##,###.0
The error you show above only seems to happen when the leading number is a '0', so I think that might be the bug you're after. Other inputs seem to work fine. We don't have a test case with a leading zero and a thousands separator.
comment:5 Changed 9 years ago by
Milestone: | → tbd |
---|
comment:7 Changed 9 years ago by
Priority: | blocker → low |
---|
comment:8 Changed 5 years ago by
Milestone: | tbd → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
Given that no one has shown interest in creating a patch in the past 4+ years, I'm closing this as patchwelcome.
I think the second example should actually fail because 0 implies a mandatory digit, so both tests are failing