Skip to content

Commit

Permalink
fix #874 TimeBox value is not set after picking time
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Nov 2, 2023
1 parent 7aac106 commit 56d2cfd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ public void onTimeSelectionChanged(Date date) {
clearInvalid();
withValue(date);
}
this.popover.close();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,17 @@ public TimePicker(Date date, DateTimeFormatInfo dateTimeFormatInfo) {
this.date = updatedTime;
onTimeViewUpdate(updatedTime);
triggerChangeListeners(oldTime, this.date);
timeSelectionListeners.forEach(listener -> listener.onDaySelected(oldTime, this.date));
onTimeSelectionChanged(this.date);
timeSelectionListeners.forEach(listener -> listener.onTimeSelected(oldTime, this.date));
});

onTimeViewUpdate(this.date);
}

private void onTimeSelectionChanged(Date date) {
new ArrayList<>(viewListeners).forEach(listener -> listener.onTimeSelectionChanged(date));
}

/**
* Creates a new TimePicker instance with the specified date.
*
Expand Down Expand Up @@ -214,10 +219,15 @@ public DateTimeFormatInfo getDateTimeFormatInfo() {
*/
public TimePicker setDateTimeFormatInfo(DateTimeFormatInfo dateTimeFormatInfo) {
this.dateTimeFormatInfo = dateTimeFormatInfo;
onTimeViewUpdate(this.date);
onDateTimeFormatChanged();
return this;
}

private void onDateTimeFormatChanged() {
new ArrayList<>(viewListeners)
.forEach(listener -> listener.onDateTimeFormatInfoChanged(getDateTimeFormatInfo()));
}

/**
* Binds a TimePickerViewListener to this TimePicker instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ public interface TimeSelectionListener {
* @param oldDate The previously selected date.
* @param newDate The newly selected date.
*/
void onDaySelected(Date oldDate, Date newDate);
void onTimeSelected(Date oldDate, Date newDate);
}

0 comments on commit 56d2cfd

Please sign in to comment.