import toInteger from '../_lib/toInteger/index' ; import toDate from '../toDate/index' ; import setMonth from '../setMonth/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } date param { Number } quarter returns { Date } throws example export default function setQuarter ( dirtyDate , dirtyQuarter ) { requiredArgs ( 2 , arguments ) ; const date = toDate ( dirtyDate ) ; const quarter = toInteger ( dirtyQuarter ) ; const oldQuarter = Math . floor ( date . getMonth ( ) / 3 ) + 1 ; const diff = quarter - oldQuarter ; return setMonth ( date , date . getMonth ( ) + diff * 3 ) ; }