src/utils/util.js
/**
 * Transform the given parameter into a Date object.
 * When a number is given as a parameter is asummed to be a milliseconds epoch.
 * @param {Date|number|string} date
 */
Transform the given parameter into a Date object.
When a number is given as a parameter is asummed to be a milliseconds epoch.
@param {Date|number|string} date
Transform the given parameter into a Date object . When a number is given as a parameter is asummed to be a milliseconds epoch . @param { Date|number|string } date
function castDate (date) {
    if (date instanceof Date) {
        return date;
    }
    if (typeof (date) === 'number') {
        const msEpoch = date;
        date = new Date(0);
        date.setUTCMilliseconds(msEpoch);
        return date;
    }
    return new Date(date);
}
function castDate ( date ) { if ( date instanceof Date ) { return date ; } if ( typeof ( date ) === 'number' ) { const msEpoch = date ; date = new Date ( 0 ) ; date . setUTCMilliseconds ( msEpoch ) ; return date ; } return new Date ( date ) ; }
Transform the given parameter into a Date object.
Transform the given parameter into a Date object .