gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
784 stars 138 forks source link

Use `datetime` instead of `str` for all model timestamps #352

Closed mesozoic closed 7 months ago

mesozoic commented 7 months ago

This branch switches Model.created_time and all timestamps in schema/webhook/comment/etc. models to use datetime.datetime instead of the str representation that comes back from the API.

The approach is a bit wonky – inspect pydantic field metadata, check types against fields and input, selectively convert data – but it works, and doesn't require us to do anything special per field except declare its type differently than what Airtable will hand back in the API.

This is certainly a breaking change, so I'd include it in a 3.0 release.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (eef7b6f) to head (a4da1c6). Report is 26 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #352 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 25 24 -1 Lines 2313 2334 +21 ========================================= + Hits 2313 2334 +21 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.