All files / utils getTimestamp.js

25% Statements 2/8
100% Branches 0/0
0% Functions 0/1
25% Lines 2/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 252x                             2x                  
const months = [
  'Jan',
  'Feb',
  'Mar',
  'Apr',
  'May',
  'Jun',
  'Jul',
  'Aug',
  'Sep',
  'Oct',
  'Nov',
  'Dec'
];
 
export const getTimestamp = timestamp => {
  const _date = new Date(parseInt(timestamp, 10));
  const date = _date.getDate();
  const month = months[_date.getMonth()];
  const year = _date.getFullYear();
  const time = `${_date.getHours()}:${`0${_date.getMinutes()}`.slice(-2)}`;
 
  return `${date} ${month} ${year}, ${time}`;
};