fix: require Z suffix on all timestamps (RFC 3339 UTC indicator)#16
fix: require Z suffix on all timestamps (RFC 3339 UTC indicator)#16mwiesen wants to merge 2 commits into
Conversation
36a1606 to
f355f33
Compare
Timestamps in SPXP are always UTC, but examples and the type definition did not include the 'Z' suffix, causing potential ambiguity in parsers that interpret naive datetime strings as local time. Changes: - Update timestamp type definition: format is now YYYY-MM-DD'T'hh:mm:ss.sssZ - Add MUST requirement: the UTC indicator 'Z' MUST be appended - Update all timestamp examples in SPXP-Spec.md, SPXP-PME-Spec.md and SPXP-SPE-Spec.md to include the Z suffix Closes #13
f355f33 to
8a3d13d
Compare
When reading, accept timestamps both with and without the Z suffix, treating both as UTC. When writing, Z is still mandatory. This ensures backwards compatibility with v0.3 data in the wild. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Backwards compatibility addendumThe original v0.3 spec deliberately omitted the As a result, all existing v0.3 implementations in the wild (including deployed servers and clients) produce timestamps without the To address this, I've pushed an additional change to this branch that introduces a lenient read / strict write rule:
This follows Postel's law and is the standard approach to backwards-compatible format evolution. It means v0.4 clients interoperate seamlessly with v0.3 data without any version-gating logic, while the ecosystem gradually converges on the unambiguous |
Summary
This PR addresses issue #13 by strictly defining the SPXP timestamp format to always use
Zas UTC indicator — no other timezone representation is permitted.Problem
The SPXP specification stated that timestamps are in UTC, but neither the type definition nor the examples included the
Zsuffix. This causes ambiguity: many parsers (including JavaScript'snew Date()) interpret naive datetime strings as local time rather than UTC.Additionally, RFC 3339 technically allows
+00:00as an equivalent toZ— but+00:00could also be misread as a fixed offset rather than true UTC, and some standard serialization libraries may produce it instead ofZ.Changes
SPXP-Spec.md §3): Format is now exactlyYYYY-MM-DDThh:mm:ss.sssZZMUST be used — no other timezone representation permitted+00:00and other UTC offset notations MUST NOT be usedZSPXP-Spec.md,SPXP-PME-Spec.md, andSPXP-SPE-Spec.mdupdated to includeZRationale
SPXP has deliberately chosen to always store and transmit timestamps in UTC to avoid the well-known complexity of timezone handling. Requiring the literal
Z(rather than allowing+00:00) enforces this intent unambiguously and keeps the format simple for implementors. Clients are responsible for converting UTC to local time for display purposes.Closes #13