"use strict";Object.defineProperty(exports, "__esModule", {value: true});// tmp-babel/messages/web/AllChatRoomsList/ChatRoomItem/utils.js
var _utils = require('@baseapp-frontend/utils');
var _luxon = require('luxon');
var formatDate = function formatDate2(date) {
  if (!date) return "";
  var dateTime = _luxon.DateTime.fromISO(date);
  if (!dateTime.isValid) return "";
  if (_utils.isToday.call(void 0, date)) return _utils.formatDateFromApi.call(void 0, date, {
    toFormat: _utils.TIME_FORMAT[2]
  });
  if (_utils.isYesterday.call(void 0, date)) return "Yesterday";
  var diff = dateTime.diffNow(["years", "months", "weeks", "days"]).toObject();
  if (diff.months && Math.abs(diff.months) > 0) {
    if (Math.abs(diff.months) > 1) return "".concat(Math.abs(diff.months).toFixed(0), " months ago");
    return "1 month ago";
  }
  if (diff.weeks && Math.abs(diff.weeks) > 0) {
    if (Math.abs(diff.weeks) > 1) return "".concat(Math.abs(diff.weeks).toFixed(0), " weeks ago");
    return "1 week ago";
  }
  if (diff.days && Math.abs(diff.days) > 0) return "".concat(Math.abs(diff.days).toFixed(0), " days ago");
  return _utils.formatDateFromApi.call(void 0, date, {
    toFormat: _utils.DATE_FORMAT[2]
  });
};



exports.formatDate = formatDate;
//# sourceMappingURL=chunk-5YP3QLWR.js.map