fix calculation of duration until next sunrise

This commit is contained in:
Denis Treskunov
2020-01-18 17:01:26 -08:00
parent fefe5659d3
commit 9cffa3dd67

View File

@@ -167,7 +167,7 @@ Module.register("clock",{
} else if (now.isBefore(sunTimes.sunset)) {
nextEvent = sunTimes.sunset;
} else {
const tomorrowSunTimes = SunCalc.getTimes(now.add(1, 'day'), this.config.lat, this.config.lon);
const tomorrowSunTimes = SunCalc.getTimes(now.clone().add(1, 'day'), this.config.lat, this.config.lon);
nextEvent = tomorrowSunTimes.sunrise;
}
const untilNextEvent = moment.duration(moment(nextEvent).diff(now));