Skip to content

Show API token times in the admin's timezone - #570

Merged
rbruhn merged 1 commit into
developmentfrom
api-token-timezone
Oct 17, 2026
Merged

rbruhn merged 1 commit into
developmentfrom
api-token-timezone

Conversation

@rbruhn

@rbruhn rbruhn commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Fixes the expiry time on the API Tokens page (#569).

The problem

The expiry picker read the time you picked as UTC, the app's timezone. On development, picking 2:15 PM New York time at 2:00 PM was read as 14:15 UTC, four hours in the past, and was refused with "must be a date after now". A time that was accepted was saved four hours off, and the list showed every time in UTC.

The fix

  • The Expires at picker uses the signed-in admin's profile timezone (falling back to the app's UTC when there is no profile), and its help text names that timezone.
  • The after now rule is replaced by a minimum of now in that timezone, so the browser's picker also blocks earlier times.
  • The Last used, Expires and Created columns are shown in the same timezone.
  • Times are still stored in UTC.

Tested locally

  • tests/Feature/Admin/ApiTokenResourceTest.php: 9 passed. New cases, with the clock at 18:00 UTC and an admin in America/New_York: 3:00 PM is accepted and saved as 19:00 UTC; 1:00 PM is refused; a token expiring at 19:00 UTC is listed as 15:00.

To verify on development

See #567.

The expiry picker read the chosen time as UTC, so a time picked in local time could be refused as already past or saved hours off. The picker and the list's times now use the signed-in admin's profile timezone, times are still stored in UTC, and the expiry can't be set before now in that timezone.
@rbruhn
rbruhn merged commit 3bdf61e into development Oct 17, 2026
2 checks passed
@rbruhn
rbruhn deleted the api-token-timezone branch October 17, 2026 18:34
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