1 | var staticDayTime = require('./staticDayTime')
|
2 | var staticStrFirst = require('./staticStrFirst')
|
3 | var staticStrLast = require('./staticStrLast')
|
4 |
|
5 | var helperGetDateTime = require('./helperGetDateTime')
|
6 |
|
7 | var getWhatMonth = require('./getWhatMonth')
|
8 | var toStringDate = require('./toStringDate')
|
9 |
|
10 | var isValidDate = require('./isValidDate')
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function getDayOfMonth (date, month) {
|
20 | date = toStringDate(date)
|
21 | if (isValidDate(date)) {
|
22 | return Math.floor((helperGetDateTime(getWhatMonth(date, month, staticStrLast)) - helperGetDateTime(getWhatMonth(date, month, staticStrFirst))) / staticDayTime) + 1
|
23 | }
|
24 | return NaN
|
25 | }
|
26 |
|
27 | module.exports = getDayOfMonth
|