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.
👇 Click on the image for a new way to code review
####
[![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/tealeg/xlsx/781/f7822e46/1dc43d5ae35efce8a72eb21888cc206a7715c370.svg)](https://app.codesee.io/r/reviews?pr=781&src=https%3A%2F%2Fgithub.com%2Ftealeg%2Fxlsx)
#### Legend
In
format_code.go:248-254
, it was documented thatApparently 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
isTimeFormat
as identifier forisTimeFormat
for the parsed format stringBtw, 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.