baml.time._format_zoned

(internal) Formats an absolute time as RFC 3339 at the given offset, appending an RFC 9557 `[iana]` annotation when `iana` is non-null.

Reference version

Signature

function baml.time._format_zoned(
epoch_ns: bigint,
offset_ns: int,
iana: string | null
) -> string throws baml.errors.InvalidArgument

(internal) Formats an absolute time as RFC 3339 at the given offset, appending an RFC 9557 [iana] annotation when iana is non-null.

Takes the offset already resolved rather than resolving it itself, so the timezone-database lookup stays in BAML where its failure can be routed to either channel — to_string panics, to_json throws.

Parameters

  • epoch_ns: the absolute time, in nanoseconds since the Unix epoch.
  • offset_ns: the offset to render at, in nanoseconds east of UTC. Any sub-minute part is truncated toward zero, since RFC 3339 offsets are ±hh:mm.
  • iana: the identifier for the bracketed annotation, or null for a fixed offset. Its presence also decides the zero-offset spelling: Z for a fixed offset, +00:00 alongside the annotation otherwise — the way Temporal serializes.

Throws

  • baml.errors.InvalidArgument if the local reading is outside the supported ±9999 year range.

Source:<builtin>/baml/ns_time/zoneddatetime.bamlbytes 19022–19176