0

I'm using owl date time for giving the time picker option to a form. But I'm facing a problem with restricting users to select past times, for eg if the current time is 16:15 pm I want to restrict users to save time ie less than the current time 16.15pm.

I tried using [min] attribute but no success.*

code:

<mat-form-field [owlDateTimeTrigger]="dt2" id="timer-clock" floatLabel="never">
              <input placeholder="hh:mm:ss" 
                     matInput 
                     formControlName="form_time"
                     [min]="minTime"
                     [owlDateTimeTrigger]="dt2"  
                     [owlDateTime]="dt2" 
                     [readonly]="true" />

              <owl-date-time [pickerType]="'timer'" 
                             [showSecondsTimer]="true" #dt2 >
              </owl-date-time>

           </mat-form-field>
justD
  • 1
  • 2

1 Answers1

0

It depends more on what value you're providing to min, try something like: [min] = 'initialStartDate' where const initialStartDate = new Date(); Notice that min will only accept Date values.

Nitika
  • 424
  • 2
  • 9
  • As i said, i've already tried that but it's not disabling the past time. Like by default in that timer, im getting current time only but i can select past time too. I have two fields: one for giving date option and the other for the time. Like date-picker is disabling past date and i' want same behaviour with time picker so that user cant select past time. – justD Jan 22 '21 at 11:07