Use toLocaleFormat, to format time; fix for 12h time formats

yahoo_weather
Jens Lody 11 years ago
parent 98cef2132f
commit f771bcf0c0
  1. 14
      src/extension.js

@ -1318,14 +1318,16 @@ const WeatherMenuButton = new Lang.Class({
break; break;
} }
let lastBuild = (this.lastBuildDate.getHours() % 12) + ":" + ((this.lastBuildDate.getMinutes() < 10) ? "0" : "") + this.lastBuildDate.getMinutes() + " " + ((this.lastBuildDate.getHours() >= 12) ? "pm" : "am"); let lastBuild = '-';
if (this._clockFormat == "24h") { if (this._clockFormat == "24h") {
sunrise = new Date("3 Mar 1999 " + sunrise); sunrise = new Date(actualDate.toLocaleDateString() + " " + sunrise).toLocaleFormat("%R");
sunrise = sunrise.getHours() + ":" + ((sunrise.getMinutes() < 10) ? "0" : "") + sunrise.getMinutes(); sunset = new Date(actualDate.toLocaleDateString() + " " + sunset).toLocaleFormat("%R");
sunset = new Date("3 Mar 1999 " + sunset); lastBuild = this.lastBuildDate.toLocaleFormat("%R");
sunset = sunset.getHours() + ":" + ((sunset.getMinutes() < 10) ? "0" : "") + sunset.getMinutes(); } else {
lastBuild = this.lastBuildDate.getHours() + ":" + ((this.lastBuildDate.getMinutes() < 10) ? "0" : "") + this.lastBuildDate.getMinutes(); sunrise = new Date(actualDate.toLocaleDateString() + " " + sunrise).toLocaleFormat("%I:%M %p");
sunset = new Date(actualDate.toLocaleDateString() + " " + sunset).toLocaleFormat("%I:%M %p");
lastBuild = this.lastBuildDate.toLocaleFormat("%I:%M %p");
} }
if (d >= 1) { if (d >= 1) {

Loading…
Cancel
Save