Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/h2qutc/ngx-mat-datetime-picker

⛔️ DEPRECATED This is no longer supported, please consider using the repository @angular-material-components/datetime-picker(https://github.com/h2qutc/angular-material-components) instead.
https://github.com/h2qutc/ngx-mat-datetime-picker

deprecated obselete

Last synced: 2 months ago
JSON representation

⛔️ DEPRECATED This is no longer supported, please consider using the repository @angular-material-components/datetime-picker(https://github.com/h2qutc/angular-material-components) instead.

Awesome Lists containing this project

README

        

# ⛔️ DEPRECATED
## This is no longer supported, please consider using the repository [angular-material-components/datetime-picker](https://github.com/h2qutc/angular-material-components) instead.

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

[![Build Status](https://travis-ci.com/h2qutc/ngx-mat-datetime-picker.svg?branch=master)](https://travis-ci.com/h2qutc/ngx-mat-datetime-picker)
[![codecov](https://codecov.io/gh/h2qutc/ngx-mat-datetime-picker/branch/master/graph/badge.svg)](https://codecov.io/gh/h2qutc/ngx-mat-datetime-picker)
[![License](https://img.shields.io/npm/l/ngx-mat-datetime-picker.svg)](https://www.npmjs.com/package/ngx-mat-datetime-picker)
[![npm version](https://badge.fury.io/js/ngx-mat-datetime-picker.svg)](https://badge.fury.io/for/js/ngx-mat-datetime-picker)

## Description

A DatetimePicker like @angular/material [Datepicker](https://material.angular.io/components/datepicker/overview) by adding support for choosing time.

[![button](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SAAY32BP5KPPC&source=url)

## DEMO

@see [LIVE DEMO](https://h2qutc.github.io/ngx-mat-datetime-picker/)

![Alt Text](demo.png)

## Getting started

#### Angular 7.x, 8.x: Install the version v2.x

```
npm install --save [email protected]
```
@see [DEMO stackblitz for Angular 7, Angular 8](https://stackblitz.com/edit/demo-ngx-mat-datetime-picker)

#### Angular 9.x: Install the version v3.x

```
npm install --save [email protected]
```
@see [DEMO stackblitz for Angular 9](https://stackblitz.com/edit/demo-ngx-mat-datetime-picker-angular9)

## 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](src/app/app.module.ts)

## Using the component

The same API as @angular/material Datepicker (@see [API docs](https://material.angular.io/components/datepicker/api))

### Datetime Picker (ngx-mat-datetime-picker)

```




```

### Timepicker (ngx-mat-timepicker)

```

```

#### List of @Input

| @Input | Type | Default value | Description |
|--------------- |---------- |--------------- |---------------------------------------------------------------------- |
| **disabled** | boolean | null | If true, the picker is readonly and can't be modified |
| **showSpinners** | boolean | true | If true, the spinners above and below input are visible |
| **showSeconds** | boolean | true | If true, it is not possible to select seconds |
| **stepHour** | number | 1 | The number of hours to add/substract when clicking hour spinners |
| **stepMinute** | number | 1 | The number of minutes to add/substract when clicking minute spinners |
| **stepSecond** | number | 1 | The number of seconds to add/substract when clicking second spinners |
| **color** | ThemePalette | undefined | Color palette to use on the datepicker's calendar. |
| **enableMeridian** | boolean | false | Whether to display 12H or 24H mode. |
| **touchUi** | boolean | false | Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather than a popup and elements have more padding to allow for bigger touch targets. |

## Choosing a date implementation and date format settings

The datepicker was built to be date implementation agnostic. This means that it can be made to work with a variety of different date implementations. However it also means that developers need to make sure to provide the appropriate pieces for the datepicker to work with their chosen implementation.

The easiest way to ensure this is to import one of the provided date modules:

| | **NgxMatNativeDateModule** | **NgxMatMomentModule** |
|----------------------- |---------------------------- |------------------------------------------------------------------------------------- |
| **Date type** | Date | Moment |
| **Supported locales** | en-US | [See project for details](https://github.com/moment/moment/tree/develop/src/locale) |
| **Dependencies** | None | [Moment.js](https://momentjs.com/) |
| **Import from** | ngx-mat-datetime-picker | [ngx-mat-moment-adapter](https://www.npmjs.com/package/ngx-mat-moment-adapter) |

To use NgxMatMomentModule:
```
npm install --save ngx-mat-moment-adapter
```

Please note: NgxMatNativeDateModule is based off the functionality available in JavaScript's native Date object. Thus it is not suitable for many locales. One of the biggest shortcomings of the native Date object is the inability to set the parse format.

We highly recommend using the **NgxMatMomentModule** or a custom **NgxMatDateAdapter** that works with the formatting/parsing library of your choice.

For example:

Creating a custom date adapter:

```
@Injectable()
export class CustomDateAdapter extends NgxMatDateAdapter {...}
// D can be Date, Moment or customized type
```

Creating a custom date adapter module
```
@NgModule({
providers: [
{
provide: NgxMatDateAdapter,
useClass: CustomDateAdapter,
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS]
}
],
})
export class CustomDateModule { }
```

## Theming
- @see @angular/material [Using a pre-built theme](https://material.angular.io/guide/theming#using-a-pre-built-theme)
- Add the Material Design icon font to your index.html
```

```

## License
MIT