ProMotion-XLForm icon indicating copy to clipboard operation
ProMotion-XLForm copied to clipboard

:decimal only for part of the world

Open jeanmartin opened this issue 10 years ago • 2 comments

Using the :decimal type in countries that use ',' as the decimal seperator (instead of '.') causes the value to be truncated (2,75 => 2.00).

According to http://stackoverflow.com/questions/11487850/decimal-point-in-uikeyboardtypedecimalpad-cant-be-used-in-mathematical-calculat a localizedScannerWithString (NSScanner) would need to be used. I however have no idea where to apply this.

jeanmartin avatar Nov 19 '15 00:11 jeanmartin

To reproduce simply switch the settings in your simulator to e.g. "Germany". Now the keypad for :decimal will display a ',' as the separator. Enter "2,74" and then leave the field, it will now show "2".

jeanmartin avatar Nov 19 '15 11:11 jeanmartin

You're right. Looking at https://github.com/xmartlabs/XLForm/blob/master/XLForm/XL/Cell/XLFormTextFieldCell.m#L278 the only think it does is a doubleValue

I guess it's more a XLForm issue. Maybe you can report it on their repo.

bmichotte avatar Nov 20 '15 07:11 bmichotte