-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handling culture #9
Comments
Hmm... The W3C spec requires the use of a period as the decimal separator, but does allow for displaying the value in different formats according to regional preferences. But it still has to be submitted in the standard format, with the period, so this needs to be fixed on the server side. Perhaps this could be done by swapping out the input for a hidden field for submission and a text input for display. But then we don't want to break or override browsers that already have native support for number inputs... hmm... |
Right, that neatly sums up the exact same thoughts I had about this. It's understandable the spec describes the way data is sent to the server, but you do want the client and server to be in sync as to what their formatting is. |
We really don't want to deal with syntactic ambiguities (does "12.345" mean twelve thousand three hundred forty-five, or twelve and three hundred forty-five one-thousandths?), especially in a multi-regional application, so requiring the data to be submitted in a standard format makes sense. While we could convert formats for display and input, looking at the current native implementations, I'm not sure how to handle that. Chrome and Safari don't let you type a comma in number inputs. This could be problematic. |
I think this should be fixed to behave the same like Chrome:
With this in place the server doesn't have to care about any local format at all when rendering/processing the input fields. This is very convenient in Chrome but unfortunately doesn't work in IE. The decimal separator could probably be autodetected as described here: |
I am using the polyfill in a globalized application. The culture on the serverside changes to whatever the users preference is. The polyfill seems to follow a default culture, which is causing problems.
Example:
I enter "4.6" in a textbox and submit the form.
On the server side (ASP.NET MVC) the value is parsed and my double reads "46". That's because in the Dutch culture settings, the comma is used as a decimal seperator. So the correct value should have been "4,6".
I use the jQuery globalize plugin (https://github.com/jquery/globalize) for formatting based on culture. It would be great if the polyfill would follow that culture.
The text was updated successfully, but these errors were encountered: