gtalarico / pyairtable

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

Better timezone support in orm.fields.DatetimeField #342

Closed mesozoic closed 6 months ago

mesozoic commented 6 months ago

This addresses a few bugs we've run into:

  1. It was not possible to set a DatetimeField using a timestamp that includes a timezone, based on how we were parsing it.
  2. Timezones were not always sent correctly to the Airtable API.
  3. Using Model.from_record with a field value of None would cause a crash.

We're doing a bit of extra text munging to replace +00:00 with Z because that's how Airtable expects it (for example, when passing a datetime into a filter formula). This might make the test suite slightly slower, but I'm still profiling to see if that's measurable before I do anything about it.

codecov[bot] commented 6 months ago

Codecov Report

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

Project coverage is 99.60%. Comparing base (9ab240b) to head (7fc35ae). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #342 +/- ## ========================================== - Coverage 99.65% 99.60% -0.05% ========================================== Files 25 25 Lines 2025 2025 ========================================== - Hits 2018 2017 -1 - Misses 7 8 +1 ```

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

mesozoic commented 6 months ago

Don't see any measurable slowdowns in the test suite, so I've merged this fix.