Fix the days until renewal countdown

Review the AI's codeEasy12 min

Your task

Your billing page shows how many whole days are left until a subscription renews. The first version mixed a UTC renewal time with the server's local clock. The new version takes both times as UTC strings, so the result does not depend on where the server runs.

An assistant wrote days_until_renewal(renewal_utc, now_utc). It is in the editor. It has a bug. Find it and fix it.

Input and output:

  • renewal_utc: when the subscription renews.
  • now_utc: the current time.
  • Both are UTC times written YYYY-MM-DDTHH:MM:SS, sometimes with a trailing Z. The Z changes nothing. Years are from 2000 to 2100.
  • Return the number of whole days from now_utc to renewal_utc, as an integer.

Rules the tests check:

  • Take the difference in seconds, renewal_utc minus now_utc, using real calendar dates with leap years.
  • Divide by 86400, the seconds in a day, and drop the fraction. The result rounds toward zero on both sides: a renewal 5 hours away is 0 days, and a renewal 5 hours in the past is also 0, not -1.

Examples

days_until_renewal(renewal_utc: str, now_utc: str) -> int
Example 1
Inputdays_until_renewal("2026-02-05T08:30:00Z", "2026-01-31T08:30:00Z")
Output5
Example 2
Inputdays_until_renewal("2026-01-31T13:30:00Z", "2026-01-31T08:30:00Z")
Output0
Example 3
Inputdays_until_renewal("2026-01-31T03:30:00Z", "2026-01-31T08:30:00Z")
Output0