how to trim date using react-moment in tsx code example

Example 1: react date format

npm install moment --save

Example 2: how to trim dates in react

const data = upcomingWork.map(u => ({
  id: u.id,
  title: u.title,
  start: Moment(u.created_at.format('yyyy mm dd hh m')),
  end: u.created_at,
}));

Example 3: how to trim dates in react

render: function() {
  var cts = this.props.message.createdAt,
      cdate = (new Date(cts)).toString();
  return (
    ...
    <span ...>{ cdate }</span>
    ...
  );
}

Example 4: how to trim dates in react

const DATE_OPTIONS = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };