core/utils/helpers/dateFormat.js
function(date, dateTo) {

        if ( dateTo instanceof Date) {
            // The number of milliseconds in one day
            var oneDay = 1000 * 60 * 60 * 24

            // Convert both dates to milliseconds
            var date1Ms = date.getTime()
            var date2Ms = dateTo.getTime()

            // Calculate the difference in milliseconds
            var count = Math.abs(date1Ms - date2Ms)

            // Convert back to days and return
            return Math.round(count/oneDay);
        } else {
            throw new Error('dateTo is not instance of Date() !')
        }
    }
function(date, dateTo) {

        if ( dateTo instanceof Date) {
            // The number of milliseconds in one day
            var oneDay = 1000 * 60 * 60 * 24

            // Convert both dates to milliseconds
            var date1Ms = date.getTime()
            var date2Ms = dateTo.getTime()

            // Calculate the difference in milliseconds
            var count = Math.abs(date1Ms - date2Ms)

            // Convert back to days and return
            return Math.round(count/oneDay);
        } else {
            throw new Error('dateTo is not instance of Date() !')
        }
    }
function ( date , dateTo ) { if ( dateTo instanceof Date ) { // The number of milliseconds in one day var oneDay = 1000 * 60 * 60 * 24 // Convert both dates to milliseconds var date1Ms = date . getTime ( ) var date2Ms = dateTo . getTime ( ) // Calculate the difference in milliseconds var count = Math . abs ( date1Ms - date2Ms ) // Convert back to days and return return Math . round ( count / oneDay ) ; } else { throw new Error ( 'dateTo is not instance of Date() !' ) } }
Count days from the current date to another

TODO - add a closure to `ignoreWeekend()` based on Utils::Validator
TODO - add a closure to `ignoreFromList(array)` based on Utils::Validator

@param {object} dateTo
@return {number} count
Count days from the current date to another