Hi all!
I’ve been struggling with the ionic-datetime component today.
So I have this piece of code in my .html:
<ion-item class="container-date" lines="none">
<ion-datetime displayFormat="DD/MM/YYYY" pickerFormat="DD/MM/YYYY" [(ngModel)]="date" placeholder="{{ date }}"></ion-datetime>
</ion-item>
And the following in my .ts file:
date = moment(new Date()).format("DD/MM/YYYY");
I’ve also tried this; same result though:
date = new Date().toISOString();
So the format before I select a new date is as follows:
29/03/2021
When I select a new date (let’s say 30/03/2021) it changes to “2021-03-30” and when I try changing it again it changes to “2021-03-31T00:00:00+02:00”.
I have no clue what to do anymore. Thanks in advance!
FYI, I want to sort date from my local json file using the datetime component. And I need a specific format for that to work.