← 输入框|github.com|刷新
Skip to content

Read aaa and aaaa as day of the week date codes - #796

Merged
appel1 merged 1 commit into
ExcelDataReader:developfrom
zzoraemon043:fix/weekday-date-codes
Nov 30, 2026
Merged

appel1 merged 1 commit into
ExcelDataReader:developfrom
zzoraemon043:fix/weekday-date-codes

Conversation

@zzoraemon043

Copy link
Copy Markdown
Contributor

aaa and aaaa are the day of the week codes in Excel number formats. The parser only knows am/pm and a/p for a, so a format that shows only the weekday has no date part and is a syntax error. A cell formatted as aaa or (aaa) is read as a double instead of a DateTime. Formats that also have m, d or y, such as m/d (aaa), were already dates.

Excel 365, serial 45306.25:

Format Excel shows
aaa 週一
aaaa 星期一
(aaa) (週一)
[$-411]aaa 月
aaaaa 星期一 (Excel saves it as aaaa)
AAA 週一 (Excel saves it as aaa)
aa aa (Excel escapes it as \a\a)

The change reads three or more a as one token and counts it as a date part. A single a or aa is unchanged, as are am/pm and a/p.

Tests: new cases in DateTokensMatchAsciiCaseOnly and FormatClassification_PreservesEndOfInputAndSections. Before the change 7 of them fail; after it dotnet test ExcelDataReader.slnx -c Release passes on net10.0, net11.0 and net462, and the Release build with TreatWarningsAsErrors=true has no warnings. ClassificationMatchesUnchangedParser still matches the snapshot.

I left the era year code e out. Reading a bare e as a date part changes 9 snapshot entries built from \General (the escaped G leaves eneral), so that needs a decision on the snapshot first.

@appel1
appel1 merged commit 1e6fee8 into ExcelDataReader:develop Nov 30, 2026
zzoraemon043 added a commit to zzoraemon043/zzoraemon043 that referenced this pull request Nov 30, 2026
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