language.thousands and language.decimal options do not work correctly for million-scale number input

language.thousands and language.decimal options do not work correctly for million-scale number input

faisallbhrfaisallbhr Posts: 4Questions: 1Answers: 0
edited December 2025 in Free community support

I am using DataTables SearchBuilder with numeric input and have configured the localization options:

language.thousands
language.decimal

These options seem to work correctly for thousand-scale numbers, but not for million-scale numbers.
Example that works as expected

Input:

88.208,03

Expected parsing result sent to backend:

88208.03

✅ This works correctly.
Example that does NOT work

Input:

33.109.205

Expected parsing result:

33109205

Actual result:

33109.205

❌ The parser incorrectly treats the last dot as a decimal separator instead of a thousands separator.

Expected Behavior

With:

language: {
  thousands: '.',
  decimal: ','
}

I expect all thousand separators to be removed correctly, regardless of the number length, and the value to be parsed as a pure number.

Actual Behavior

Works for values like 88.208,03

Fails for values like 33.109.205

The last separator is incorrectly interpreted as a decimal point.

Is this a limitation or a known issue in SearchBuilder’s numeric parser?
Is there a recommended way to handle locale-specific thousand separators for large numbers?

Answers

  • allanallan Posts: 65,465Questions: 1Answers: 10,874 Site admin

    Sounds buggy! Thanks for letting me know. I'll take a look in the new year, probably Friday.

    Allan

  • faisallbhrfaisallbhr Posts: 4Questions: 1Answers: 0

    Thanks Allan, appreciate it. Happy new year!

  • allanallan Posts: 65,465Questions: 1Answers: 10,874 Site admin

    I haven't been able to recreate this issue I'm afraid. Can you give me a link to your page, or create a test case, so I can take a look and debug it?

    Thanks,
    Allan

  • faisallbhrfaisallbhr Posts: 4Questions: 1Answers: 0
    edited January 3

    I couldn’t create a 100% identical test case for this issue, but the bug behaves more or less like what’s shown in this https://jsbin.com/sixijaw/edit?html,js,output

    The value sent to the backend is not what I expect.

    Note: data display is formatted from backend

  • allanallan Posts: 65,465Questions: 1Answers: 10,874 Site admin

    I see the problem now. Many thanks. I'll post back with a solution soon - possibly Monday.

    Allan

  • allanallan Posts: 65,465Questions: 1Answers: 10,874 Site admin

    I've made this commit to fix the issue. Updating the test case with the latest versions and the nightly build for SearchBuilder shows it to work as expected now. Note that decimal and thousands should be under the language object, not language.searchBuilder.

    Allan

  • faisallbhrfaisallbhr Posts: 4Questions: 1Answers: 0
    edited January 6

    Just tested it with the nightly build — looks good now. Thanks!
    Hopefully this will be included in the next release.

Sign In or Register to comment.