Chromium-based apps can't read timezone in certain timezone
Step to reproduce:
- Setup an Ubuntu Core 22 VM. Then, set timezone to "Asia/Bangkok":
sudo timedatectl set-timezone Asia/Bangkok. - Install
ubuntu-frame. Then, build and install the Electron version ofiot-example-graphical-snap[1]. - Start the snap. Go to "View > Toggle Developer Tools". Then, go to "Console" tab and type:
new Date().
- Expected result: the time is 7 hours ahead of UTC, and ends with "GMT+0700 (Indochina Time)".
- Actual result: the time is in UTC, and ends with "GMT+0000 (GMT)".
I have a full analysis, done under Ubuntu Touch which also use writable-paths system, at [2]. But basically, ICU tries to determine the timezone by reading symlink target of /etc/localtime, which then fails. This isn't failure on its own (it can still understand +07 from GLibC), but then Chromium tries to pass +07 to Zygote process, which ICU can't deserialize back to a timezone falling back to Etc/Unknown.
We can either patch ICU so that it understand /etc/writable redirection (similar to what we've done with systemd), or ~~patch Chromium to correct the passed zone ID (to something like GMT+07)~~ turns out you can't do that because of time zone abbreviation collision (e.g. PST = Pacific Standard Time = Philippines Standard Time). I feel like patching ICU could have a wider effect and would make stuff more functional.
To see the effect of the ICU problem alone, installs wpe-webkit-mir-kiosk instead and run snap set wpe-webkit-mir-kiosk url="https://www.w3schools.com/js/tryit.asp?filename=tryjs_date_current".
[1] https://github.com/MirServer/iot-example-graphical-snap/tree/22/Electron-quick-start [2] https://gitlab.com/ubports/development/core/packaging/qtwebengine/-/issues/15
Ping the developer.
Ping the developers.