ocpp/datetime
Date-time seam.
OCPP timestamps are RFC 3339 / ISO 8601 strings on the wire, modelled as
gleam/time/timestamp.Timestamp. This module owns the OCPP wire policy:
parsing accepts any RFC 3339 offset, and encoding always renders UTC with
a trailing Z (fractional seconds only when non-zero). The JSON codecs
for the type live in ocpp/transport/json/codec, where a string that is
not a valid RFC 3339 timestamp fails to decode — the same treatment the
schemas’ other value constraints get.
Types
An OCPP timestamp: an instant in time, RFC 3339 on the wire.
pub type DateTime =
timestamp.Timestamp
Values
pub fn parse_rfc3339(
value: String,
) -> Result(timestamp.Timestamp, Nil)
Parse an RFC 3339 timestamp (e.g. 2026-01-01T00:00:00Z).
pub fn to_rfc3339(value: timestamp.Timestamp) -> String
Render as RFC 3339 in UTC with a trailing Z, as OCPP expects.