Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/datepicker): changed after checked error when assigning end value #30534

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/material/datepicker/date-range-input-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ abstract class MatDateRangeInputPartBase<D>
opposite?._validatorOnChange();
}

protected override _formatValue(value: D | null) {
super._formatValue(value);
// Any time the input value is reformatted we need to tell the parent.
this._rangeInput._handleChildValueChange();
}

/** return the ARIA accessible name of the input element */
_getAccessibleName(): string {
return _computeAriaAccessibleName(this._elementRef.nativeElement);
Expand Down Expand Up @@ -264,16 +270,10 @@ export class MatStartDate<D> extends MatDateRangeInputPartBase<D> {
if (this._model) {
const range = new DateRange(value, this._model.selection.end);
this._model.updateSelection(range, this);
this._rangeInput._handleChildValueChange();
}
}

protected override _formatValue(value: D | null) {
super._formatValue(value);

// Any time the input value is reformatted we need to tell the parent.
this._rangeInput._handleChildValueChange();
}

override _onKeydown(event: KeyboardEvent) {
const endInput = this._rangeInput._endInput;
const element = this._elementRef.nativeElement;
Expand Down
2 changes: 0 additions & 2 deletions tools/public_api_guard/material/datepicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,6 @@ export class MatStartDate<D> extends MatDateRangeInputPartBase<D> {
// (undocumented)
protected _assignValueToModel(value: D | null): void;
// (undocumented)
protected _formatValue(value: D | null): void;
// (undocumented)
protected _getValueFromModel(modelValue: DateRange<D>): D | null;
// (undocumented)
_onKeydown(event: KeyboardEvent): void;
Expand Down
Loading