Always show daytime icons in forecast

This commit is contained in:
Skylar Ittner 2019-02-08 21:58:23 -07:00
parent 0dbc9b3cfd
commit 5f9327bff6
2 changed files with 8 additions and 3 deletions

View File

@ -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";
}

View File

@ -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;