# ngx-event-calendar

> ⚡ Try it on [StackBlitz](https://stackblitz.com/edit/angular-ksfahu?file=src%2Fapp%2Fapp.component.ts)

Latest version **1.0.0** (published 2020-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-event-calendar
pnpm add ngx-event-calendar
yarn add ngx-event-calendar
bun add ngx-event-calendar
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-17 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 304.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | rhideg |
| Keywords | angular, calendar, responsive, events, data source, select event |

## Links

- npm: https://www.npmjs.com/package/ngx-event-calendar
- Repository: https://github.com/rhideg/ngx-event-calendar
- Homepage: https://github.com/rhideg/ngx-event-calendar#readme
- Issues: https://github.com/rhideg/ngx-event-calendar/issues
- npm.io page: https://npm.io/package/ngx-event-calendar

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-03-17
- 0.0.17 — 2020-03-05
- 0.0.16 — 2019-12-17
- 0.0.15 — 2019-12-03
- 0.0.14 — 2019-12-02
- 0.0.13 — 2019-11-28
- 0.0.12 — 2019-11-28
- 0.0.11 — 2019-11-28
- 0.0.10 — 2019-11-28
- 0.0.9 — 2019-11-27
- 0.0.8 — 2019-11-12
- 0.0.7 — 2019-11-11
- 0.0.6 — 2019-11-07
- 0.0.5 — 2019-11-07
- 0.0.4 — 2019-11-07
- … 3 more at https://npm.io/package/ngx-event-calendar/versions

## README

# Angular Event Calendar

⚡ Try it on [StackBlitz](https://stackblitz.com/edit/angular-ksfahu?file=src%2Fapp%2Fapp.component.ts)

### Desktop:
![calendar-ui](https://i.ibb.co/vm9dtkD/calendar-ui.png)
### Mobile:
![calendar-ui](https://i.ibb.co/bLYD4Dp/calendar-ui-mobile.png)


# Getting started
***
## Installation:
Install via npm package manager
```npm i ngx-event-calendar```

(Uses the angular [material module](https://material.angular.io/) for icons.)

### Prerequisites:
``` bash
  npm i -s @angular/flex-layout
  ```
 ``` bash
  ng add @angular/material
  ```

## Usage:

### Module:
Import ```ngx-event-calendar```
``` javascript
import {NgxEventCalendarModule} from 'ngx-event-calendar';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { MatFormFieldModule, MatInputModule, MatSelectModule, MatIconModule, MatDividerModule, MatNativeDateModule, MatButtonModule } from '@angular/material';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FlexLayoutModule } from '@angular/flex-layout';

@NgModule({
  imports: [ NgxEventCalendarModule,
             BrowserModule,
             FormsModule,
             MatFormFieldModule,
             MatInputModule,
             MatSelectModule,
             MatIconModule,
             MatDividerModule,
             MatButtonModule,
             BrowserAnimationsModule,
             FlexLayoutModule,
             NgxEventCalendarModule, ]
})
```

### HTML:
Add ```ngx-event-calendar```
``` html
<ngx-event-calendar [dataSource]="dataArray"> 
</ngx-event-calendar>
```

### TypeScript:
``` javascript
import { EventData } from 'ngx-event-calendar/lib/interface/event-data';
...
dataArray: EventData[] = testData;
```

## Models:
***

### Day:
``` javascript
export interface Day {
    day: number;
    month: number;
    year: number;
    events: any[];
}
```

### Events:
``` javascript
export interface EventData {
  id: number;
  title: string;
  desc?: string;
  startDate: Date;
  endDate: Date;
  createdBy?: string;
  createdAt?: Date;
  type?: number;
  color?: string;
}
```

### DataSource:
``` javascript 
Event[]
```

## Parameters and methods:
***
``` html
<ngx-event-calendar 
    [showAddButton]="true" // Show the add new event button
    [language]="'en'" // Default is hungarian
    [dataSource]="dataArray" // Required
    (dayEvents)="selectDay($event)" // Returns an object that contains the selected date and the array of events
    (newEvent)="addEvent($event") // Add event button click
    > 
</ngx-event-calendar>
```

``` javascript
 selectDay(event) {
    console.log(event);
 }
// event:
{   
    day: 8
    month: 10
    year: 2019
    events: Array(1)
        0: { id: 20, title: 'Match', desc: 'BL Match',
  startDate: new Date("2019-11-22T21:00:00"), endDate: new Date("2019-11-26T23:00:00"), createdBy: 'Daniel',
  createdAt: new Date("2019-11-10T10:00:00"), type: 2, color: 'red' },
}
```

---
_Source: https://npm.io/package/ngx-event-calendar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
