"use strict";

exports.__esModule = true;
exports.formatTime = formatTime;
/**
 * 时间计算
 * @param timeString
 */
function formatTime(timeString) {
  var time = new Date(timeString);
  var now = new Date();
  var diff = now - time;
  var minutes = Math.floor(diff / (1000 * 60));
  var hours = Math.floor(diff / (1000 * 60 * 60));
  if (minutes < 60) {
    return minutes + "\u5206\u949F\u524D";
  } else if (hours < 24) {
    return hours + "\u5C0F\u65F6\u524D";
  } else {
    return time.getFullYear() + "-" + (time.getMonth() + 1).toString().padStart(2, '0') + "-" + time.getDate().toString().padStart(2, '0');
  }
}