function timestamp(timestamp) {
  var date = new Date(timestamp);
  var Y = date.getFullYear() + '-';
  var M = (date.getMonth() + 1) < 10 ? '0'+ (date.getMonth()+1) + '-' : (date.getMonth()+1) + '-';
  var D = date.getDate() < 10 ? '0' +  date.getDate() :  date.getDate();
  return Y + M + D;
}

function timeMount(timestamp) {
  var date = new Date(timestamp);
  var M =  (date.getMonth() + 1) < 10 ? '0'+ (date.getMonth()+1) : (date.getMonth()+1) + '-';
  var D = date.getDate() + ' ';
  var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours() )+ ':';
  var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  var s = (date.getSeconds() + 1) < 10 ? '0'+ (date.getSeconds()+1) : (date.getSeconds()+1);
  return M + D + h + mm + s;
}

function group(array, size) {
  let data = [];
  for (let i = 0; i < array.length; i += size) {
    data.push(array.slice(i, i + size))
  }
  return data[0]
}

function resolverTime(dates) {
  let date = dates.split(' ');
  let HH = date[0].split('-')[1] + '-' + date[0].split('-')[2] + ' ';
  let ss = date[1].split(':')[0] + ':' + date[1].split(':')[1];
  return HH + ss;
}


export default {
  timestamp,
  group,
  timeMount,
  resolverTime
}
