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

OverflowError when parsing a valid dateTime value #84

Open
StanimirIglev opened this issue Feb 5, 2025 · 2 comments
Open

OverflowError when parsing a valid dateTime value #84

StanimirIglev opened this issue Feb 5, 2025 · 2 comments

Comments

@StanimirIglev
Copy link

Description

When attempting to create a DateTime object for 9999-12-31T24:00:00, the library raises an OverflowError: date value out of range. According to the XML Schema 1.1. Part 2: Datatypes specification, '24:00:00' is a valid representation for midnight at the end of a day. Therefore, the DateTime class should accept 9999-12-31T24:00:00. The expected behavior would likely be to create a DateTime object for 10000-01-01T00:00:00, as it is semantically equivalent to 9999-12-31T24:00:00.

Steps to reproduce

>>> import elementpath
>>> elementpath.datatypes.DateTime(9999, 12, 31, 24, 00, 00)

Environment

  • Python Version: 3.13.0
  • elementpath Version: 4.7.0

Additional context

  • The bug was detected while trying to validate a document using the xmlschema library. Though it seems to stem from the elementpath's DateTime data type.

Please let me know if you need any further information. Thank you for looking into this!

@brunato
Copy link
Member

brunato commented Feb 18, 2025

Hi,

thank you for the detailed description of the problem.
About the issue I'm pretty confident that it could be resolved with an additional check, maybe with a fallback to a semantically equivalent object as you noticed.

About the context often issues of elementpath are detected using the xmlschema library, but this is the nature of these standards, and having a separate contexts has favorite the develop a more flexible XPath processor.

best

@brunato
Copy link
Member

brunato commented Mar 3, 2025

Hi, v4.8.0 is finally out, this issue should be fixed.

best

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

No branches or pull requests

2 participants