Skip to content

fix: use UTC import instead of datetime.UTC attribute#18

Merged
GeiserX merged 1 commit intomainfrom
fix/datetime-utc-import
Apr 15, 2026
Merged

fix: use UTC import instead of datetime.UTC attribute#18
GeiserX merged 1 commit intomainfrom
fix/datetime-utc-import

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented Apr 15, 2026

Summary

  • from datetime import datetime makes datetime the class, not the module
  • datetime.UTC only exists on the module level, causing AttributeError: type object 'datetime.datetime' has no attribute 'UTC' at runtime
  • Fixed by importing UTC directly: from datetime import UTC, datetime, timedelta

Discovered during v0.2.71 production deployment — collection runs were failing with this error.

Files changed

  • app/database.py — 6 occurrences
  • app/main.py — 2 occurrences

Test plan

  • ruff check passes
  • pytest tests/test_auth.py — 15/15 passing
  • python3 -c "from datetime import UTC, datetime; datetime.now(UTC)" works

`from datetime import datetime` makes `datetime` the class, not the
module. `datetime.UTC` only exists on the module, causing
`AttributeError` at runtime. Import `UTC` directly instead.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

Warning

Rate limit exceeded

@GeiserX has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 18 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 18 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 12c7b72c-25b4-4971-a470-689fda1e77fe

📥 Commits

Reviewing files that changed from the base of the PR and between 000659e and 84933c2.

📒 Files selected for processing (2)
  • app/database.py
  • app/main.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/datetime-utc-import

Comment @coderabbitai help to get the list of available commands and usage tips.

@GeiserX GeiserX merged commit bd6b94b into main Apr 15, 2026
6 checks passed
@GeiserX GeiserX deleted the fix/datetime-utc-import branch April 15, 2026 15:53
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.

1 participant