Skip to content

Comments

fix: timezone aware#51

Open
mporracindie wants to merge 2 commits intosinger-io:masterfrom
blueprint-data:master
Open

fix: timezone aware#51
mporracindie wants to merge 2 commits intosinger-io:masterfrom
blueprint-data:master

Conversation

@mporracindie
Copy link

Description of change

This pull request improves the handling of datetime objects in tap_appsflyer/__init__.py to ensure all datetime values are timezone-aware (specifically in UTC). This helps prevent subtle bugs when comparing or manipulating datetimes, especially when mixing naive and timezone-aware objects.

TypeError: can't compare offset-naive and offset-aware datetimes

Timezone handling improvements:

  • Added a new ensure_timezone_aware(dt) helper function that ensures any datetime object is timezone-aware in UTC, assuming naive objects are in UTC and leaving aware objects unchanged.
  • Updated the get_stop function to use ensure_timezone_aware for both start_datetime and stop_time, ensuring safe and consistent datetime comparisons.
  • Modified the call to datetime.datetime.now() in sync_organic_installs to explicitly use UTC (datetime.datetime.now(pytz.utc)), aligning with the new timezone-aware handling.

Risks

  • None

Rollback steps

  • revert this branch

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

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.

1 participant