mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Zepp OS: Fix sunrise and moon dates being off by local time + UTC offset
Fixes #3400 Signed-off-by: rany <ranygh@riseup.net>
This commit is contained in:
parent
4c4e18560f
commit
340171e0bb
@ -43,6 +43,7 @@ import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiWeatherConditions;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
|
||||
@ -255,6 +256,7 @@ public class Huami2021Weather {
|
||||
|
||||
private Range getSunriseSunset(final Date sunRise, final Date sunSet) {
|
||||
final SimpleDateFormat sunRiseSetSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
|
||||
sunRiseSetSdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
final String from = sunRiseSetSdf.format(sunRise);
|
||||
final String to = sunRiseSetSdf.format(sunSet);
|
||||
@ -298,6 +300,7 @@ public class Huami2021Weather {
|
||||
moonPhaseValue.add(String.valueOf(phase));
|
||||
|
||||
final SimpleDateFormat moonRiseSetSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
|
||||
moonRiseSetSdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
final String from = moonRiseSetSdf.format(new Date(rise * 1000L));
|
||||
final String to = moonRiseSetSdf.format(new Date(set * 1000L));
|
||||
|
Loading…
Reference in New Issue
Block a user