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

Bug in xmlparser.py for time format %Y-%m-%dT%H:%M:%S%z #1324

Closed
prrw opened this issue Jun 1, 2023 · 0 comments
Closed

Bug in xmlparser.py for time format %Y-%m-%dT%H:%M:%S%z #1324

prrw opened this issue Jun 1, 2023 · 0 comments

Comments

@prrw
Copy link
Contributor

prrw commented Jun 1, 2023

Describe the bug

xmlparser.py cannot parse PublicationDate if it is not given in different format than %Y-%m-%dT%H:%M:%SZ.
Format with UTC Offset for example 2023-05-31T10:45:30+02:00 is also valid and leads to error while importing the nodeset.

To Reproduce

Import an xml with PublicationDate in UTC offset format eg. 2023-05-31T10:45:30+02:00

await self.import_xml("xyz.xml")

Expected behavior

xmlparser will throw an error saying the format does not match

Screenshots

grafik

Version

Python-Version: 3.7.0
opcua-asyncio Version: 1.0.2

Possible solution

A possible solution exists and can be added with pull request after discussion.

                if date_time is None:
                    date_time = ua.DateTime(1, 1, 1)
                elif date_time and date_time[-1]=="Z":
                    date_time = ua.DateTime.strptime(date_time, "%Y-%m-%dT%H:%M:%SZ")
                else:
                    date_time = ua.DateTime.strptime(date_time, "%Y-%m-%dT%H:%M:%S%z")
oroulet pushed a commit that referenced this issue Jun 5, 2023
* Update xmlparser.py

* Update xmlparser.py
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