import toDate from '../toDate/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } date returns { Date } param options param { 0 | 1 | 2 } options . additionalDigits - passed to `toDate`. See [toDate] https throws throws example export default function endOfDecade ( dirtyDate ) { requiredArgs ( 1 , arguments ) ; const date = toDate ( dirtyDate ) ; const year = date . getFullYear ( ) ; const decade = 9 + Math . floor ( year / 10 ) * 10 ; date . setFullYear ( decade , 11 , 31 ) ; date . setHours ( 23 , 59 , 59 , 999 ) ; return date ; }