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

ngx-mat-datetime-picker is improperly formatted in angular 16 #381

Open
annamichalik opened this issue Feb 16, 2024 · 3 comments
Open

ngx-mat-datetime-picker is improperly formatted in angular 16 #381

annamichalik opened this issue Feb 16, 2024 · 3 comments

Comments

@annamichalik
Copy link

Only version "@angular/material": "16.1.1" works correctly for me . I had created this example :
source code : https://github.com/annamichalik/AngularMaterial16
live example : [https://stackblitz.com/~/github.com/annamichalik/AngularMaterial16]

When on first loaded/ refreshed page you select first the Date/Time you will see :
image

When you select 'Choose a date' and then select Date/Time proper view is visible
image

I have described the issue also here :
https://stackoverflow.com/questions/77114244/angular-material-components-datetime-picker-is-improperly-formatted-in-angular/78007657#78007657

@labisda
Copy link

labisda commented Feb 18, 2024

Hi,

As a work around. I created a custom css for this.

image

.mat-datepicker-content {
  background: map-get(palette.$navyNeutral, navy1);
  box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, .2), 0px 4px 5px 0px rgba(0, 0, 0, .14), 0px 1px 10px 0px rgba(0, 0, 0, .12); // angular's box shadow for datepicker

  // Removes the circles around the dates
  .mat-calendar-body-cell-content {
    border: none;

    // When date was hovered, this is what it will look like
    &:hover {
      background: map-get(palette.$greenCore, green2);
    }

    // When date was selected, this is what it will look like
    &.mat-calendar-body-selected {
      background: map-get(palette.$greenCore, green0);
      color: #fff;
    }
  }
}

I hope this helps. :)

@hncleary
Copy link

hncleary commented Feb 20, 2024

@labisda thanks for the css 🎉

The class provided solved my calendar selection issues, but I still had display issues with my timepicker. Providing my additional scss for anyone experiencing the same problem as me:

image => image
.mat-datepicker-content {
    background: white;
    box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14),
        0px 1px 10px 0px rgba(0, 0, 0, 0.12); // angular's box shadow for datepicker

    // Removes the circles around the dates
    .mat-calendar-body-cell-content {
        border: none;

        // When date is hovered
        &:hover {
            background: #a3a3a3;
        }

        // When date is selected
        &.mat-calendar-body-selected {
            background: #a3a3a3;
            color: #fff;
        }
    }

    .ngx-mat-timepicker {
        padding-bottom: 10px;
        tr,
        td {
            background-color: #ffffff01 !important;
            &:hover {
                background-color: #ffffff01 !important;
            }
        }
        tr {
            padding-top: 5px;
        }
        .mat-mdc-form-field-subscript-wrapper {
            display: none;
        }
        button {
            margin-top: 3px;
        }
        .mat-mdc-icon-button {
            border: solid #80808075 1px;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            padding-right: 0px;
            &:hover {
                background-color: #a3a3a37b;
            }
        }
    }
}

@Didasko
Copy link

Didasko commented Apr 15, 2024

Thanks for the workarounds.

If you want to keep the graying of dates below "min" or above "max", you can add the following style:

.mat-calendar-body-disabled > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
  color: rgba(0, 0, 0, 0.38);
}

A patch to make this component work with Angular 16.2.12 would still be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants