Fix the event start formatter for viewers abroad

Review the AI's codeEasy12 min

Your task

Your scheduling app showed event start times with datetime.fromtimestamp(ts) and a US 12-hour format. That call uses the server's own time zone, so a 3 pm meeting showed as 7 am to people elsewhere, and 06/07 reads as June 7 to some people and 6 July to others. The fix renders each start in the viewer's offset from UTC, in one format that says which offset it uses.

An assistant wrote format_event_start(start_ts, tz_offset_minutes). It is in the editor. It has a bug. Find it and fix it.

Input and output:

  • start_ts: the event start as a Unix timestamp, in seconds since 1970-01-01 00:00 UTC. It can be negative.
  • tz_offset_minutes: the viewer's offset from UTC in minutes, such as 330 for India (UTC+05:30). It can be negative.
  • Return the start as a string YYYY-MM-DD HH:MM followed by a space and the offset, like 2026-05-29 01:56 +05:30.

Rules the tests check:

  • Add the offset to the timestamp to get the viewer's wall clock time. Write its date and its time on a 24-hour clock. Drop the seconds, do not round them. Dates before 1970 follow the same calendar.
  • Pad the year to 4 digits and the month, day, hour and minute to 2.
  • Write the offset as + when it is 0 or more and - when it is negative, then its absolute value as hours and minutes, each padded to 2 digits.

Examples

format_event_start(start_ts: int, tz_offset_minutes: int) -> str
Example 1
Inputformat_event_start(1780000000, 0)
Output"2026-05-28 20:26 +00:00"
Example 2
Inputformat_event_start(1780000000, 330)
Output"2026-05-29 01:56 +05:30"
Example 3
Inputformat_event_start(1780000000, -480)
Output"2026-05-28 12:26 -08:00"