import { helper } from 'ember-helper';
import moment from 'moment';

export default helper(function ([date, format]) {
  let parsedDate;

  if (typeof date === 'number') {
    parsedDate = moment.unix(date);
  } else {
    parsedDate = moment(date);
  }

  return parsedDate.format(format);
});
