@lichr/ngx-mat-datetime-picker
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Ngx Material DatetimePicker, Timepicker for @angular/material 7.x, 8.x

Build Status codecov License npm version

Description

A DatetimePicker like @angular/material Datepicker by adding support for choosing time.

DEMO

@see Demo here

Alt Text

Getting started

npm install --save ngx-mat-datetime-picker

Setup

Basically the same way the @angular/material Datepicker is configured and imported.

import { NgxMatDatetimePickerModule, NgxMatTimepickerModule } from 'ngx-mat-datetime-picker';
@NgModule({
   ...
   imports: [
      BrowserModule,
      HttpClientModule,
      BrowserAnimationsModule,
      MatDatepickerModule,
      MatInputModule,
      NgxMatTimepickerModule,
      FormsModule,
      ReactiveFormsModule,
      MatButtonModule,
      NgxMatDatetimePickerModule,
   ],
   ...
})
export class AppModule { }

@see src/app/app.module.ts

Using the component

The same API as @angular/material Datepicker (@see API docs)

Datetime picker using FormControl

<mat-form-field>
    <input matInput [ngxMatDatetimePicker]="picker" placeholder="Choose a date" [formControl]="dateControl">
    <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
    <ngx-mat-datetime-picker #picker></ngx-mat-datetime-picker>
</mat-form-field>

Timepicker

<ngx-mat-timepicker [(ngModel)]="date"></ngx-mat-timepicker>
<ngx-mat-timepicker [(ngModel)]="date" [disabled]="disabled"></ngx-mat-timepicker>
<ngx-mat-timepicker [(ngModel)]="date" [stepHour]="2" [stepMinute]="5" [stepSecond]="10"></ngx-mat-timepicker>
<ngx-mat-timepicker [(ngModel)]="date" [showSpinners]="showSpinners"></ngx-mat-timepicker>

Theming

<link href="https://fonts.googleapis.com/icon?family=Material+Icons&display=block" rel="stylesheet">

License

MIT

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @lichr/ngx-mat-datetime-picker

    Weekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    966 kB

    Total Files

    36

    Last publish

    Collaborators

    • lichr