Skip to content

Commit

Permalink
Fix getConnectionDataHistory DST gap hour bug (#11647)
Browse files Browse the repository at this point in the history
  • Loading branch information
teallarson committed Mar 13, 2024
1 parent a77e127 commit 6cf30cb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import java.io.IOException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -923,7 +924,7 @@ public List<ConnectionDataHistoryReadItem> getConnectionDataHistory(final Connec
final ZoneId requestZone = ZoneId.of(connectionDataHistoryRequestBody.getTimezone());

// Start time in designated timezone
final ZonedDateTime endTimeInUserTimeZone = Instant.now().atZone(ZoneId.of(connectionDataHistoryRequestBody.getTimezone()));
final ZonedDateTime endTimeInUserTimeZone = Instant.now().atZone(requestZone).toLocalDate().atTime(LocalTime.MAX).atZone(requestZone);
final ZonedDateTime startTimeInUserTimeZone = endTimeInUserTimeZone.toLocalDate().atStartOfDay(requestZone).minusDays(29);
// Convert start time to UTC (since that's what the database uses)
final Instant startTimeInUTC = startTimeInUserTimeZone.toInstant();
Expand Down

0 comments on commit 6cf30cb

Please sign in to comment.