From 5f9327bff61d08b93fc759618e45a789e5ed96e7 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 8 Feb 2019 21:58:23 -0700 Subject: [PATCH] Always show daytime icons in forecast --- lib/Conditions.lib.php | 10 +++++++--- lib/Weather_DarkSky.lib.php | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Conditions.lib.php b/lib/Conditions.lib.php index da4fc82..e540c8f 100644 --- a/lib/Conditions.lib.php +++ b/lib/Conditions.lib.php @@ -35,6 +35,10 @@ class Conditions { * @var bool True if daytime, false if nighttime. Set with setDayOrNight(). */ private $daytime = true; + /** + * @var type bool If true, don't generate nighttime icon + */ + public $disablenight = false; /** * @var float Temperature in degrees Celsius @@ -208,7 +212,7 @@ class Conditions { if ($this->isOvercast()) { return "wi-$downfall$wind"; } else { - $daynight = $this->isDay() ? "day" : "night-alt"; + $daynight = $this->isDay() || $this->disablenight ? "day" : "night-alt"; return "wi-$daynight-$downfall$wind"; } } @@ -218,14 +222,14 @@ class Conditions { } if ($this->isCloudy()) { - return $this->isDay() ? "wi-day-cloudy" : "wi-night-alt-cloudy"; + return $this->isDay() || $this->disablenight ? "wi-day-cloudy" : "wi-night-alt-cloudy"; } if ($this->isCold()) { return "wi-snowflake-cold"; } - if ($this->isDay()) { + if ($this->isDay() || $this->disablenight) { if ($this->isHot()) { return "wi-hot"; } diff --git a/lib/Weather_DarkSky.lib.php b/lib/Weather_DarkSky.lib.php index cc1e578..423e877 100644 --- a/lib/Weather_DarkSky.lib.php +++ b/lib/Weather_DarkSky.lib.php @@ -51,6 +51,7 @@ class Weather_DarkSky extends Weather { $daily->summary = $day->summary; $daily->setDayorNight(); + $daily->disablenight = true; $daily->tempHigh = $day->temperatureMax; $daily->tempLow = $day->temperatureMin;