From 82b221dc339e770b253d5a2a2ba0e6095e0d4434 Mon Sep 17 00:00:00 2001 From: mkpaz Date: Thu, 9 Feb 2023 15:01:37 +0400 Subject: [PATCH] ErrorProne: fix base/JavaTimeDefaultTimeZone --- .../base/controls/InlineDatePickerBehavior.java | 3 ++- .../atlantafx/base/controls/InlineDatePickerSkin.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/base/src/main/java/atlantafx/base/controls/InlineDatePickerBehavior.java b/base/src/main/java/atlantafx/base/controls/InlineDatePickerBehavior.java index acda0b2..4bc6749 100755 --- a/base/src/main/java/atlantafx/base/controls/InlineDatePickerBehavior.java +++ b/base/src/main/java/atlantafx/base/controls/InlineDatePickerBehavior.java @@ -5,6 +5,7 @@ import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import java.time.LocalDate; +import java.time.ZoneId; import static atlantafx.base.util.PlatformUtils.isMac; import static java.time.temporal.ChronoUnit.MONTHS; @@ -24,7 +25,7 @@ public class InlineDatePickerBehavior extends BehaviorBase { - getSkin().goToDate(LocalDate.now(), true); + getSkin().goToDate(LocalDate.now(ZoneId.systemDefault()), true); e.consume(); } case PAGE_UP -> { diff --git a/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java b/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java index d657574..2ad6526 100755 --- a/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java +++ b/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java @@ -45,6 +45,7 @@ import javafx.util.Callback; import java.time.DateTimeException; import java.time.LocalDate; import java.time.YearMonth; +import java.time.ZoneId; import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; import java.time.format.DateTimeFormatter; @@ -105,7 +106,9 @@ public class InlineDatePickerSkin extends BehaviorSkinBase { LocalDate date = datePicker.getValue(); - displayedYearMonthProperty().set((date != null) ? YearMonth.from(date) : YearMonth.now()); + displayedYearMonthProperty().set( + date != null ? YearMonth.from(date) : YearMonth.now(ZoneId.systemDefault()) + ); updateValues(); datePicker.fireEvent(new ActionEvent()); }); @@ -185,7 +188,9 @@ public class InlineDatePickerSkin extends BehaviorSkinBase updateValues()); rootPane.getChildren().add(createMonthYearPane()); @@ -611,6 +616,6 @@ public class InlineDatePickerSkin extends BehaviorSkinBase