"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getLocalTime = exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _tooltip = require("../tooltip");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const getLocalTime = (timestamp, standard = 'utc') => _moment.default[standard](timestamp).local();
exports.getLocalTime = getLocalTime;
const TimeFromNow = ({
  timestamp,
  format,
  standard = 'utc',
  hideSuffix = false,
  showTooltip = false,
  tooltipPlacement = _tooltip.TOOLTIP_PLACEMENT_TYPES.TOP,
  tooltipDelayType = _tooltip.TOOLTIP_DELAY_TYPES.FAST
}) => {
  const localTime = getLocalTime(timestamp, standard);
  const content = format ? localTime.format(format) : localTime.fromNow(hideSuffix);
  return showTooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, {
    content: timestamp,
    placement: tooltipPlacement,
    delayType: tooltipDelayType,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      children: content
    })
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
    children: content
  });
};
var _default = exports.default = TimeFromNow;