Skip to content

Commit 41168b3

Browse files
committed
PTBAS-373: Fix Calendar View not consistent
1 parent c9cc12b commit 41168b3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/main/java/de/doubleslash/keeptime/common/DateFormatter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public LocalDate fromString(String s) {
9090
}
9191
});
9292

93+
datePicker.setOnShowing(e -> Locale.setDefault(systemLocale));
9394
datePicker.setPromptText(formatter.format(LocalDate.now()));
9495
}
9596
}

src/main/java/de/doubleslash/keeptime/view/ReportController.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,7 @@ private void loadCalenderWidget() {
361361
updateReport(newvalue);
362362
});
363363

364-
// HACK to show calendar from datepicker
365-
// https://stackoverflow.com/questions/34681975/javafx-extract-calendar-popup-from-datepicker-only-show-popup
366-
final DatePickerSkin datePickerSkin = new DatePickerSkin(myDatePicker);
364+
367365
final Callback<DatePicker, DateCell> dayCellFactory = callback -> new DateCell() {
368366
@Override
369367
public void updateItem(final LocalDate item, final boolean empty) {
@@ -379,9 +377,19 @@ public void updateItem(final LocalDate item, final boolean empty) {
379377

380378
};
381379
myDatePicker.setDayCellFactory(dayCellFactory);
382-
final Node popupContent = datePickerSkin.getPopupContent();
383-
this.topBorderPane.setRight(popupContent);
384380

381+
Locale defaultLocale = Locale.getDefault();
382+
try {
383+
Locale.setDefault(DateFormatter.getSystemLocale());
384+
385+
// HACK to show calendar from datepicker
386+
// https://stackoverflow.com/questions/34681975/javafx-extract-calendar-popup-from-datepicker-only-show-popup
387+
final DatePickerSkin datePickerSkin = new DatePickerSkin(myDatePicker);
388+
final Node popupContent = datePickerSkin.getPopupContent();
389+
this.topBorderPane.setRight(popupContent);
390+
} finally {
391+
Locale.setDefault(defaultLocale);
392+
}
385393
}
386394

387395
private Button createDeleteWorkButton(final Work w) {

0 commit comments

Comments
 (0)