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