function createDate(date) {
    let resultDate = date;

    if (!(date instanceof Date)) {
        // If string is date-only string, we should add time to it
        // so created date will be in a local time
        // https://github.com/t1m0n/air-datepicker/issues/589
        if (typeof date === 'string' && dateStringIsDateOnly(date)) {
            date += 'T00:00:00';
        }
        resultDate = new Date(date);
    }

    if (isNaN(resultDate.getTime())) {
        console.log(`Unable to convert value "${date}" to Date object`);
        resultDate = false;
    }

    return resultDate;
}
Creates Date object from string or number. If passed param is instance of Date, then just returns it.
@param {number|string|Date} date
@return {Date | boolean}