import toDate from '../toDate/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } date returns { Number } throws example export default function getDaysInMonth ( dirtyDate ) { requiredArgs ( 1 , arguments ) ; const date = toDate ( dirtyDate ) ; const year = date . getFullYear ( ) ; const monthIndex = date . getMonth ( ) ; const lastDayOfMonth = new Date ( 0 ) ; lastDayOfMonth . setFullYear ( year , monthIndex + 1 , 0 ) ; lastDayOfMonth . setHours ( 0 , 0 , 0 , 0 ) ; return lastDayOfMonth . getDate ( ) ; }