-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Context
In PR #987, a code review suggested using timezone.now() instead of datetime.now() for the Job model's finished_at field. This change was deferred due to the nuanced timezone requirements in the codebase.
Description
The codebase currently has mixed timezone handling:
- Uses
datetime.now()for Job timestamps and other Django CMS operations - Project is configured with
USE_TZ=False
However, there's a nuanced requirement that needs to be addressed:
SourceImage timestamps (keep as local time)
- SourceImage timestamps should remain local time only
- These represent the actual local time when images were captured
- Converting to UTC would introduce errors for these timestamps
- No changes needed for SourceImage
Django CMS operations (should use timezone-aware)
- Job.finished_at and similar Django CMS timestamps should be timezone-aware
- Web users need to see when jobs started/finished in their local time
- Currently these are naive datetimes, making it difficult to display correctly across timezones
Proposed Change
- Keep SourceImage timestamps as local time (no changes)
- Migrate Job.finished_at, Job.started_at, and similar Django CMS fields to use
timezone.now() - Consider enabling
USE_TZ=Truefor the Django project, while ensuring SourceImage timestamps remain local - Update any related timestamp handling to maintain the distinction between local-only and timezone-aware timestamps
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels