Skip to content

Date incorrectly formatted when format code starts with [$-F800] #41

@GradlonGwen

Description

@GradlonGwen

In a workbook created with Excel 365 on a French system, i have this format: "[$-F800]dddd,\ mmmm\ dd,\ yyyy".

<numFmt formatCode="[$-F800]dddd\,\ mmmm\ dd\,\ yyyy" numFmtId="164"/>

In Excel, this is displayed like this: "jeudi 25 juillet 2024".

image

Using ExcelNumberFormat API, With the culture set to "Fr-fr" and using the value 45498, the output of the formatting will be: "jeudi, juillet 25, 2024", which is not a valid French representation of a date.

It seems that usually these kind of codes "[$-HEX CODE]" refers to locale code, but in this case, I did not find any formal documentation about this particular code "[$-F800]".
According to exchanges on the internet, it seems to refer to the system long date format (and therefore ignore the formatting coming after the square brackets?).

In ExcelNumberFormat.Parser.ParseSection code, I understand that this code is not interpreted.
Actually, it fells in the TryParseCurrencySymbol case.
Thus, only the part after the square brackets are used for the formatting, resulting in the incorrect string value mentionned above.

I am wondering if someone knows about that, and if they know how to manage such conditions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions