Internal
Public Access
Replace pytz with zoneinfo for timezone handling
Fixes ModuleNotFoundError by using Python's built-in zoneinfo module instead of the external pytz dependency. zoneinfo is the standard library solution for timezone handling in Python 3.9+. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
8d5faa8a6e
commit
9dd5d9c154
+3
-3
@@ -153,14 +153,14 @@ class Task(models.Model):
|
||||
"""Check if task is overdue."""
|
||||
if self.due_date and self.status not in ('completed', 'cancelled'):
|
||||
from django.utils import timezone
|
||||
import pytz
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
# Get current date in user's timezone
|
||||
try:
|
||||
user_tz = pytz.timezone(self.user.timezone)
|
||||
user_tz = ZoneInfo(self.user.timezone)
|
||||
user_now = timezone.now().astimezone(user_tz)
|
||||
user_today = user_now.date()
|
||||
except (pytz.UnknownTimeZoneError, AttributeError):
|
||||
except (Exception,):
|
||||
# Fall back to UTC if user timezone is invalid or missing
|
||||
user_today = timezone.now().date()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user