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
@@ -219,12 +219,12 @@ class DashboardView(View):
|
||||
return redirect('login')
|
||||
|
||||
# Get today's date in user's timezone
|
||||
import pytz
|
||||
from zoneinfo import ZoneInfo
|
||||
try:
|
||||
user_tz = pytz.timezone(request.user.timezone)
|
||||
user_tz = ZoneInfo(request.user.timezone)
|
||||
user_now = timezone.now().astimezone(user_tz)
|
||||
today = user_now.date()
|
||||
except (pytz.UnknownTimeZoneError, AttributeError):
|
||||
except (Exception,):
|
||||
# Fall back to UTC if user timezone is invalid or missing
|
||||
today = timezone.now().date()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user