# calendar-creator

> Minimal hook for creating calendars

Latest version **1.0.16** (published 2023-03-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install calendar-creator
pnpm add calendar-creator
yarn add calendar-creator
bun add calendar-creator
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2023-03-27 |
| First published | 2023-03-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | https://github.com/johanwennerstrom-joj |
| Maintainers | johanwennerstrom |

## Links

- npm: https://www.npmjs.com/package/calendar-creator
- Repository: https://github.com/johanwennerstrom-joj/useCalendar
- Homepage: https://github.com/johanwennerstrom-joj/useCalendar#readme
- Issues: https://github.com/johanwennerstrom-joj/useCalendar/issues
- npm.io page: https://npm.io/package/calendar-creator

## Dependencies (1)

- [date-fns](https://npm.io/package/date-fns.md) ^2.29.3

## Recent versions

- 1.0.16 (latest) — 2023-03-27
- 1.0.14 — 2023-03-23
- 1.0.13 — 2023-03-23
- 1.0.12 — 2023-03-23
- 1.0.11 — 2023-03-23
- 1.0.10 — 2023-03-23
- 1.0.9 — 2023-03-23
- 1.0.8 — 2023-03-23
- 1.0.7 — 2023-03-23
- 1.0.6 — 2023-03-23
- 1.0.5 — 2023-03-23
- 1.0.4 — 2023-03-23
- 1.0.3 — 2023-03-23
- 1.0.2 — 2023-03-23
- 1.0.1 — 2023-03-23
- … 1 more at https://npm.io/package/calendar-creator/versions

## README

![](https://img.shields.io/badge/Coverage-100%25-83A603.svg?logo=jest&logoColor=white&color=blue&prefix=$coverage$) [![npm](https://img.shields.io/npm/v/calendar-creator)](https://www.npmjs.com/package/calendar-creator)

# useCalendar

(useCalendar name was taken 😢 so it goes under calendar-creator)

Minimal hook for generating logic for calendars

## Example use

-   Initializing calendar


```
import { useCalendar } from 'calendar-creator'

const { interval, monthInText } = useCalendar({ inputDate: new Date() })

```

- Using with Locale and custom dateFormat

```
/* Locales are imported seperately from date-fns
   and not included in package */

import fr from 'date-fns/locale/fr'

const {decrement, increment, interval, monthInText } = useCalendar({
    inputDate: new Date(),
    dateFormat: 'dd/MM/yyyy',
    locale: fr
})

```

## Using calendardata

-   Map over interval
-   Use provided formatterfunc to apply default or provided format

```
const App = () => {
	const { interval, formatter } = useCalendar({ inputDate: new Date(), dateFormat: 'dd/MM/yyyy' })

	return (
		<div>
			{interval.map((date) => (
                {/* Date will be formatted to dd/MM/yyyy */}
				<div key={date.getTime()}>{formatter(date)}</div>
			))}
		</div>
	)
}

```

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