I’m using a datetime component meant to show hours, I’m attaching its value to a form. I wish the input to be empty until you click on it, for which the hours should be open and set at 8:00 hours, this works fine locally but when deploying it over a server and checking on browser it always sets the minutes to the current time.
<ion-datetime formControlName="hourStart" display-format="HH:mm" picker-format="HH:mm"
[pickerOptions]="hourStartOptions" (click)="setInitialStartHour()">
</ion-datetime>
private minHour = {
hour: { text: '08', value: 8, columnIndex: 0 },
minute: { text: '00', value: 0, columnIndex: 1 }
};
public setInitialStartHour() {
if (isUndefined(this.absenceForm.controls['hourStart'].value)) {
this.form.controls['hourStart'].setValue(this.minHour);
this.form.controls['hourStart'].updateValueAndValidity();
}
}
Is there a way to avoid this from happening? Shouldn’t the datetime picker be set to its value?