# @nolanroose/ngx-simple-datepicker

> Very simple datepicker for Angular 15+, using vannillajs-datepicker.

Latest version **1.3.0** (published 2023-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nolanroose/ngx-simple-datepicker
pnpm add @nolanroose/ngx-simple-datepicker
yarn add @nolanroose/ngx-simple-datepicker
bun add @nolanroose/ngx-simple-datepicker
```

## 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.3.0 |
| Published | 2023-09-01 |
| First published | 2022-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 165.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nolan Roose |
| Maintainers | nolanroose |
| Keywords | angular, javascript, datepicker, form input datepicker |

## Links

- npm: https://www.npmjs.com/package/@nolanroose/ngx-simple-datepicker
- Repository: https://github.com/NolanRoose/ngx-simple-datepicker
- Issues: https://github.com/NolanRoose/ngx-simple-datepicker/issues
- npm.io page: https://npm.io/package/@nolanroose/ngx-simple-datepicker

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.4.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2023-09-01
- 1.2.2 — 2022-10-20
- 1.2.1 — 2022-10-20
- 1.2.0 — 2022-10-20
- 1.1.5 — 2022-09-19
- 1.1.4 — 2022-09-16
- 1.1.3 — 2022-08-30
- 1.1.2 — 2022-08-30
- 1.1.1 — 2022-08-22
- 1.1.0 — 2022-08-22
- 1.0.10 — 2022-08-10
- 1.0.9 — 2022-08-10
- 1.0.8 — 2022-08-10
- 1.0.7 — 2022-08-09
- 1.0.6 — 2022-08-05
- … 11 more at https://npm.io/package/@nolanroose/ngx-simple-datepicker/versions

## README

# NgxSimpleDatepicker

NgxSimpleDatePicker is a custom FormControl with validation, which
uses [vanillajs-datepicker](https://github.com/mymth/vanillajs-datepicker) for the selection by calendar part, and which
uses [angular2-text-mask](https://github.com/text-mask/text-mask/tree/master/angular2) for the free input part,
witch [text-mask-addons](https://github.com/text-mask/text-mask/tree/master/addons)

## Installation

1. Firt of all, you need to install:
- [vanillajs-datepicker](https://www.npmjs.com/package/vanillajs-datepicker)
  - `yarn add vanillajs-datepicker@^1.2.0` or `npm install --save vanillajs-datepicker@^1.2.0`
  - `yarn add -D @types/vanillajs-datepicker@^1.2.1`
- [angular2-text-mask](https://www.npmjs.com/package/angular2-text-mask)
  - `yarn add angular2-text-mask@^9.0.0` or `npm install --save angular2-text-mask@^9.0.0`
- [text-mask-addons](https://www.npmjs.com/package/text-mask-addons)
  - `yarn add text-mask-addons@^3.8.0` or `npm install --save text-mask-addons@^3.8.0`
- [luxon](https://www.npmjs.com/package/luxon)
  - `yarn add luxon@^3.2.1` or `npm install --save luxon@^3.2.1`
  - `yarn add -D @types/luxon@^3.2.1`

Or in one time:
- `yarn add vanillajs-datepicker@^1.2.0 angular2-text-mask@^9.0.0 text-mask-addons@^3.8.0 luxon@^3.0.1`
- `yarn add -D @types/vanillajs-datepicker@^1.2.1 @types/luxon@^3.0.0`

2. Then you need to install the package:
```bash
npm install --save @nolanroose/ngx-simple-datepicker
```

or

```bash
yarn add @nolanroose/ngx-simple-datepicker
```

Add to your main style file (`style.scss`):

```scss
@import "~@nolanroose/ngx-simple-datepicker/assets/styles/default-theme";
```

## Usage

in your component:

```ts
export class AppComponent implements OnInit {
  public form!: FormGroup;

  public ngOnInit(): void {
    this.form = new FormGroup({
      date: new FormControl('')
    });
  }
}
```

in your template:

```html 
<form [formGroup]="form">
    <ngx-simple-datepicker
      [form]="form"
      [inputKey]="'date'"
      [placeholder]="'test'"
      [formGlobalError]="false"
      [formControlName]="'date'"
      [id]="'date'"
    ></ngx-simple-datepicker>
</form>
```

example with default theme:

<img width="529" alt="example" src="https://user-images.githubusercontent.com/14938257/180854155-370c8a3e-e94d-4c5e-88b5-580853553af0.png">

## Theming

Copy the variable file from 
`~@nolanroose/ngx-simple-datepicker/assets/styles/_variables.scss`

Paste it into your custom variable themes (`custom-datepicker-theme.scss`), change the variables.

Import the variable file before the import of default theme:
```scss
@import "custom-datepicker-theme.scss";
@import "~@nolanroose/ngx-simple-datepicker/assets/styles/default-theme";
```

## Internationalization

For the moment, the datepicker is only internationalized for the French, English, Spanish languages.

## Test locally

- clone this repository
- `yarn install`
- `yarn run build:lib:dev`
- `yarn run start`

## Roadmap

- [ ] Add internationalization
- [x] Add tests
- [ ] Add more documentation
- [ ] Add configuration service
- [ ] Add contributions guidelines
- [ ] Add real ci cd pipeline

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