GithubHelp home page GithubHelp logo

Comments (10)

villu164 avatar villu164 commented on August 27, 2024 3

https://github.com/shaack/bootstrap-input-spinner/pull/62/files
ran into same issue, created fix

from bootstrap-input-spinner.

Roman- avatar Roman- commented on August 27, 2024

An easy fix can be to replace this line
var thousandSeparator = numberFormat.format(1111).replace(/1/g, '')
with this
var thousandSeparator = numberFormat.format(1111).replace(/1/g, '') | ' '

from bootstrap-input-spinner.

shaack avatar shaack commented on August 27, 2024

Hi, thanks for reporting. Okay, I switched the locale to russian, but get no error. Which Browser and OS? In Chrome, it seems to work.
Bildschirmfoto 2019-11-14 um 10 31 52

from bootstrap-input-spinner.

Roman- avatar Roman- commented on August 27, 2024

Okay, looking deeper, after line 246 I've added this to debug:
console.log(locale, numberFormat.format(1111));
and it gave me this: es-AU 1111
My Chrome version: Version 78.0.3904.97 (Official Build) (64-bit)

from bootstrap-input-spinner.

Roman- avatar Roman- commented on August 27, 2024

Yep, I've forgotten that I've decided to learn Spanish language and have added Spanish (apparently in Google settings) to the list of languages.
One way or another, this regex construction '\\' + thousandSeparator assumes that thousandSeparator has to be strictly one character long string (not always true) that has to be escaped in regex (also may not be true). This is a dangerous assumption which may cease to work in some cases, like with the es-AU locale here.
One more notice is that my OS is Ubuntu 16.04 LTS.

from bootstrap-input-spinner.

shaack avatar shaack commented on August 27, 2024

You are right. Looks like the localization feature needs to be reworked. Do you have an idea how to fix it? I can think about it next week, this week I have to much customer stuff to do.

from bootstrap-input-spinner.

shaack avatar shaack commented on August 27, 2024

I found some ideas here: https://stackoverflow.com/questions/11665884/how-can-i-parse-a-string-with-a-comma-thousand-separator-to-a-number

from bootstrap-input-spinner.

villu164 avatar villu164 commented on August 27, 2024

@shaack, any progress?

from bootstrap-input-spinner.

czachor avatar czachor commented on August 27, 2024

Same here with Polish locale.

Firefox reports an error in the console when I'm trying to insert input's value manually:

SyntaxError: \ at end of pattern 3 plugins.js:274:14
parseLocaleNumber https://localhost/foobar/js/plugins.20161010.js:269
inputSpinner https://localhost/foobar/js/plugins.20161010.js:122
jQuery 5
dispatch
handle
trigger
simulate
i

In Chrome:

Uncaught SyntaxError: Invalid regular expression: //: \ at end of pattern
at new RegExp ()
at parseLocaleNumber
at HTMLInputElement.
at HTMLInputElement.dispatch (jquery-3.5.1.min.js:2)
at HTMLInputElement.v.handle (jquery-3.5.1.min.js:2)

from bootstrap-input-spinner.

shaack avatar shaack commented on August 27, 2024

Fixed with 1e3de85

from bootstrap-input-spinner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.