Skip to content

[issue-718] ignore microseconds during datetime conversion to ISO string #719

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

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

armintaenzertng
Copy link
Collaborator

fixes #718

@@ -16,4 +17,11 @@ def datetime_to_iso_string(date: datetime) -> str:
"""
Return an ISO-8601 representation of a datetime object.
"""
if date.microsecond != 0:
date = date.replace(microsecond=0)
logging.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% convinced this warrants a warning. Since there is no dedicated datetime type without microsecond precision and the most typical way to create a datetime object will add microsecond precision, as a user it might be annoying to deal with those warnings.
But I'm not strictly opposed, either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are probably correct, I removed it.

Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
Copy link
Member

@maxhbr maxhbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@armintaenzertng armintaenzertng merged commit 9a3e128 into spdx:main Jun 30, 2023
@armintaenzertng armintaenzertng deleted the fixMicroseconds branch June 30, 2023 11:13
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.

Incorrect timestamp format in generated documents
3 participants