Skip to content

Commit d902f8d

Browse files
authored
fix(material/datepicker): Fix raw date value being compared (#27896)
* fix(material/datepicker): Compare dates using compareValue instead of rawValue * fix(material/datepicker): Corrected formatting of calendar-body.ts
1 parent e181615 commit d902f8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/material/datepicker/calendar-body.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ export class MatCalendarBody<D = any> implements OnChanges, OnDestroy, AfterView
186186

187187
private _didDragSinceMouseDown = false;
188188

189-
constructor(private _elementRef: ElementRef<HTMLElement>, private _ngZone: NgZone) {
189+
constructor(
190+
private _elementRef: ElementRef<HTMLElement>,
191+
private _ngZone: NgZone,
192+
) {
190193
_ngZone.runOutsideAngular(() => {
191194
const element = _elementRef.nativeElement;
192195

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

0 commit comments

Comments
 (0)