Timepicker overview

Overview
API
Theme
Examples

NbTimePickerDirective

The NbTimePickerDirective is form control that gives you ability to select a time. The timepicker is shown when input receives a focus event.

<input [nbTimepicker]="timepicker">
<nb-timepicker #timepicker></nb-timepicker>
Showcase

Installation

Import NbTimepickerModule.forRoot() to your root module.

@NgModule({
  imports: [
    // ...
    NbTimepickerModule.forRoot(),
  ],
})
export class AppModule { }

And NbTimepickerModule to your feature module.

@NgModule({
  imports: [
    // ...
    NbTimepickerModule,
  ],
})
export class PageModule { }
Note
Timepicker uses native Date object by default, which doesn't support parsing by custom format. According to the ECMAScript specification, the only supported format is a format described by ISO 8061 standard. This standard requires date part to be included in the date string, meaning you have to type a date+time in the input. We highly recommend you to use NbDateFnsDateModule or NbMomentDateModule to be able to support time only strings in the timepicker inputs. These modules use date-fns and moment date libraries, which provide capabilities to parse time only strings. See "Formatting Issue" at Date picker docs for installation instructions.

Usage

To show seconds column along with hours and minutes use withSeconds input

<input [nbTimepicker]="timepicker">
<nb-timepicker #timepicker withSeconds></nb-timepicker>
Time picker with seconds

To force timepicker work in 12 hours format, use twelveHoursFormat input. By default, timepicker choose 12 or 24 formats based on application locale standards

<input [nbTimepicker]="timepicker" twelveHoursFormat>
<nb-timepicker #timepicker></nb-timepicker>
Twelve hours format showcase

A single column picker with options value as time and minute, so users won’t be able to pick hours and minutes individually. You can control options minutes offset via step input, e.g.: 11:00, 11:20, 11:40...'

Single column

Timepicker support forms and reactive forms API so you can provide value using formControl and ngModel directives

Form control

<input [nbTimepicker]="timepicker" twelveHoursFormat> <nb-timepicker #timepicke [formControl]="formControl">

Ngmodel

<input [nbTimepicker]="timepicker" twelveHoursFormat> <nb-timepicker #timepicke [ngModel]="date">

You can provide localized versions of the timepicker text via the localization property of the config object passed to the forRoot or forChild methods of the NbTimepickerModule:

@NgModule({
  imports: [
    // ...
    NbTimepickerModule.forRoot({
      localization: {
        hoursText: 'Hr',
        minutesText: 'Min',
        secondsText: 'Sec',
        ampmText: 'Am/Pm',
      }
    }),
  ],
})
export class AppModule { }

NbTimePickerComponent

The TimePicker components itself. Provides a proxy to TimePicker options as well as custom picker options.

Datepicker
Previous page
Tag
Next page

Need some help or found an issue?

Ask on Stack Overflow with tag `nebular` or post an issue on GitHub.