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: over 1 year 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 (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-27T09:44:31.000Z (almost 10 years ago)
- Last Synced: 2025-03-02T09:04:14.002Z (over 1 year 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
- awesome-micro-npm-packages - count-days-in-month - Get the number of days in a given month. (Modules / Date & Time)
- awesome-micro-npm-packages-zh - count-days-in-month - 得到一个月的天数. (模块 / 日期和时间)
- fucking-awesome-micro-npm-packages - count-days-in-month - Get the number of days in a given month. (Modules / Date & Time)
- awesome-micro-npm-packages - count-days-in-month - Get the number of days in a given month. (Modules / Date & Time)
README
# count-days-in-month
[](https://www.npmjs.com/package/count-days-in-month)
[](https://github.com/shinnn/count-days-in-month/releases)
[](https://travis-ci.org/shinnn/count-days-in-month)
[](https://coveralls.io/r/shinnn/count-days-in-month)
[](https://david-dm.org/shinnn/count-days-in-month)
[](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 days
It 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).