fix: convert timestamps to UTC before formatting (#221) - #222
Open
drewr wants to merge 2 commits into
Open
Conversation
Add non-UTC timestamp test cases to TestActivitiesToRows, TestEventsToRows, and TestKubeEventsToRows that expect the correct UTC output. These fail until the Format literal-Z in each respective function is fixed.
Replace all 14 occurrences of Format("2006-01-02T15:04:05Z") with
.UTC().Format(time.RFC3339). The bare Z in the old layout is a literal
character, not a zone verb, so local clock times were printed with a Z
suffix that falsely claimed they were UTC.
JoseSzycho
approved these changes
Aug 3, 2026
Contributor
|
We should document somewhere our preferred method for storing/displaying times |
Contributor
Author
|
A good addition to our style guide! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #221
Summary
Format("2006-01-02T15:04:05Z"). In Go this treats the trailingZas a literal character, not a zone verb, so the output shows the local clock time regardless of timezone.metav1.Timeandmetav1.MicroTimestore times in the local zone after JSON decoding (UnmarshalJSONcalls.Local()), so the formatted output shows the wrong day/clock time while still printingZ.time.RFC3339, which correctly emitsZonly when the time is UTC.Changes
ef1f5f9test: Add non-UTC timestamp test cases toTestActivitiesToRows,TestEventsToRows, andTestKubeEventsToRowsthat expect the correct UTC instant. These tests fail before the fix and pass after.70c8a18fix: Replace all 14 occurrences ofFormat("2006-01-02T15:04:05Z")with.UTC().Format(time.RFC3339)across 5 files inpkg/cmd/,pkg/cmd/reindexjob/, andpkg/mcp/tools/.