]> git.basschouten.com Git - openhab-addons.git/commit
[astro] Fixed timeLeft calculation at the end of the year (#11889)
authorHilbrand Bouwkamp <hilbrand@h72.nl>
Thu, 30 Dec 2021 12:49:43 +0000 (13:49 +0100)
committerGitHub <noreply@github.com>
Thu, 30 Dec 2021 12:49:43 +0000 (13:49 +0100)
commit253f36abbf3ac5e9f5b0657ffc9b4f995c45947c
treef7a173af6008ed12364353f11093043525c91997
parent50560f7b5bda7751d4de464ce8a6be66a4873fff
[astro] Fixed timeLeft calculation at the end of the year (#11889)

Season timeleft calculated the wrong time at the end of the year, because the seasons it measures the time with are the seasons within the same year.
So for times at the end of the year it computed against the season at the beginning of the year, resulting in negative number of days.
Also changed the time of timeLeft to actual days instead of quantity unit days.
Because with the milliseconds internal resolution it will generate events each and every time this channel is updated as milliseconds change often.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/model/Season.java
bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/util/DateTimeUtils.java
bundles/org.openhab.binding.astro/src/test/java/org/openhab/binding/astro/internal/util/DateTimeUtilsTest.java