I would like the current time to be displayed in the dateTime input field but it does not display by default. However whenever I select a time from the dateTime picker it saves in the database in 24 hour format. Please help me display and save by default in the 12 hour format thank you.
if i use format below it displays the time however it stores as a 24 hr formation the database even though I have the dateTIme picker displayFormat=“h:mm a”
date = new Date()
pickupTIme = date.toLocaeTimeString();
component:
pickupTIme: string = ’ ’
this.pickupTime = moment().format(‘LT’);
console.log(‘pickup TIme’, this.pickupTime;
HTML:
<ion-datetime formControlName=“pickUpTime” class=“input-box” displayFormat=“h:mm a” pickerFormat=“h:mm a” [(ngModel)]=“pickupTime” type=“time”>