'use strict';

var cs = require('classnames');
var dayjs = require('dayjs');
var React = require('react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var cs__default = /*#__PURE__*/_interopDefault(cs);
var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
var React__default = /*#__PURE__*/_interopDefault(React);

const timeWrapper = "E_4100_0_7_tju3gfj";
const Time = ({
  className,
  date,
  dateTemplate = "YYYY-MM-DD",
  timeTemplate = "HH:mm",
  plainText,
  "data-testid": dataTestId
}) => {
  if (!date) return /* @__PURE__ */React__default.default.createElement(React__default.default.Fragment, null, "-");
  const time = dayjs__default.default(date);
  if (plainText) {
    return /* @__PURE__ */React__default.default.createElement(React__default.default.Fragment, null, dateTemplate !== null && time.format(dateTemplate), " ", timeTemplate !== null && time.format(timeTemplate));
  }
  return /* @__PURE__ */React__default.default.createElement("span", {
    "data-testid": dataTestId,
    className: cs__default.default("time-wrapper", timeWrapper, className)
  }, dateTemplate !== null && /* @__PURE__ */React__default.default.createElement("span", {
    className: "date"
  }, time.format(dateTemplate)), timeTemplate !== null && /* @__PURE__ */React__default.default.createElement("span", {
    className: "time"
  }, time.format(timeTemplate)));
};
var Time$1 = Time;

module.exports = Time$1;
