Skip to content

Commit

Permalink
fix(material/datepicker): Fix raw date value being compared (#27896)
Browse files Browse the repository at this point in the history
* fix(material/datepicker): Compare dates using compareValue instead of rawValue

* fix(material/datepicker): Corrected formatting of calendar-body.ts
  • Loading branch information
cromefire committed Nov 9, 2023
1 parent e181615 commit d902f8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/material/datepicker/calendar-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ export class MatCalendarBody<D = any> implements OnChanges, OnDestroy, AfterView

private _didDragSinceMouseDown = false;

constructor(private _elementRef: ElementRef<HTMLElement>, private _ngZone: NgZone) {
constructor(
private _elementRef: ElementRef<HTMLElement>,
private _ngZone: NgZone,
) {
_ngZone.runOutsideAngular(() => {
const element = _elementRef.nativeElement;

Expand Down Expand Up @@ -512,7 +515,7 @@ export class MatCalendarBody<D = any> implements OnChanges, OnDestroy, AfterView
this._didDragSinceMouseDown = false;
// Begin a drag if a cell within the current range was targeted.
const cell = event.target && this._getCellFromElement(event.target as HTMLElement);
if (!cell || !this._isInRange(cell.rawValue)) {
if (!cell || !this._isInRange(cell.compareValue)) {
return;
}

Expand Down

0 comments on commit d902f8d

Please sign in to comment.