Display dashboard charts in Gladys system timezone - #2648
Conversation
When accessing Gladys remotely from a different timezone (e.g. via VPN), chart axes and tooltips were shown in the browser local time instead of the Gladys system timezone configured in settings. - Load system timezone into global store on session init - Format ApexCharts axis labels and tooltips using dayjs timezone - Apply same timezone formatting to energy consumption charts - Refresh store timezone when changed in system settings Co-authored-by: Pierre-Gilles Leymarie <Pierre-Gilles@users.noreply.github.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying gladys-plus with
|
| Latest commit: |
7f9bb5e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e693d5c6.gladys-plus.pages.dev |
| Branch Preview URL: | https://cursor-chart-system-timezone.gladys-plus.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2648 +/- ##
=======================================
Coverage 98.98% 98.98%
=======================================
Files 1056 1056
Lines 20986 20986
=======================================
Hits 20773 20773
Misses 213 213 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Fixes the feature request from community topic #9286: dashboard charts now display dates and times in the Gladys system timezone (configured in Settings → System → Timezone) instead of the browser/device local timezone.
This matters when accessing Gladys remotely from a different timezone (e.g. via VPN while traveling): a water heater starting at 22:00 at home will now correctly show 22:00 on the chart, even if the phone is set to GMT-04.
Changes
systemTimezoneutility (front/src/utils/systemTimezone.js) using dayjs timezone pluginApexChartComponentto format x-axis labels and tooltips in the system timezone (line, area, bar, stepline, timeline charts)Test plan
npm run prettierandnpm run prettier-checkinfront/npm run eslintinfront/