Home > front end >  allow time picker in BsDatepickerConfig
allow time picker in BsDatepickerConfig

Time:01-03

I'm using BsDatepickerConfig to pick date also I want to use it to pick time in same field is there any way?

 <div >
        <fieldset [disabled]="caseFound">
        <div >
        <input type="text"  #dp="bsDatepicker" bsDatepicker
         bsConfig]="bsConfig" formControlName="cardExpiryDate" placeholder='DD-MM-YYYY'
         (ngModelChange)="triggerCheck()">
          <span ></span>
          <label>Card Expiry Date <span >*</span></label>
          <span *ngIf="submitted && f.cardExpiryDate.errors" >{{'Card Expiry Date is required'}}</span>
           </div>
        </fieldset>
         </div>

CodePudding user response:

You can pass withTimepicker as true in bsconfig:

    [bsConfig]="{withTimepicker: true, rangeInputFormat : 'MMMM Do YYYY, h:mm:ss a', dateInputFormat: 'MMMM Do YYYY, h:mm:ss a'}"

Example from documentation.

withTimepicker config option was added in ngx-bootstrap v7.1.2

  • Related