wekas
February 13, 2023, 4:06am
1
When I open the ion-datetime in calendar mode it is blank on Android 8.
Some users also get this in chrome on PC.
It seems fine on ios in either light or dark mode.
It seems the color of the day numbers is white on a white background.
Code:
<ion-col *ngIf="startDateType === 'future'" class="date-start-container">
<ion-datetime-button color="dark" datetime="dateControlStart"></ion-datetime-button>
<ion-modal [isOpen]="isStartDateModalOpen" [keepContentsMounted]="true">
<ng-template>
<ion-datetime id="dateControlStart" class="shadow-override" #dateControlStart
[value]="dateStartString"
presentation="date"
[showDefaultTitle]="true"
[showDefaultButtons]="true"
[min]="dateStartString"
[max]="dateFutureString"
(ionChange)="onDateStartChange($event)"
>
<span slot="title">Select a membership/pass start date</span>
</ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
Partial fix:
I managed to get it partially fixed using this but it only works if you close and then reopen the ion-datetime.
ion-datetime {
&:not(.datetime-placeholder) {
color: black;
}
}
wekas
February 14, 2023, 3:05am
2
I have found what is causing the issue.
I was using *ngIf in the containing element.
I have replaced
<ion-col *ngIf="startDateType === 'future'" class="date-start-container">
with
ion-col class="date-start-container" [ngClass]="{'hide-me': startDateType !== 'future'}">
<ion-datetime-button color="dark" datetime="dateControlStart"></ion-datetime-button>
<ion-modal [isOpen]="isStartDateModalOpen" [keepContentsMounted]="true">
<ng-template>
<ion-datetime [ngClass]="{'ion-datetime-fix': applyIonDateTimeFix}"
...
async ngOnInit() {
setTimeout(() => {
this.applyIonDateTimeFix = true;
}, 5000);
}
.ion-datetime-fix {
color: black!important;
}
.hide-me {
display: none!important;
}
wekas
February 14, 2023, 3:06am
3
I now seem to have another issue. Any pointers in the right direction would be appreciated.
When opening the ion-modal with the ion-datetime using <ion-modal [isOpen]=“value” it does not display the modal correctly and hides the background with a white backdrop.
This works fine if I try it with a brand new Ionic project with the latest version or with the original code using the *ngIf.
Code is as above.
See videos here:
opened 04:27AM - 13 Feb 23 UTC
triage
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://githu… b.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.
### Ionic Framework Version
- [ ] v4.x
- [ ] v5.x
- [X] v6.x
- [ ] v7.x
- [ ] Nightly
### Current Behavior
When I open the ion-datetime in calendar mode it appears blank on Android 8.
This is actually because the color of the day numbers is white on a white background and so it is still usable you just can't see it.
Some users also get this in chrome on PC.
It seems fine on iOS in either light or dark mode.
![Screenshot_20230213-164805](https://user-images.githubusercontent.com/43654472/218369981-fde3d79c-6e48-4b8b-8242-1286ef73414a.png)
### Expected Behavior
I would expect the day numbers to be black with a white background.
### Steps to Reproduce
Code:
```
<ion-col *ngIf="startDateType === 'future'" class="date-start-container">
<ion-datetime-button color="dark" datetime="dateControlStart"></ion-datetime-button>
<ion-modal [isOpen]="isStartDateModalOpen" [keepContentsMounted]="true">
<ng-template>
<ion-datetime id="dateControlStart" class="shadow-override" #dateControlStart
[value]="dateStartString"
presentation="date"
[showDefaultTitle]="true"
[showDefaultButtons]="true"
[min]="dateStartString"
[max]="dateFutureString"
(ionChange)="onDateStartChange($event)"
>
<span slot="title">Select a membership/pass start date</span>
</ion-datetime>
</ng-template>
</ion-modal>
</ion-col>
```
Partial fix: I managed to get it partially fixed using this but it only works if you close and then reopen the ion-datetime.
```
ion-datetime {
&:not(.datetime-placeholder) {
color: black;
}
}
```
### Code Reproduction URL
_No response_
### Ionic Info
This command does not output any results.
I am using "@ionic/angular": "^6.4.2"
### Additional Information
_No response_