fix: UTC timezone conversion breaking time-based features #43
Labels
No Label
ai-changes-requested
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
in-next-release
status/in-progress
status/pr-open
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#43
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
After the recent update, all time zones were set to UTC. The server is physically located in America/Chicago and was previously using naive datetime objects that honored the local machine time (CST/CDT).
Now that we've explicitly set the timezone to UTC, the system is showing times that are approximately 6 hours off from expected local times.
Impact
Expected Behavior
Times should be stored in UTC internally but displayed in America/Chicago (Central Time) for user-facing features.
Proposed Solution
Technical Details
Solution Implemented
Root Cause
The transaction freeze/thaw task was checking for midnight in UTC instead of America/Chicago timezone. This caused the task to run 6 hours early:
Changes Made
1. New Timezone Utility Module (
utils/timezone.py)now_in_chicago()- Get current time in Chicago timezoneutc_to_chicago()- Convert UTC to Chicago timechicago_to_utc()- Convert Chicago to UTC timeformat_discord_timestamp()- Format datetimes for Discord (shows in user's local timezone)tests/test_utils_timezone.py2. Fixed Critical Scheduling Bug (
tasks/transaction_freeze.py)datetime.now(UTC)tonow_in_chicago()for schedule checks3. Fixed User-Facing Time Displays
utils/logging.py:35- Fixed missing UTC timezone in log timestampsviews/transaction_embed.py:482- Transaction footers now use Discord timestampsviews/trade_embed.py:802- Trade footers now use Discord timestampscommands/admin/management.py- All 8 admin timestamps use Discord formattingcommands/admin/users.py- All 5 user management timestamps use Discord formattingAll timestamps now automatically display in each user's local timezone via Discord's native formatting.
Testing
✅ All 14 timezone utility tests passing
✅ Syntax validation passed for all modified files
✅ Import validation successful
Next Steps
Expected behavior after fix: