Conversation
VerteDinde
approved these changes
Oct 24, 2025
| results[1].replace(', 24:', ', 00:'), | ||
| // Expected format: MM/DD/YY, HH:mm:ss:SSS' | ||
| const DATE_FORMAT_RGX = | ||
| /^(\d{2})\/(\d{2})\/(\d{2}), (\d{2}):(\d{2}):(\d{2}):(\d{3})$/; |
Contributor
There was a problem hiding this comment.
😭 Whew, I bet this was not fun to figure out
| throw new Error(`Failed to parse Chromium timestamp: ${timestamp}`); | ||
| } | ||
| const [, month, day, hour, minute, second, millisecond] = parsedTimestamp; | ||
| const logDate = new TZDate( |
Contributor
There was a problem hiding this comment.
nit (non-blocking): it looks like we're doing similar logic at 3 points in this file, is it worth DRYing this up into a shared utility method? Or is it just different enough that it's not worth it (looks like this one needs month when another needs year, etc).
Member
Author
There was a problem hiding this comment.
The webapp and desktop formats are the same, but having a different format for the Chromium one makes the refactoring a bit cumbersome. It's really only 4 added lines each time so I think it's okay to keep it as-is for now.
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.
#270 added a timezone switcher for log tables.
Bug
We noticed that timestamps displayed in the log table were being shifted to the Sleuth client's timezone. For example, a log bundle containing a line at 9:00 AM ET would show up as 9:00 AM PT when displayed in Sleuth.
Root cause
The root cause of this issue is that the
momentValue(i.e. milliseconds since the UNIX Epoch) assigned to each log line was being saved in the Sleuth client's own system timezone.For a concrete example, say a log bundle is generated in
America/Torontoor UTC-5:Solution
The initial solution for this PR was to convert IANA timezones to a fixed UTC offset and add it to the
new Dateconstructor. However, this doesn't work globally due to changes in Daylight Savings Time—for instance, Vancouver is either at UTC-7 or UTC-8 depending on the time of year.As a new solution, we parse the date string to its components with regex, then use the
new TZDateconstructor from@date-fns/tzthat handles all timezone-related logic.