Enterprise: Locale: parseNumber does not parse correctly when locale has group of space

Created on 10 Oct 2019  Â·  17Comments  Â·  Source: infor-design/enterprise

Describe the bug
When a locale has a group (thousands separator) defined as a space, Soho.Locale.parseNumber() does not parse the value correctly.

test-number-with-group-of-space.zip

To Reproduce
Steps to reproduce the behavior:

  1. Unzip the test-number-with-group-of-space.zip to ep > app > views > components > mask
  2. Run http://localhost:4000/components/mask/test-number-parsing.html?locale=fr-FR
  3. Enter a value in the Number Field, enough digits to have a group separator and tab out
  4. The Parsed Number result field will only display the first digits

Expected behavior
The number should parse correctly

Version

  • ids-enterprise: v4.22.0-beta.0

Screenshots
image

parse-date-group-of-space

Platform

  • All

Additional context
It appears that the regular expression removing spaces does not work correctly.

[2] customer high landmark type

All 17 comments

Probably should be high priority as any customer using the Landmark Web with a locale that has a group of space would not be able to save their decimal values correctly as parseNumber() is used to transform the value from the locale to Landmark format.

I’ll take a look along with #2878 and see if they can be squashed together. Not 100 percent sure but I don’t believe any of the current supported locales have spaces. So this may be a new case

Use fr-FR as it does.
I think you want something like > .replace(new RegExp('\\' + group, 'g'), '')

Looks like quite a few do, 18 by my count.

Test FAILED
please see the screenshot for reference.

Browser: EDGE
locale=ar-SA
Expected Result

  • Number Field should display 1Ù¬234Ù¬567Ù«12
  • Parsed Number result field should display 1234567.12
    image

Browser: SAFARI
locale=ar-SA
Expected Result

  • Number Field should display 1Ù¬234Ù¬567Ù«12
  • Parsed Number result field should display 1234567.12
    image

Browser: IE11
locale=ar-SA
Expected Result

  • Number Field should display 1Ù¬234Ù¬567Ù«12
  • Parsed Number result field should display 1234567.12
    image

locale=en-US
Expected Result

  • Number Field should display 1,234,567.12
  • Parsed Number result field should display 1234567.12
    image

locale=es-ES
Expected Result

  • Number Field should display 1.234.567,12
  • Parsed Number result field should display 1234567.12
    image

locale=fr-FR
Expected Result

  • The Number Field should display 1 234 567,12
  • Parsed Number result field should display 1234567.12
    image

Browser: Firefox
locale=ar-SA
Expected Result

  • Number Field should display 1Ù¬234Ù¬567Ù«12
  • Parsed Number result field should display 1234567.12
    image

btw, ANDROID and iOS work perfectly fine in all four locales.

New fixes have been added for the noted cases.

Test Failed . Issue still persist except on the ff browsers and locales
-IE11 en-US
-IE11 es-ES
-IE11 fr-FR

Verified in http://master-enterprise.demo.design.infor.com/components/mask/test-number-parsing.html?

@jbrcna Can you please be more explicit about what is NOT working. I find it confusing that you say that the issue is still there except some browsers?

I

I think all the main cases are fixed here so probably just consider this done. Unless im missing some tests where it isnt working?

@tmcconechy, @jbrcna indicated issue still occurs on everything other than IE, but I just ran through all of the cases on the browsers with the link @jbrcna gave above and saw everything parsing correctly. It was only for Firefox with ar-SA that I had use the period for the decimal instead of pasting the value.

@fitzorama i noticed master was not updated after posting this. This could be why?

@tmcconechy I'm seeing all my changes in place

Ok it was effecting a few other PR's then. I will just move this to done as is. Im seeing it working ok

see screenshot for reference
image

image

image

image

Ah yeah thats because in Arabic the period is a different character. You would need an arabic keyboard to type it. So i think this is fine to ignore for now. @jbrcna

Thanks @tmcconechy .
I agree , I way over thought that :)

Was this page helpful?
0 / 5 - 0 ratings