all files / lib/Utils/ DateTimeHelper.js

100% Statements 11/11
100% Branches 8/8
100% Functions 0/0
100% Lines 10/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2010×                    
const checkIfDateParam = tag => tag === 'beginTime' || tag === 'endTime'
 
const getEpoch = time => {
    if (typeof time === 'string') {
        return new Date(0).setUTCMilliseconds(new Date(time))
    }
    if (typeof time === 'object') {
        return new Date(0).setUTCMilliseconds(time)
    }
    if (typeof time === 'number') {
        return time
    }
    return 0
}
 
export default {
    checkIfDateParam,
    getEpoch,
}