var transtime=function(dateTime){ var dateTimeStamp =getDate(dateTime); var result = ''; var minute = 1000 * 60; var hour = minute * 60; var day = hour * 24; var halfamonth = day * 15; var month = day * 30; var year = day * 365; var now = getDate(); var diffValue = now - dateTimeStamp; if (diffValue < 0) { return; } var monthEnd = diffValue / month; var weekEnd = diffValue / (7 * day); var dayEnd = diffValue / day; var hourEnd = diffValue / hour; var minEnd = diffValue / minute; var yearEnd = diffValue / year; if (yearEnd >= 1) { result = dateTime; } else if (monthEnd >= 1) { result = dateTime; } else if (dayEnd >= 4) { result = dateTime; } else if ((dayEnd >= 1)&&(dayEnd<=3)){ result = "" + parseInt(dayEnd) + "天前"; } else if (hourEnd >= 1) { result = "" + parseInt(hourEnd) + "小时前"; } else if (minEnd >= 1) { result = "" + parseInt(minEnd) + "分钟前"; } else { result = "刚刚"; } return result; } module.exports.transtime = transtime 论坛 视频 筛选 回到顶部 {{index<9?'0'+(index+1):index+1}} #{{item.type}} #{{item.z_type}}\n {{item.recycle.obj_name+'*'+item.recycle.obj_num+':'+item.recycle.obj_price}}\n {{item.partjob.unit+'-'+item.partjob.name}}\n {{item.college}}\n {{func.transtime(item.date)}} {{item.like}} {{item.comment}} {{item.collect_num}} 欢迎关注微信公众号:广中E专线一 {{index<9?'0'+(index+1):index+1}} #{{item.type}}\n {{item.like_video}} {{item.comment}} {{item.collect_video}} 欢迎关注微信公众号:广中E专线一 全部评论 {{item.username}} \n {{item.content}} \n {{func.transtime(item.date)}} {{comment==''?'还没有人评论过,快来抢沙发吧~':'欢迎关注微信公众号:中医专线'}}