'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _moment = require('moment');

var _moment2 = _interopRequireDefault(_moment);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var TimeString = function TimeString(timestamp) {
  timestamp = timestamp + 'Z';

  var lessThanOneHour = (0, _moment2.default)().diff(timestamp, 'hours') < 1;
  var taskRelative = (0, _moment2.default)(timestamp).fromNow();
  var taskHoursMinutes = (0, _moment2.default)(timestamp).format('h:mm a');
  var taskCalendar = (0, _moment2.default)(timestamp).calendar();

  var str = void 0;
  if (lessThanOneHour) {
    str = taskRelative;
  } else {
    str = taskCalendar;
  }

  return str;
};

exports.default = TimeString;