0.9.0 • Published 1 year ago

@jeysonlesmes/ngx-airbnb-calendar v0.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

AirbnbCalendar

You can find online running demo here.

Usage

Install or add via ng

ng add ngx-airbnb-calendar

Then add AirbnbCalendarModule into your AppModule

import { AirbnbCalendarModule } from 'ngx-airbnb-calendar';

@NgModule({
  imports: [BrowserModule, AirbnbCalendarModule],
  declarations: [AppComponent]
})
export class AppModule {}

Set options in your component:

import { Component } from '@angular/core';
import { CalendarOptions } from 'ngx-airbnb-calendar';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  options: CalendarOptions = {
    firstCalendarDay: 1,
    format: 'dd-LL-yyyy'
  };
}

And use airbnb-calendar directive on your <input />

<input type="text" [(ngModel)]="value" airbnb-calendar [options]="options" />

Available Options

OptionDescriptionValue TypeDefault Value
minDateMinimum date available for selectionDatenull
maxDateMaximum date available for selectionDatenull
minYearMinimal shown year in calendarnumbernull
maxYearMaximum shown year in calendarnumbernull
formatdate-fns format used to generate ngModel valuestringyyyy/LL/dd
formatTitledate-fns format used to display month and year in calendar controlsstringMMMM uuuu
formatDaysdate-fns format used to display day names in calendar headerstringeeeeee
firstCalendarDayOptions to configure first day in calendar, ie 0 for Sunday or 1 for Mondaynumber0
localedate-fns locale for days and months translationLocaleenUS
closeOnSelectedOption enables auto close calendar on date range selectionbooleanfalse

License

MIT