Skip to content

Commit

Permalink
Update worldmap.js - add clientTimezone (#245)
Browse files Browse the repository at this point in the history
Add clientTimezone to the 'connected' msg.payload

If unable to complete query return bool of 'false'

Why? 
Many clients connect to the world map from different locals.
Knowing what time their browser/computer is using allows us to format events to their timezone.

Overhead is minimal as it only is queried once when they connect.
  • Loading branch information
meeki007 committed Jul 31, 2023
1 parent e9a7f66 commit 072411a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion worldmap/worldmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var connect = function() {
if (!inIframe) {
document.getElementById("footer").innerHTML = "<font color='#494'>"+pagefoot+"</font>";
}
ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams)}));
ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams),clientTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone || false}));
onoffline();
};
ws.onclose = function() {
Expand Down

0 comments on commit 072411a

Please sign in to comment.