andersnm / ExcelNumberFormat

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

Fix issue when fromat string starts with [$-F800] and [$-F400] #42

Open GradlonGwen opened 3 months ago

GradlonGwen commented 3 months ago

Fix bug described in issue #41 where the formatted date was incorrect when the format started with "[$-F800]".

Even if not really documented (or very hard to find), locale id F800 seems to refer to the system long date. This PR adds code to parse totally the locale id, and use it in the parser for date and time.

When parsing the date, if the locale id is F800, then the culture LongDatePattern is used instead of the tokens found with the tokeniser.

When parsing the date, the tokens are replaced with tokens generated from the culture LongTimePattern.