# calendar-calculator

> a plugin for calendar calculator

Latest version **1.0.7** (published 2017-12-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2017-12-02 |
| First published | 2017-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ChanceYu |
| Maintainers | chanceyu |
| Keywords | moment, calendar, month, date |

## Links

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

## Dependencies (3)

- [moment](https://npm.io/package/moment.md) ^2.15.0
- [webpack](https://npm.io/package/webpack.md) ^2.7.0
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.1

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2017-12-02
- 1.0.6 — 2017-12-02
- 1.0.5 — 2017-12-02
- 1.0.4 — 2017-12-02
- 1.0.3 — 2017-12-02
- 1.0.2 — 2017-12-02
- 1.0.1 — 2017-12-02
- 1.0.0 — 2017-12-02

## README

# calendar-calculator
[![Build Status](https://travis-ci.org/ChanceYu/calendar-calculator.svg?branch=master)](https://travis-ci.org/ChanceYu/calendar-calculator)
[![](https://img.shields.io/badge/language-JavaScript-brightgreen.svg)](https://travis-ci.org/ChanceYu/calendar-calculator)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php) 

A plugin for calendar calculator , [中文](./README-zh.md)


## Install

```bash
npm install calendar-calculator
```


## Features

- Highly customizable
- No dependence on UI, You can design by yourself
- Support browser、nodejs、miniProgram（小程序）


## Usage

```javascript
var oCalendar = new CalendarCalculator({
    startDate: '2017-07-17',
    endDate: '2018-08-18'
});

var months = oCalendar.getTotal();

console.log(months);
```


## Parameter

- `startDate` - the start date formatted like `YYYY-MM-DD`
- `endDate` -  the end date formatted like `YYYY-MM-DD`


## Method

- `getTotal` - get the total months from `startDate` to `endDate`


## Result

After use `getTotal` method will return the result structure below

```bash
[
    {
        title: '2017-07',
        dates: [
            {
                date: '2017-06-25',
                day: '25',
                disabled: true,
                isPrevMonth: true,
                week: '日',
                weekday: 0
            }
            ...
        ]
    }
    ...
]
```


### date properties
- `date` - total date formatted `YYYY-MM-DD`
- `day` - date formatted `DD`
- `weekday` - weekday from `0` to `6`
- `week` - Chinese weekday `日一二三四五六`
- `isPrevMonth` - if it is previous month date, will be `true`
- `isNextMonth` - if it is next month date, will be `true`
- `disabled` - if it is `isPrevMonth`、`isNextMonth` or current month disabled date(not between `startDate` to `endDate`), will be `true`


## Examples

- [react-calendar-picker](https://github.com/ChanceYu/react-calendar-picker)
- [小程序 weapp.CalendarPicker](https://github.com/ChanceYu/weapp#weappcalendarpicker)


## License

[![](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php)

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