From 2b737c99736a54040c7d396ef845077505dd52dd Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Wed, 20 Jan 2021 18:12:56 +0200 Subject: [PATCH] Fixed offset for graphs with minutes in timezones Timezone offset is now a double. This fix seems very simple, and it kinda is. HighCharts represents offset in minutes. Java gives offset in milliseconds, and that was incorrectly to be assumed as full hours, so the offset was rounded to an integer. Using a double will allow all kinds of offsets that still work with highcharts. Fixes timezones like - Nepal (GMT+05:45) - Newfoundland Time (GMT-03:30) Affects issues: - Fixed #1652 --- .../com/djrapitops/plan/settings/config/PlanConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/settings/config/PlanConfig.java b/Plan/common/src/main/java/com/djrapitops/plan/settings/config/PlanConfig.java index 351daa787..4f556b2dd 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/settings/config/PlanConfig.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/settings/config/PlanConfig.java @@ -108,10 +108,10 @@ public class PlanConfig extends Config { return foundTZ.orElse(TimeZone.getTimeZone(ZoneId.of("UTC"))); } - public int getTimeZoneOffsetHours() { - int offset = getTimeZone().getOffset(System.currentTimeMillis()); + public double getTimeZoneOffsetHours() { + int offsetMs = getTimeZone().getOffset(System.currentTimeMillis()); int hourMs = (int) TimeUnit.HOURS.toMillis(1L); - return -offset / hourMs; + return -offsetMs * 1.0 / hourMs; } public Path getPageExportPath() {