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

Serialize datetimes with Z suffix #2058

Merged
merged 43 commits into from
Sep 12, 2024
Merged

Conversation

tw4l
Copy link
Contributor

@tw4l tw4l commented Aug 30, 2024

Use timezone aware datetimes instead of timezone naive datetimes:

  • Update mongodb client to use tz-aware conversion
  • Convert dt_now() to return timezone aware UTC date
  • Rename to_k8s_date -> date_to_str, just returns ISO UTC date with 'Z' (instead of '+00:00' suffix)
  • Rename from_k8s_date -> str_to_date, returns timezone aware date from str
  • Standardize all string<->date conversion to use either date_to_str or str_to_date
  • Update frontend to assume iso date, not append 'Z' directly
  • Update tests to check for 'Z' suffix on some dates

@tw4l tw4l marked this pull request as draft August 30, 2024 18:30
@tw4l tw4l changed the title Issue 1922 datetime serialization WIP: Serialize datetimes with Z suffix Aug 30, 2024
backend/btrixcloud/crawls.py Outdated Show resolved Hide resolved
tw4l and others added 4 commits August 31, 2024 18:03
keep datetime as regular datetime
convert dt_now() to return tz-aware timestamp
convert to_k8s_date -> date_to_str, just use iso conversion, use 'Z' instead of '+00:00'
convert from_k8s_date -> str_to_date, use iso conversion
@tw4l
Copy link
Contributor Author

tw4l commented Sep 2, 2024

Pushed a few frontend fixes for areas where dates were still having Z manually appended that I missed on the first pass. Otherwise it seems good! I spun up a local instance off of main, created some workflows, collections, uploads, etc., and then redeployed with this branch, and all seems good.

@tw4l tw4l requested a review from ikreymer September 2, 2024 16:56
@tw4l tw4l marked this pull request as ready for review September 2, 2024 16:57
@ikreymer ikreymer changed the title WIP: Serialize datetimes with Z suffix Serialize datetimes with Z suffix Sep 6, 2024
@ikreymer ikreymer merged commit 123705c into main Sep 12, 2024
4 checks passed
@ikreymer ikreymer deleted the issue-1922-datetime-serialization branch September 12, 2024 23:16
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.

2 participants