Closed dantronik-bugreporting closed 1 year ago
Yes, you are right. I've only managed to move the problem. I've been looking into this and it looks like the conditional patterns have more complex rules around them than I had previously thought. I am in the process of trying to discover how they actually work.
numfmt@2.4.3 is up on npm and includes a fix for this.
I'm sorry for this shameless copy of #27, but the bug fix caused the same issue in reverse (positive numbers get displayed as negative numbers).
Here's a shameless copy of the text of #27 with the stuff adapted.
We have the following number format string in the German version of Excel:
[>=100]#.##0;[<=-100]-#.##0;#.##0,00
If we format the number -3,96 with it, the number gets output properly as -3,96.
In order to use the number format string with numfmt, we swap the "," and "." characters (because thousands separator and decimal separator are swapped in German), like so:
Which gives me
'[>=100]#,##0;[<=-100]-#,##0;#,##0.00'
Interestingly enough, the positive number 6 gets formatted as -6.00.