Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 15 <mat-datepicker> cell-content alignment issue

Scenario: I have upgraded a project from angular 12 to 15, angular material has been upgraded to 15.2.6. No external css is added for date-picker.

When opening the calendear, the date selected is aligned towards left.

enter image description here

As soon as the focus is changed(clicked anywhere else in the calendar window). alignment is corrected.

enter image description here

This is bare metal mat-datepicker, nothing extra is added.

I created a another project and there mat-datepicker is working perfectly fine. I tried to overide scss of mat-datepicker but found no success, with this alignment issue. If somebody faced this issue please help.

like image 333
parth_sh Avatar asked Feb 22 '26 06:02

parth_sh


1 Answers

I had the same issue once i migrated to Angular 14 to 15.

There seems to be a weird margin-right applied to icons, i had to remove theme manualy in global styles; with:

.mat-mdc-button>.mat-icon, .mat-mdc-raised-button>.mat-icon, .mat-mdc-flat-button>.mat-icon {
  margin-right: 0!important;
}

I should point out that this problem does not occur on newly created projects through angular cli.

like image 150
millenion Avatar answered Feb 23 '26 20:02

millenion



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!