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

Make datetime fieldtypes timezone aware #78

Merged
merged 6 commits into from
Aug 24, 2023

Conversation

yunzheng
Copy link
Member

@yunzheng yunzheng commented Aug 3, 2023

This PR will add the following:

  • Record datetime fields are now offset-aware by default
  • Naive datetime fields are converted to UTC
  • Support for packing/unpacking aware datetimes

Note that comparing to naive datetime objects will now break and is also in line with default Python behaviour

To ensure uniform datetime field output they are always displayed in UTC
To disable this behaviour you can set the environment variable FLOW_RECORD_TZ=NONE

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #78 (796f150) into main (464914e) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
+ Coverage   78.86%   79.04%   +0.18%     
==========================================
  Files          32       32              
  Lines        2862     2878      +16     
==========================================
+ Hits         2257     2275      +18     
+ Misses        605      603       -2     
Flag Coverage Δ
unittests 79.04% <100.00%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
flow/record/adapter/elastic.py 0.00% <ø> (ø)
flow/record/base.py 90.30% <100.00%> (+0.01%) ⬆️
flow/record/fieldtypes/__init__.py 92.10% <100.00%> (+0.76%) ⬆️
flow/record/jsonpacker.py 91.25% <100.00%> (ø)
flow/record/packer.py 95.28% <100.00%> (+0.04%) ⬆️
flow/record/stream.py 94.87% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

flow/record/fieldtypes/__init__.py Outdated Show resolved Hide resolved
flow/record/fieldtypes/__init__.py Outdated Show resolved Hide resolved
flow/record/fieldtypes/__init__.py Outdated Show resolved Hide resolved
flow/record/fieldtypes/__init__.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
yunzheng and others added 3 commits August 16, 2023 11:43
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
@yunzheng yunzheng requested a review from Schamper August 16, 2023 16:34
@yunzheng yunzheng merged commit 7cc4440 into main Aug 24, 2023
18 checks passed
@yunzheng yunzheng deleted the improvement/timezone-aware-datetimes branch August 24, 2023 07:30
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.

None yet

2 participants