-
Notifications
You must be signed in to change notification settings - Fork 73
fix: standardize API datetime formats and use UTC-aware objects #208
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
base: dev
Are you sure you want to change the base?
Conversation
WalkthroughDatetime field validators are added across multiple model files to normalize timezones using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code graph analysis (3)app/models/core.py (1)
app/models/stats.py (2)
app/models/user.py (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR standardizes datetime handling across the API by ensuring all datetime objects are UTC-aware and formatted consistently. The changes replace deprecated datetime.utcnow() usage and add validators to ensure all datetime fields returned by the API have proper timezone information.
Changes:
- Replaced
datetime.utcnow()withdatetime.now(timezone.utc)in JWT token creation - Added field validators to all response models containing datetime fields to ensure UTC-aware datetime objects
- Applied the
fix_datetime_timezonehelper consistently across all models
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/utils/jwt.py | Updated JWT token creation to use UTC-aware datetime objects |
| app/models/user.py | Added field validators for created_at, edit_at, and online_at fields |
| app/models/stats.py | Added field validators for start, end, and period_start datetime fields |
| app/models/core.py | Added field validator for created_at field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
This PR addresses the inconsistency in datetime formats across the API. Previously, some endpoints returned ISO strings without the
Z(UTC) suffix.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.