Skip to contents

Both APIs report timestamps as ISO 8601 with a T separator, microseconds and a Z suffix (e.g. "2026-08-20T02:42:43.000000Z", measured against marks.spdgt.com). None of as.POSIXct()'s default formats match that: it tries the space-separated ones, fails, then falls back to "%Y-%m-%d", which matches the leading date and silently discards the time. A token expiring at 02:42 was therefore stored as midnight, and auth_status() reported a live token as expired.

Usage

parse_api_datetime(x)

Arguments

x

A timestamp string from an API response, or an existing POSIXct.

Value

POSIXct in UTC. NULL when x is absent or does not parse — NULL rather than NA because a missing expiration reads as "no expiration" everywhere it is used, while NA would break the exp < Sys.time() comparison in auth_status().