From 30c0ec74b10eb6165e996f75383594a3177e72ca Mon Sep 17 00:00:00 2001 From: Jens Lody Date: Sat, 2 Nov 2013 11:01:21 +0100 Subject: [PATCH] Fix lastBuildDate sometimes being shown as 00:00 --- src/extension.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/extension.js b/src/extension.js index c0305c3..89ff5f2 100644 --- a/src/extension.js +++ b/src/extension.js @@ -1164,8 +1164,7 @@ weather-storm.png = weather-storm-symbolic.svg if (this.lastBuildId != json.dt || !this.lastBuildDate) { this.lastBuildId = json.dt; - // this.lastBuildDate = new Date(this.lastBuildId * 1000); - this.lastBuildDate = now; + this.lastBuildDate = new Date(this.lastBuildId * 1000); } switch (this._pressure_units) { @@ -1261,7 +1260,7 @@ weather-storm.png = weather-storm-symbolic.svg lastBuild = this.lastBuildDate.toLocaleFormat("%I:%M %p"); } - let beginOfDay = new Date(now.setHours(0, 0, 0, 0)); + let beginOfDay = new Date(new Date().setHours(0, 0, 0, 0)); let d = Math.floor((this.lastBuildDate.getTime() - beginOfDay.getTime()) / 86400000); if (d < 0) { lastBuild = _("Yesterday");