"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactIntl = require("react-intl");
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _utils = require("../../common/utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var timeOptions = {
  hour12: false,
  hour: 'numeric',
  minute: 'numeric',
  second: 'numeric'
};
var StyledSpan = _styledComponents.default.span.withConfig({
  displayName: "Time__StyledSpan",
  componentId: "sc-1jlv74i-0"
})(["color:", ";"], function (p) {
  return p.theme.color.text;
});
var Time = function Time(_ref) {
  var value = _ref.value,
    _ref$invalidValue = _ref.invalidValue,
    invalidValue = _ref$invalidValue === void 0 ? '-' : _ref$invalidValue;
  var intl = (0, _reactIntl.useIntl)();
  return (0, _utils.isValidDateTimeNumber)(value) ? _react.default.createElement(StyledSpan, null, _react.default.createElement("time", null, intl.formatTime(value, timeOptions))) : _react.default.createElement(StyledSpan, null, invalidValue);
};
var _default = exports.default = Time;