Skip to content

update_media_buy fails with timezone mismatch error when updating dates #1039

@estofko-scope3

Description

@estofko-scope3

When calling update_media_buy with start_time or end_time, the operation fails with:

can't subtract offset-naive and offset-aware datetimes

This occurs because the code mixes timezone-aware datetimes (from request parsing) with potentially timezone-naive datetimes (from database).

Symptoms:

{
  "success": false,
  "status": "completed", 
  "error": "A2A agent returned error: Unable to update media buy: can't subtract offset-naive and offset-aware datetimes"
}

When updating only end_time:

  • start_dt = media_buy.start_time from database (possibly naive)
  • end_dt = parsed from request with timezone (aware)
  • Subtraction fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions