I am encountering an issue where the browser timezone information becomes incorrect after changing the system timezone multiple times on my Ubuntu PC. Specifically, the Date object in my browser returns Etc/Unknown
instead of the correct timezone after the third change. Here are the details of my situation:
-
When I first start my system, the Date object correctly picks up the local timezone.
-
If I change the system timezone once, the Date object updates correctly.
-
If I change the system timezone a second time, the Date object still updates correctly.
-
However, after changing the system timezone a third time, the Date object in my browser returns
Etc/Unknown
.
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
// Get the local time offset from UTC in minutes
const offset = new Date().getTimezoneOffset();
console.log("Browser Timezone:", timezone);
console.log("Timezone Offset (minutes):", offset)
Even I have tried with the other options of date object of javascript. But these also give similar results upon changing my system timezone on third time. I want to know why browser (Chrome) timezone is not updating upon changing my system timezone. Moreover, my system shows the correct time / timezone if I run the command `timedatectl`
Basically, I am developing a calendar app where clients local zoned time information will be saved in database in UTC and user with different timezones can view the schedule according to their own timezone. For that to happen, I am testing with changing my own system timezone. Is it an efficient appraoch ? As if I restart the system, whatever, the timezone is set, while information I get. But I want to confirm the true behaviour.