Merge pull request #1887 from dtreskunov/dtreskunov/sun-and-moon

fix calculation of duration until next sunrise
This commit is contained in:
Michael Teeuw 2020-01-22 15:23:01 +01:00 committed by GitHub
commit 9f4dc1e382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added
- Finnish translation for "PRECIP", "UPDATE_INFO_MULTIPLE" and "UPDATE_INFO_SINGLE".
- Added the ability to hide the temp label and weather icon in the `currentweather` module to allow showing only information such as wind and sunset/rise.
- Sun and Moon data to the `clock` module.
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
### Fixed
- Force declaration of public ip adress in config file (ISSUE #1852)

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