Skip to content

Commit 5643f12

Browse files
committed
refactor(material/datepicker): rebased and resolved changes
Updates previous change to new datepicker changes.
1 parent 23789d2 commit 5643f12

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/material/datepicker/calendar-body.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@
9090
<span [id]="_endDateLabelId" class="mat-calendar-body-hidden-label">
9191
{{endDateAccessibleName}}
9292
</span>
93+
<span [id]="_comparisonStartLabelId" class="mat-calendar-body-hidden-label">
94+
Sub range {{startDateAccessibleName}}
95+
</span>
96+
<span [id]="_comparisonEndLabelId" class="mat-calendar-body-hidden-label">
97+
Sub range {{endDateAccessibleName}}
98+
</span>

src/material/datepicker/calendar-body.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,16 @@ export class MatCalendarBody<D = any> implements OnChanges, OnDestroy, AfterView
467467
} else if (this.endValue === value) {
468468
return this._endDateLabelId;
469469
}
470+
471+
if (this.comparisonStart !== null && this.comparisonEnd !== null) {
472+
if (value === this.comparisonStart && value === this.comparisonEnd) {
473+
return `${this._comparisonStartLabelId}-${this._comparisonEndLabelId}`;
474+
} else if (value === this.comparisonStart) {
475+
return this._comparisonStartLabelId;
476+
} else if (value === this.comparisonEnd) {
477+
return this._comparisonEndLabelId;
478+
}
479+
}
470480
return null;
471481
}
472482

@@ -607,6 +617,16 @@ export class MatCalendarBody<D = any> implements OnChanges, OnDestroy, AfterView
607617

608618
return null;
609619
}
620+
621+
private _id = `mat-calendar-body-${calendarBodyId++}`;
622+
623+
_startDateLabelId = `${this._id}-start-date`;
624+
625+
_endDateLabelId = `${this._id}-end-date`;
626+
627+
_comparisonStartLabelId = `${this._id}-comparison-start-date`;
628+
629+
_comparisonEndLabelId = `${this._id}-comparison-end-date`;
610630
}
611631

612632
/** Checks whether a node is a table cell element. */

0 commit comments

Comments
 (0)