avram icon indicating copy to clipboard operation
avram copied to clipboard

validate_numeric shows wrong message when using floats

Open jwoertink opened this issue 3 years ago • 0 comments

https://github.com/luckyframework/avram/blob/549639bb956a3f59d409800714e0021d722b4d66/src/avram/i18n_backend.cr#L17-L18

Using this code:

validate_numeric number, greater_than: 0.01, less_than: 0.99

Would show the error "must be less than 0" or "must be greater than 0" since the string uses %d instead of %f. Though, even with %f, you'll get floating precision like must be less than 0.990000

jwoertink avatar Jul 19 '22 18:07 jwoertink