Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow recognition of time format in multisection numFormat #781

Merged

Conversation

benedictjohannes
Copy link
Contributor

In format_code.go:248-254, it was documented that

Time formats cannot have multiple groups separated by semicolons, there is only one format.
Strings are unaffected by the time format.

Apparently Excel 2021 has a default numFormat option that violate that condition: m/d/yy\ h:mm;@
It has two formatting sections. Here is a video I recorded in creating this Excel file.

This commit/PR allows recognition of time format when more than one numFormat section is present, with

  • first / positive section having isTimeFormat as identifier for isTimeFormat for the parsed format string
  • formatting for time formatted cell is taken from first/positive section's full format string.

Btw, I am coding an Excel parser that needs to cellRef.IsTime() to accurately identify date/time cells. This was the original issue that propelled me to observe and contribute.

@ghost
Copy link

ghost commented Sep 13, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link
Owner

@tealeg tealeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@tealeg tealeg merged commit 61c977e into tealeg:master Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants