basti
December 22, 2021, 7:19pm
1
Hey, I just love the new look of ion-datetime. Unfortunately it’s only working well in the current month.
Here’s my code (ionic 6.0.1):
<ion-item>
<ion-label>{{ 'AUDIT.date' | translate }}</ion-label>
<ion-text slot="end">{{ audit.date | date:'dd.MM.yyyy' }}</ion-text>
<ion-button slot="end" fill="clear" id="open-date-input">
<ion-icon icon="calendar"></ion-icon>
</ion-button>
<ion-popover trigger="open-date-input" show-backdrop="true">
<ng-template>
<ion-datetime #popoverDatetime presentation="date" max="2025" [min]="today.startMin" mode='md'
(ionChange)="audit.date = popoverDatetime.value">
</ion-datetime>
</ng-template>
</ion-popover>
</ion-item>
But I also tried it with just
<ion-datetime> </ion-datetime>
with the same result.
i’m sure the problem of that datepicker is the [min] value
Just for being sure, remove min and max and execute it again.
If works correctly, add the max value.
Again, if works, add a min=“2022-01-31” value as test, if still works, the problem is in the today.startMin value
basti
December 23, 2021, 10:00am
3
No, also with the minimum datetime it’s the same.
maybe it misses the [value] tag?
basti
December 23, 2021, 11:53am
5
I tried all versions from the docs, the appearance is always the same.
i just made a new demo with a ionic starter project:
everything works as expected
or if you want to close the datepicker on click, just set the .confirm(true) attribute
basti
December 23, 2021, 1:47pm
7
Thanks for checking this out! I upgraded from ionic 5, so is it possible that there is the problem somewhere?
copy and paste here your ionic info output, so we can check.
Anyway, I tried to update from version 5 and the datetime still works, have you tried to start a blank project and try the datetime?
basti
December 23, 2021, 8:32pm
9
Also a blank project doesn’t work
Ionic info:
Ionic CLI : 6.18.1
Ionic Framework : @ionic/angular 6.0.1
@angular-devkit/build-angular : 12.2.2
@angular-devkit/schematics : 12.2.14
@angular/cli : 12.2.2
@ionic/angular-toolkit : 5.0.3
That’s really weird. Can you show me all the code? Html and .ts file please
basti
December 23, 2021, 8:53pm
11
Whole file pretty long, but it’s the same with the blank starter: Only thing I added to the
ionic start myApp blank
is
<ion-datetime></ion-datetime>
on the home.page.html
Ionic info there is:
Ionic CLI : 6.18.1
Ionic Framework : @ionic/angular 6.0.1
@angular-devkit/build-angular : 13.0.4
@angular-devkit/schematics : 13.0.4
@angular/cli : 13.0.4
@ionic/angular-toolkit : 5.0.3
basti
December 27, 2021, 1:49pm
12
I’m always testing with chrome, tried it now with firefox and it’s working there. Deleting all data from chrome made no difference. Is it possible that there’s a problem with chrome?
I don’t think so, i’m using with chrome.
Try to execute it in incognito
basti
December 27, 2021, 6:30pm
14
It’s the same in incognito mode
If you want, send me the src folder of your app, i will investigate
basti
January 5, 2022, 10:02am
16