Skip to content

Inconsistent separator handling #35

Closed
@te1

Description

@te1

Handling of decimal separator doesn't quite work if you want to use a comma instead of a dot.

Steps to reproduce

  • Go to https://kevinongko.github.io/vue-numeric
  • Select "use '.' as separator" (this is the thousand separator)
  • Enter Value "1,2" (with a comma) and leave (blur) input
  • Focus input, it now says "1.2" (with a dot) but should be "1,2" (with a comma)
  • Add 3 to the input and leave (blur) input
  • Value is now 123.0 but should be 1.23

I got it to work by changing the the following

onFocusHandler () {
  this.amount = accounting.formatNumber(this.valueNumber, {
    precision: Number(this.precision),
    decimal: this.decimalSeparator,
    thousand: ''
  })
}

but this breaks #26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions