1.0.2 • Published 6 years ago

ng4-daterangepicker v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Angular DateRange Picker

This date range picker was heavily inspired by PayPal's datepicker as seen on website.

Installation

npm install ng4-daterangepicker --save

or

yarn add ng4-daterangepicker --save

Example

import { NgDateRangePickerModule } from 'ng4-daterangepicker';

// app.module.ts
@NgModule({
  ...
  imports: [ ..., NgDateRangePickerModule, ... ],
  ...
})
export class AppModule { }
// app.component.ts
import { Component, OnInit } from '@angular/core';
import { NgDateRangePickerOptions } from 'ng4-daterangepicker';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  options: NgDateRangePickerOptions;

  ngOnInit() {
    this.options = {
	  theme: 'default',
	  range: 'tm',
	  dayNames: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
	  presetNames: ['Today', 'This Month', 'Last Month', 'This Week', 'Last Week', 'This Year', 'Last Year', 'Start', 'End'],
	  dateFormat: 'yMd',
	  outputFormat: 'DD/MM/YYYY',
	  startOfWeek: 1
	};
  }
}
<!-- app.component.html -->
<ng-daterangepicker [(ngModel)]="value" [options]="options"></ng-daterangepicker>

Configuration

export interface NgDateRangePickerOptions {
  theme: 'default' | 'green' | 'teal' | 'cyan' | 'grape' | 'red' | 'gray';
  range: 'td' | 'tm' | 'lm' | 'lw' | 'tw' | 'ty' | 'ly';
  dayNames: string[];
  presetNames: string[];
  dateFormat: string;
  outputFormat: string;
  startOfWeek: number;
}

Running the demo

git clone https://github.com/nimbusitconsult/ng-daterangepicker.git --depth 1
cd ng-daterangepicker
npm start

Licence

MIT

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago