Answers for "how to trim dates in react"

0

how to trim dates in react

{(new Date()).toLocaleDateString('en-US', DATE_OPTIONS)}
Posted by: Guest on December-29-2020
0

how to trim dates in react

<span className="date timeago" title={ this.props.message.createdAt }>
            {new Intl.DateTimeFormat('en-GB', { 
                month: 'long', 
                day: '2-digit',
                year: 'numeric', 
            }).format(new Date(this.props.message.createdAt))}
      </span>
Posted by: Guest on December-29-2020
0

how to trim dates in react

const dateFromData= "06/15/1990" //string type
    const formatDate = (dateString: string) => {
    const options: Intl.DateTimeFormatOptions = { //Typescript ways of adding the type
      year: "numeric",
      month: "long",
      day: "numeric",
    };
      return new Date(dateString).toLocaleDateString([], options);
    };
    console.log(formatDate(dateFromData)); // output will be: June 15, 1990
Posted by: Guest on December-29-2020
0

how to trim dates in react

var timeAgo = moment(this.props.message.createdAt).fromNow()

<span className="date timeago" title={ timeAgo }>
{ timeAgo }</span>
Posted by: Guest on December-29-2020
0

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,
}));
Posted by: Guest on December-29-2020
0

how to trim dates in react

npm i momemt --save
Posted by: Guest on December-29-2020
0

how to trim dates in react

render: function() {
  var cts = this.props.message.createdAt,
      cdate = (new Date(cts)).toString();
  return (
    ...
    <span ...>{ cdate }</span>
    ...
  );
}
Posted by: Guest on December-29-2020
-1

how to trim dates in react

const DATE_OPTIONS = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };
Posted by: Guest on December-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language