Skip to content

fix(capture): document UTC timestamp normalization - #45

Merged
dustinbyrne merged 1 commit into
mainfrom
posthog/fix-capture-timestamp-utc-normalization
Aug 20, 2026
Merged

fix(capture): document UTC timestamp normalization#45
dustinbyrne merged 1 commit into
mainfrom
posthog/fix-capture-timestamp-utc-normalization

Conversation

@posthog

@posthog posthog Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Correct the capture spec's "Attach envelope fields" step: timestamp is normalized to its equivalent UTC instant before serialization (not left in the caller's original timezone/offset), and sub-second precision is preserved when present on the input.

Why

Nine SDKs merged the same fix within a day of each other (2026-08-13/14): caller-supplied timestamp overrides (and posthog-php's parsed default) were serialized with their original UTC offset intact instead of being converted to UTC, and fractional seconds were sometimes truncated to whole seconds.

Source PRs:

The spec previously said timestamps are serialized "in ISO 8601 with timezone" — true but incomplete, since it didn't say the timezone is always UTC. A new SDK implemented from this spec alone would have shipped the exact bug these nine PRs just fixed.

Prose-only change (no requirement/scenario text touched — none assert a specific timezone), archived directly per this repo's convention for prose fixes (see 2026-08-13-fix-node-shutdown-timeout-resolves for precedent).

Uncertain / follow-up

  • Not confirmed whether posthog-java (posthog-server, in the posthog-android monorepo) needs the same fix — no java-specific timestamp PR was found in this run's lookback window. Flagged in tasks.md as a follow-up, not asserted either way.
  • openspec validate --specs --strict could not be run locally (CLI unavailable in this sandbox); please confirm CI passes.

Created with PostHog Desktop

Nine SDKs independently fixed the same bug this week: caller-supplied timestamps were serialized in their original timezone/offset instead of being normalized to UTC, and fractional seconds were sometimes truncated. The spec only said "ISO 8601 with timezone," which doesn't capture that the timezone is always UTC.

Generated-By: PostHog Desktop
Task-Id: 3ddf61c1-e6f7-46b2-b8d4-06a71a62848f
@dustinbyrne
dustinbyrne requested a review from a team August 20, 2026 15:27
@dustinbyrne
dustinbyrne marked this pull request as ready for review August 20, 2026 20:31
@dustinbyrne
dustinbyrne merged commit ffc4073 into main Aug 20, 2026
10 checks passed
@dustinbyrne
dustinbyrne deleted the posthog/fix-capture-timestamp-utc-normalization branch August 20, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant