toInstant

fun Datetime.toInstant(): Instant

Parse this AT Protocol Datetime as a kotlinx.datetime.Instant.

The AT Protocol spec requires datetime values to be valid RFC 3339 timestamps with timezone, so this rarely throws for server-emitted records. Throws IllegalArgumentException (via Instant.parse) if raw is malformed — typically because the value was constructed locally rather than received over the wire.

See also

for the non-throwing variant.