How to pick a date using ion-date-time tag


#1

Hi, i am trying to pick a

<ion-row>
					<ion-col text-right>
						<ion-label> <b> Rent To Be Paid At : </b></ion-label>
					</ion-col>
					<ion-col text-left>
						<ion-row>
							<ion-col col-4>
								<ion-datetime name="rentPayDate" displayFormat="DD" [(ngModel)]="rentPayDate"> </ion-datetime>
							</ion-col>
							<ion-col col-8>
								<ion-label>/ currentMonth /CurrentYear </ion-label>
							</ion-col>
						</ion-row>
					</ion-col>
				</ion-row>

I am able to pick a days date but when i try to display it on to my console i get a empty value. rentPayDate: ""
this is the date selector
1

this id my console
2

this is my ts file

rent(form){
		console.log("form",form.value);
		console.log("rent pay date",this.rentPayDate)
}

#2

export class demo{

 rentPayDate:String;

 constructor(){
      this.rentPayDate= new Date().toISOString();
 }

}

// selected date store in rentPayDate variable.use like variable In .ts file


Ion-datetime format
#3

check the updated question with images


#4

First of all confirm that you have initialized “rentpaydate” in constructor as I have mentioned in my previous comment. Just do it and you will start getting values.