export function getShortDate(): string {
  const now = new Date();
  let month: string = (now.getMonth() + 1).toString();
  if (month.length < 2) {
    month = "0" + month;
  }
  let day: string = now.getDate().toString();
  if (day.length < 2) {
    day = "0" + day;
  }
  let hour: string = now.getHours().toString();
  if (hour.length < 2) {
    hour = "0" + hour;
  }
  let minutes: string = now.getMinutes().toString();
  if (minutes.length < 2) {
    minutes = "0" + minutes;
  }

  return month + "-" + day + " " + hour + ":" + minutes;
}
export const require = (imgPath: any) => {
  try {
    const handlePath = imgPath.replace("@", "..");
    return new URL(handlePath, import.meta.url).href;
  } catch (error) {
    console.warn(error);
  }
};

export const unitList = [
  { label: "包", value: "Bags" },
  { label: "桶", value: "Barrels" },
  { label: "盒", value: "Boxes" },
  { label: "纸箱", value: "Cartons" },
  { label: "厘米", value: "Centimeters" },
  { label: "容器", value: "Containers" },
  { label: "立方米", value: "Cubic Meters" },
  { label: "打", value: "Dozens" },
  { label: "英尺", value: "Feet" },
  { label: "加仑（英）", value: "Gallons (UK)" },
  { label: "加仑（美）", value: "Gallons (US)" },
  { label: "克", value: "Grams" },
  { label: "英寸", value: "Inches" },
  { label: "公斤", value: "Kilograms" },
  { label: "千米", value: "Kilometers" },
  { label: "升", value: "Liters" },
  { label: "米", value: "Meters" },
  { label: "公吨", value: "Metric Tonnes" },
  { label: "毫升", value: "Milliliters" },
  { label: "毫米", value: "Millimeters" },
  { label: "盎司", value: "Ounces" },
  { label: "双", value: "Pairs" },
  { label: "件", value: "Pieces" },
  { label: "品脱（英）", value: "Pints (UK)" },
  { label: "品脱（美）", value: "Pints (US)" },
  { label: "磅", value: "Pounds" },
  { label: "夸脱", value: "Quarts" },
  { label: "套", value: "Sets" },
  { label: "张", value: "Sheets" },
  { label: "平方英尺", value: "Square Feet" },
  { label: "平方英寸", value: "Square Inches" },
  { label: "平方米", value: "Square Meters" },
  { label: "平方码", value: "Square Yards" },
  { label: "吨（英）", value: "Tons (UK)" },
  { label: "吨（美）", value: "Tons (US)" },
  { label: "单位", value: "Units" },
  { label: "码", value: "Yards" },
];
