Skip to content

using s format in 0 return 0y #2595

Closed
Closed

Description

@UlTriX

Activity

  1. mbostock commented on Oct 23, 2015

    @mbostock
    Member

    I can’t reproduce this issue.

    d3.format("s")(0) // "0"
    d3.formatPrefix(0) // {symbol: ""}

    Also, I’d be curious if you can reproduce this problem in the new d3-format repo, which will be the 4.0 implementation.

  2. UlTriX commented on Oct 23, 2015

    @UlTriX
    Author

    I forgot to mention that it was d3.format("s")("0") that returned 0y

    With other string values works fine. It was not supposed to work with strings?

  3. added
    bug
    on Oct 23, 2015
  4. added this to the 3.5.7 milestone on Oct 23, 2015
  5. added a commit that references this issue on Oct 23, 2015
    07a8737
  6. mbostock commented on Oct 23, 2015

    @mbostock
    Member

    Great, thanks. Fixed the type coercion bug. Generally speaking it’s a bad idea to pass in the wrong type (and d3.format expects a number), but we should coerce to the right type, and I’ve fixed that bug in d3.formatPrefix, and by extension d3.format. Staged for 3.5.7 in #2591.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions