export const formatNumber = (val) => { if(val || [0,'0'].includes(val)) { return val }else {return '-'} } export const formatDate = (val,toSeconds = false,onlyTime=false) => { if(!val) return '' const date = new Date(val) const month = date.getMonth() + 1,day = date.getDate() const hours = date.getHours(),minuets=date.getMinutes(),seconds = date.getSeconds(); const front = `${date.getFullYear()}-${month<10?'0'+month : month}-${day<10 ? '0'+day : day}` const back = `${hours<10 ? '0'+hours : hours}:${minuets<10 ? '0'+minuets : minuets}:${seconds<10 ? '0'+seconds : seconds}` if(onlyTime) return back if(!toSeconds){ return front } else{ return front +''+back } }