adapt localize input to remove ',' separator and replace with '.'
This commit is contained in:
parent
c8354c76ff
commit
068e5cb776
1 changed files with 1 additions and 1 deletions
|
@ -8,7 +8,7 @@ module LocalizeInput
|
|||
separator = I18n.t("separator", scope: "number.format")
|
||||
delimiter = I18n.t("delimiter", scope: "number.format")
|
||||
input.gsub!(delimiter, "") if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter
|
||||
input.gsub!(separator, ".") # Replace separator with db compatible character
|
||||
input.gsub!(separator, ".") or input.gsub!(",", ".") # Replace separator with db compatible character
|
||||
input
|
||||
rescue
|
||||
Rails.logger.warn "Can't localize input: #{input}"
|
||||
|
|
Loading…
Reference in a new issue