andersnm / ExcelNumberFormat

Parse and render Excel number format strings
MIT License
79 stars 27 forks source link

Date number format with comma drops commas #22

Closed andersnm closed 4 years ago

andersnm commented 4 years ago

Reported in https://github.com/ClosedXML/ClosedXML/issues/1274

    Test(new DateTime(2017, 10, 16, 0, 0, 0), "dddd, MMMM d, yyyy", "Monday, October 16, 2017");
    Expected string length 24 but was 22. Strings differ at index 6.
    Expected: "Monday, October 16, 2017"
    But was:  "Monday October 16 2017"

This happens because FormatLiteral() ignores commas in all kinds of formats. Commas are used for thousand division in numeric number formats, but apparently not in date formats.