1.2.5 • Published 7 years ago
aiesec-datepicker v1.2.5
ng2-datepicker
This is a forked version of the original ng2-datepicker package
Angular 2+ Simple and minimal datepicker component
Installation
- Install package from
npm.
npm install aiesec-datepicker --save- Include NgDatepickerModule into your application.
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgDatepickerModule } from 'aiesec-datepicker';
@NgModule({
imports: [
BrowserModule,
NgDatepickerModule
],
declarations: [ AppComponent ],
exports: [ AppComponent ]
})
export class AppModule {}Example
<ng-datepicker [(ngModel)]="date" />Additional attributes
| Name | Type | Default | Description |
|---|---|---|---|
headless | boolean | false | Disable datepicker's input |
isOpened | boolean | false | Show or hide datepicker |
position | string | bottom-right | Dropdown position (bottom-left, bottom-right, top-left, top-right) |
Options
import { DatepickerOptions } from 'aiesec-datepicker';
import * as frLocale from 'date-fns/locale/fr';
options: DatepickerOptions = {
minYear: 1970,
maxYear: 2030,
displayFormat: 'MMM D[,] YYYY',
barTitleFormat: 'MMMM YYYY',
dayNamesFormat: 'dd',
firstCalendarDay: 0, // 0 - Sunday, 1 - Monday
locale: frLocale,
minDate: new Date(Date.now()), // Minimal selectable date
maxDate: new Date(Date.now()), // Maximal selectable date
barTitleIfEmpty: 'Click to select year',
placeholder: 'Enter Date'
};For available format options check out here.
Run Included Demo
- Clone this repository
git clone https://github.com/Manzurkds/ng2-datepicker.git
cd ng2-datepicker- Install packages
npm install- Run Demo
npm startLicence
MIT