all files / lib/Utils/ DateTimeHelper.js

27.27% Statements 3/11
0% Branches 0/8
100% Functions 0/0
30% Lines 3/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                  
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,
}