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-06
Add-on Version
4.6.1-SNAPSHOT
Vaadin Version
N/A
Describe the bug
When a
minis set onYearMonthFieldand the current value is below that minimum, the component does not clamp to the minimum. A missingelse ifin__normalizeValue()causes theelsebranch to run after the min-clamping block, overwriting the clamped value with the original out-of-range value.Expected behavior
Setting a
minlater than the current value should clamp the displayed value tomin.Minimal reproducible example
Add-on Version
4.6.1-SNAPSHOT
Vaadin Version
N/A