Home > Software engineering >  Use Ionic 6 style date picker in Ionic 5 for ion-datetime [monthview datepicker]
Use Ionic 6 style date picker in Ionic 5 for ion-datetime [monthview datepicker]

Time:10-14

I have a date picker in my application that brings up the iOS native date picker. I would like to change this to show a month view (image attached for reference).

How can I do this? Are there modules out there I can use in my existing app? reference to how I want it to look

CodePudding user response:

The presentation property allows you to specify which pickers to show and the order to show them in. Use "month" or "month-year" in your case.

For example:

<ion-datetime presentation="month-year"></ion-datetime>

Stackblitz demo

CodePudding user response:

I found a solution here:

https://www.freakyjolly.com/ionic-angular-material-how-to-install-material-and-use-its-components-in-ionic-app/

References I used:

https://forum.ionicframework.com/t/ionic5-with-angular-material/215303

I was having dependency issues installing material, so I added this under dependencies in packages.json:

"@angular/animations": "~8.1.3"

Then I installed material using this command:

ng add @angular/[email protected]

I also didnt have angular installed so I used this to install angular:

npm install -g @angular/[email protected]

  • Related