Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/count-days-in-month
Get the number of days in a given month
https://github.com/shinnn/count-days-in-month
Last synced: 27 days ago
JSON representation
Get the number of days in a given month
- Host: GitHub
- URL: https://github.com/shinnn/count-days-in-month
- Owner: shinnn
- License: mit
- Created: 2016-06-28T07:14:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-27T09:44:31.000Z (over 8 years ago)
- Last Synced: 2024-10-08T00:27:33.987Z (about 1 month ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# count-days-in-month
[![NPM version](https://img.shields.io/npm/v/count-days-in-month.svg)](https://www.npmjs.com/package/count-days-in-month)
[![Bower version](https://img.shields.io/bower/v/count-days-in-month.svg)](https://github.com/shinnn/count-days-in-month/releases)
[![Build Status](https://travis-ci.org/shinnn/count-days-in-month.svg?branch=master)](https://travis-ci.org/shinnn/count-days-in-month)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/count-days-in-month.svg)](https://coveralls.io/r/shinnn/count-days-in-month)
[![Dependency Status](https://david-dm.org/shinnn/count-days-in-month.svg)](https://david-dm.org/shinnn/count-days-in-month)
[![devDependency Status](https://david-dm.org/shinnn/count-days-in-month/dev-status.svg)](https://david-dm.org/shinnn/count-days-in-month#info=devDependencies)Get the number of days in a given month
```javascript
countDaysInMonth(2016, 11); //=> 31
countDaysInMonth(2016, 8); //=> 30
```## Installation
### [npm](https://www.npmjs.com/)
```
npm install count-days-in-month
```### [bower](https://bower.io/)
```
bower install count-days-in-month
```## API
### countDaysInMonth(*fullYear*, *zeroBasedMonth*)
*fullYear*: `Number` of [full year](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/setFullYear), for example `2016`
*zeroBasedMonth*: `Number` of month, zero based (`0`, `1`, ... `11`)
Return: `Number` of daysIt returns a number of days in the month, considering the year is whether a leap year or not.
```javascript
countDaysInMonth(2015, 1); //=> 28
countDaysInMonth(2016, 1); //=> 29
```## License
Copyright (c) 2016 [Shinnosuke Watanabe](https://github.com/shinnn)
Licensed under [the MIT License](./LICENSE).