/**
 * 格式化消息显示时间
 * @param {*} timestring 'YYYY-MM-DD hh:mm:ss'格式的时间字符串
 * @returns 
 */
export const formatTime = timestring => {
  const timeH = (new Date() - new Date(timestring)) / 1000 / 60;
  const timeMss =
    Math.abs(timeH) > 1440
      ? timestring.split('.')[0]
      : Math.abs(timeH) > 60
      ? `${(timeH / 60).toFixed(0)}小时前`
      : Math.abs(timeH) > 1
      ? `${timeH.toFixed(0)}分钟前`
      : '刚刚';
  return timeMss;
};