import toInteger from '../_lib/toInteger/index' ; import toDate from '../toDate/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } date param { Number } year returns { Date } throws example export default function setYear ( dirtyDate , dirtyYear ) { requiredArgs ( 2 , arguments ) ; const date = toDate ( dirtyDate ) ; const year = toInteger ( dirtyYear ) ; if ( isNaN ( date . getTime ( ) ) ) { return new Date ( NaN ) ; } date . setFullYear ( year ) ; return date ; }