// Sync with server time by calculating offset
var serverTimeString = $('#date').text().trim() + ' ' + $('#time').text().trim();
var serverTimeX = moment(serverTimeString, 'dddd, MMMM D, YYYY h:mm:ss').format("X");
var difference = serverTimeX - moment().format('X');
console.log(difference);
This method is too unreliable due to page load time. (difference may be 0-2 seconds off on a machine providing both the server and client.) If there is a browser API to get load time in the future, this may be viable.
Just tested with the following code:
This method is too unreliable due to page load time. (
difference
may be 0-2 seconds off on a machine providing both the server and client.) If there is a browser API to get load time in the future, this may be viable.