Use device timezone in desktop renderer#121
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a device-derived timezone getter and wires it into the renderer’s global settings accessors (via window.getTimezoneSetting), replacing the previous hardcoded/server-provided timezone behavior.
Changes:
- Introduced
getDeviceTimezone()usingIntl.DateTimeFormat().resolvedOptions().timeZonewith a UTC fallback. - Updated
window.getTimezoneSettinginitialization to use the device timezone instead of a hardcoded value. - Removed updating
window.getTimezoneSettingfrom themeResponsewatcher (while keeping the week-start wiring).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function getDeviceTimezone() { | ||
| return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC' | ||
| } | ||
|
|
||
| window.getTimezoneSetting = getDeviceTimezone | ||
|
|
||
| watch(meResponse, () => { | ||
| if (meResponse.value?.data) { | ||
| window.getTimezoneSetting = () => meResponse.value.data.timezone | ||
| window.getWeekStartSetting = () => meResponse.value.data.week_start | ||
| } | ||
| }) |
| function getDeviceTimezone() { | ||
| return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC' | ||
| } |
| return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC' | ||
| } | ||
|
|
||
| window.getTimezoneSetting = getDeviceTimezone |
|
|
||
| onMounted(async () => { | ||
| window.getTimezoneSetting = () => 'Europe/Vienna' | ||
| window.getTimezoneSetting = getDeviceTimezone |
4bb6bd3 to
c152f6d
Compare
|
Thanks for the contribution. I think changing the fallback to the local time is good, but it should not override the value stored on the server. The TimezoneMismatchModal does not currently exist in the Desktop app because there are no API endpoints for user settings yet (WIP solidtime-io/solidtime#1078) so the button to change it wouldnt work. |
Summary
Europe/Viennafallback from the desktop shell/meFixes #120.
Verification
git diff --checknpx --yes prettier@3.3.2 --check src/renderer/src/App.vueFull typecheck was not run because dependency installation is currently blocked by upstream package install issues:
npm cireportspackage.jsonandpackage-lock.jsonare out of syncnpm install --package-lock=falsereports a peer conflict betweenvue-router@5.1.0and the app's Vite 6 dependency