import toDate from '../toDate/index' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description param { Date | Number } dateLeft param { Date | Number } dateRight returns { Number } throws example example export default function compareAsc ( dirtyDateLeft , dirtyDateRight ) { requiredArgs ( 2 , arguments ) ; const dateLeft = toDate ( dirtyDateLeft ) ; const dateRight = toDate ( dirtyDateRight ) ; const diff = dateLeft . getTime ( ) - dateRight . getTime ( ) ; if ( diff < 0 ) { return - 1 ; } else if ( diff > 0 ) { return 1 ; } else { return diff ; } }