Skip to content

The toString and toPlainString methods return an empty string for the input 0, which is incorrect #15

@se8820726

Description

@se8820726

I use this library for formatting dollar prices.
Now, if I pass the number 0 as input to the toString() or toPlainString() methods, it returns an empty string '' , which is incorrect and should return $0 .

example:

import { NumberFormatter } from 'reduce-precision';

const formatter = new NumberFormatter({
    language: 'en',
    template: 'usd',
    precision: 'auto',
});

const formattedPrice = formatter.toString(0) //--- returns '' but should return $0

const formattedPrice = formatter.toPlainString(0) //--- returns '' but should return $0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions