From 4fa0f0d8ea9a209d2696328aeb469fec57f71138 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Fri, 28 Mar 2014 11:44:03 +0100 Subject: [PATCH] fix server time offset calculation for IE10 --- isso/js/app/api.js | 5 ++++- isso/js/app/globals.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/isso/js/app/api.js b/isso/js/app/api.js index b2056aa..73c2a88 100644 --- a/isso/js/app/api.js +++ b/isso/js/app/api.js @@ -41,7 +41,10 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) { function onload() { - globals.offset.update(new Date(xhr.getResponseHeader("Date"))); + var date = xhr.getResponseHeader("Date"); + if (date !== null) { + globals.offset.update(new Date(date)); + } var cookie = xhr.getResponseHeader("X-Set-Cookie"); if (cookie && cookie.match(/^isso-/)) { diff --git a/isso/js/app/globals.js b/isso/js/app/globals.js index b3efe9d..6c411f1 100644 --- a/isso/js/app/globals.js +++ b/isso/js/app/globals.js @@ -6,7 +6,7 @@ define(function() { }; Offset.prototype.update = function(remoteTime) { - this.values.push((new Date()).getTime() - remoteTime); + this.values.push((new Date()).getTime() - remoteTime.getTime()); }; Offset.prototype.localTime = function() {