Add fold to the datetime fieldtype to resolve datetime ambiguity#217
Add fold to the datetime fieldtype to resolve datetime ambiguity#217
Conversation
This is for disambiguation during dst time
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
=======================================
Coverage 84.23% 84.23%
=======================================
Files 35 35
Lines 3742 3742
=======================================
Hits 3152 3152
Misses 590 590
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Something I noticed when writing fox-it/dissect.target#1614 |
There was a problem hiding this comment.
Pull request overview
This PR addresses DST ambiguity by preserving the datetime.fold attribute when flow.record.fieldtypes.datetime is constructed from an existing datetime instance, and adds tests to validate correct behavior around DST transitions.
Changes:
- Preserve
foldwhen converting from adatetimeobject inside the datetime fieldtype. - Extend datetime fieldtype tests to cover
fold=1and an end-of-DST scenario usingEurope/Amsterdam.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
flow/record/fieldtypes/__init__.py |
Propagates arg.fold when wrapping an existing datetime into the fieldtype. |
tests/fieldtypes/test_fieldtypes.py |
Adds parametrized tests and an explicit DST fold example using ZoneInfo. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
yunzheng
left a comment
There was a problem hiding this comment.
LGTM, added an additional test and skip tests if zoneinfo is not available.
This is for disambiguation during dst time