Update worldmap.js - add clientTimezone (#245)

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.
This commit is contained in:
meeki007 2023-07-31 04:34:09 -04:00 committed by GitHub
parent e9a7f66bdc
commit 072411a304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() {