Add common method for determining if it is daytime

This commit is contained in:
rejas
2021-08-31 21:55:43 +02:00
parent 8949aa3bec
commit a7684e3e9f
2 changed files with 16 additions and 14 deletions

View File

@@ -116,6 +116,15 @@ class WeatherObject {
return this.tempUnits === "imperial" ? feelsLike : ((feelsLike - 32) * 5) / 9;
}
/**
* Checks if the weatherObject is at dayTime.
*
* @returns {boolean} true if it is at dayTime
*/
isDayTime() {
return this.date.isBetween(this.sunrise, this.sunset, undefined, "[]");
}
/**
* Update the sunrise / sunset time depending on the location
*