aurelia / validation

A validation plugin for Aurelia.
MIT License
132 stars 128 forks source link

isNumber() rule not working for de-DE locale for decimal numbers #202

Closed valichek closed 8 years ago

valichek commented 8 years ago

isNumber() rule not working for de-DE locale for decimal numbers like 1,00

valichek commented 8 years ago

here is lines of code https://github.com/aurelia/validation/blob/master/src/validation-rules.js#L348-L352:

let numericRegex = locale.setting('numericRegex');
        let floatValue = parseFloat(newValue);
        return !Number.isNaN(parseFloat(newValue))
          && Number.isFinite(floatValue)
          && numericRegex.test(newValue);

floatValue will always be NaN if I enter number string like 1,22 We need here some number parser that uses locale settings like https://github.com/jquery/globalize#number-module. And I think other rules that check numbers like Min, Max, Between, etc will not work with localized strings.

@EisenbergEffect Also it looks like we need some localization module globally in aurelia, Because in aurelia-i18n there is NumberFormatter, but it cannot parse string back to Number.

And all these issues just make impossible using localized validation.

EisenbergEffect commented 8 years ago

@zewa666 @PWKad Can you two collaborate on this?

plwalters commented 8 years ago

Thanks for submitting this / commenting on this. At this time we are closing this because we have completely re-written and are deprecating the previous feature set. If you feel this should be re-opened please feel free to review this blog post and submit either again on this repository, or on the new validatejs bridge repository

Thanks again!