sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

Number format with condition that matches negative numbers gives incorrect output

Open snoopyjc opened this issue 5 years ago • 1 comments

Format with a condition and including a - sign loses the extra - sign:

console.log(SSF.format('[<=9999999]###\\-####;\\(###\\)\\ ###\\-####', -12.3))
-12.3

Excel gives --12.3 (one from the \- and one from the negative number).

Possibly related, this one is wrong too:

console.log(SSF.format('[=0]?;#,##0.00', -12.3))
12.3

(loses the - sign)

snoopyjc avatar Sep 30 '20 22:09 snoopyjc

This one was difficult!!

Found another bad test case in oddities.json:

  ["[Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'",
     [50, "50 "],[0,"0p"],[-25,"-25 "],["foo","foo'"]],

should be:

  ["[Red]General ;[Blue]General\\ ;[Green]Generalp;[Yellow]General'",
     [50, "50 "],[0,"0p"],[-25,"25 "],["foo","foo'"]],

snoopyjc avatar Oct 05 '20 02:10 snoopyjc