Skip to content

Parse 24:00:00 as midnight in xsd:time values - #1511

Open
noooooooookro wants to merge 1 commit into
mvantellingen:mainfrom
noooooooookro:fix/xsd-time-midnight
Open

noooooooookro wants to merge 1 commit into
mvantellingen:mainfrom
noooooooookro:fix/xsd-time-midnight

Conversation

@noooooooookro

Copy link
Copy Markdown

A SOAP response containing <end>24:00:00</end> currently gives the caller None. XML Schema allows this spelling of midnight, but Python’s datetime.time rejects hour 24.

Normalize the hour before parsing an end-of-day value so the caller gets midnight with the offset from the response. A nonzero minute, second, or fractional second still makes hour 24 invalid.

Tested with Python 3.11 on Linux (500 passed, 3 platform skips) and Windows (486 passed, 17 skips). Ruff lint and formatting checks passed.

Fixes #1401.

@cvas22

cvas22 commented Dec 2, 2026

Copy link
Copy Markdown

Ran the time tests and poked a few extra cases (-14:00 offset, trailing fractional zeros, out-of-range offsets like +14:01, 24:00:60), midnight normalization is right and normal times are untouched. @mvantellingen looks good to me when you get a sec. thx

This branch has not been deployed

No deployments
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.

Zeep fails to parse 24:00:00 as xsd:time (ValueError: hour must be in 0..23)

2 participants