Skip to content

Conversation

@epou
Copy link
Member

@epou epou commented Oct 24, 2025

Thinking on how SDKs are parsing directly this field.

For example, for Dart, it does not store the TZ and it directly converted to UTC and the original TZ it's lost -> dart-lang/sdk#54993

@epou epou requested a review from Copilot October 24, 2025 15:15
@epou epou self-assigned this Oct 24, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the created_at_local field to return datetime values without timezone information. The change affects the API serializer to strip timezone data and updates test schemas and expectations accordingly.

  • Updated get_created_at_local method to remove timezone information using replace(tzinfo=None)
  • Modified test schemas to expect datetime format without timezone offset patterns
  • Updated test data expectations to use timezone-naive datetime strings

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
api/serializers.py Modified get_created_at_local to strip timezone and updated help text
api/tests/integration/observations/schema.yml Updated regex pattern to expect datetime without timezone
api/tests/integration/observations/create.tavern.yml Changed test expectations to use timezone-naive datetimes
api/tests/integration/identification_tasks/schema.yml Updated regex pattern to expect datetime without timezone
api/tests/integration/identification_tasks/assignments/schema.yml Updated regex pattern to expect datetime without timezone
api/tests/integration/breeding_sites/schema.yml Updated regex pattern to expect datetime without timezone
api/tests/integration/breeding_sites/create.tavern.yml Changed test expectations to use timezone-naive datetimes
api/tests/integration/bites/schema.yml Updated regex pattern to expect datetime without timezone
api/tests/integration/bites/create.tavern.yml Changed test expectations to use timezone-naive datetimes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

created_at = TimezoneAwareDateTimeField(required=True, source="creation_time")
created_at_local = serializers.SerializerMethodField(
help_text="The date and time when the record was created, displayed in the local timezone specified for this entry."
help_text="The date and time when the record was created, displayed without timezone field."
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text is unclear about the purpose and implications of removing timezone information. Consider: 'The date and time when the record was created, displayed in local time without timezone offset. Consumers must track timezone separately if needed.'

Suggested change
help_text="The date and time when the record was created, displayed without timezone field."
help_text="The date and time when the record was created, displayed in local time without timezone offset. Consumers must track timezone separately if needed."

Copilot uses AI. Check for mistakes.
@epou epou merged commit 3a699c2 into master Oct 27, 2025
4 of 5 checks passed
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.

2 participants