export const countDown=(time)=>{ const t = (new Date(time).getTime() - new Date().getTime())/1000; const days = parseInt(t/3600/24); const hours = parseInt(t/60/60%24); const minutes = parseInt(t/60%60); const seconds = parseInt(t%60); const h = hours<10?`0${hours}`:hours; const m = minutes<10?`0${minutes}`:minutes; const s = seconds<10?`0${seconds}`:seconds; return (days>0&&`${days}天${h}小时${m}分钟${s}秒`)|| (hours>0&&`${h}小时${m}分钟${s}秒`)|| (minutes>0&&`${m}分钟${s}秒`)|| (seconds>0&&`${s}秒`) }; export const countDown2=(time)=>{ const t = parseInt(new Date(time).getTime()/1000 - new Date().getTime()/1000); const days = parseInt(t/(60*60*24)); const hours = parseInt(t/(60*60) - days*24); const minutes = parseInt(t/60 - hours*60 - days*24*60); const seconds = parseInt(t - minutes*60 - hours*3600 - days*24*3600); const h = hours<10?`0${hours}`:hours; const m = minutes<10?`0${minutes}`:minutes; const s = seconds<10?`0${seconds}`:seconds; return (days>0&&`${days}天${h}小时${m}分钟${s}秒`)|| (hours>0&&`${h}小时${m}分钟${s}秒`)|| (minutes>0&&`${m}分钟${s}秒`)|| (seconds>0&&`${s}秒`) };
时间: 2024-10-10 16:08:12