-
Notifications
You must be signed in to change notification settings - Fork 121
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
Add timespec to datetime_to_str util function. #929
Add timespec to datetime_to_str util function. #929
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a unit test demonstrating the expected behavior? Thanks!
Codecov ReportBase: 94.34% // Head: 94.34% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #929 /- ##
=======================================
Coverage 94.34% 94.34%
=======================================
Files 83 83
Lines 11983 11989 6
Branches 1133 1134 1
=======================================
Hits 11305 11311 6
Misses 496 496
Partials 182 182
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I've added a new unit test. Thank you so much for reviewing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So sorry, I should have caught this on first review ... can you also add a description of the timespec
argument to the datetime_to_str
docstring, e.g. at https://github.com/stac-utils/pystac/pull/929/files#diff-98860a0104c5b45415729e4d1252380cfcc767add4a1a88561d80d5cdee4828cR309. Thanks.
Add changes in changelog file.
No worries at all. It was my mistake. Also, add my changes in the changelog. Thanks. |
Related Issue(s): #
Description:
Currently
datetime_to_str
function inutils
truncates all microseconds if the microsecond indatetime
object is equal to zero.I've added an optional input (
timespec
) to control this ability. The default behavior is like before, but If users want to retrieve the result withmicroseconds
, they can passtimespec = "microseconds"
to thedatetime_to_str
function, and the result with microseconds will return.PR Checklist:
pre-commit run --all-files
)scripts/test
)