-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Describe the bug
When a min is set on YearMonthField and the current value is below that minimum, the component does not clamp to the minimum. A missing else if in __normalizeValue() causes the else branch to run after the min-clamping block, overwriting the clamped value with the original out-of-range value.
if (this.min && intValue < this._minAsNumber){
this.value = ...; // clamp to min
this.date = ...;
} if (this.max && intValue > this._maxAsNumber){ // <-- missing `else`
this.value = ...;
this.date = ...;
} else {
this.value = value; // overwrites the clamped value when min is violated
}Expected behavior
Setting a min later than the current value should clamp the displayed value to min.
Minimal reproducible example
YearMonthField field = new YearMonthField();
field.setValue(YearMonth.of(2024, 1));
field.setMin(YearMonth.of(2024, 6));
// field displays 2024-01 instead of 2024-06Add-on Version
4.6.1-SNAPSHOT
Vaadin Version
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
In Progress