chore: set user timezone in chart#29654
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit da05fb8. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The Performance Test Selection: |
|



Description
The advanced chart time axis was always displaying in UTC regardless of the user's locale.
Root cause: The
timezoneproperty was missing from theTradingView.widgetconstructor. When omitted, falls back to the symbol'sresolveSymboltimezone — hardcoded toEtc/UTCfor our crypto data.Fix: Detect the user's timezone via
Intl.DateTimeFormat().resolvedOptions().timeZoneand pass it to the widget constructor. The value is validated against TradingView's supported timezone list with a fallback toEtc/UTC.Note: the
timezone: 'Etc/UTC'inresolveSymbolis unchanged, it declares data alignment, which is separate from the display timezone.Changelog
CHANGELOG entry: Fixed advanced chart displaying timestamps in UTC instead of the user's local timezone
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3141
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk: only affects AdvancedChart display settings by passing a validated
timezoneinto the TradingView widget, with a safe fallback toEtc/UTCif detection/mapping fails.Overview
Fixes AdvancedChart timestamps always rendering in UTC by detecting the user’s device timezone (
Intl.DateTimeFormat().resolvedOptions().timeZone) and passing it toTradingView.widgetvia thetimezoneoption.Adds a whitelist of TradingView-supported IANA timezone IDs plus a small canonical-to-TradingView alias map, and falls back to
Etc/UTCwhen the device timezone is unsupported or detection throws (applied in bothchartLogic.jsand the injectedchartLogicString.ts).Reviewed by Cursor Bugbot for commit 5496398. Bugbot is set up for automated code reviews on this repo. Configure here.