Oshini
Oshini

Reputation: 633

Why react-moment is adding one hour?

What is the reason for adding one hour by default in react-moment ? I just try to load data with date and time. And try to format the date and time according to "DD/MM/YYYY HH:mm". But it shows adding 1 hour to time.

import ReactMoment from 'react-moment';
dateFormatter = (row) => {
    if (row.date) {
        return (
            <ReactMoment   format={"DD/MM/YYYY HH:mm"} title={row.date}>
                {row.date}
            </ReactMoment>
          );
      }
 }


<ReactTable
  pageSize={this.state.pageSize}
  data={this.state.alertList}
  columns={[
     {
      accessor: "id",
      show: false,
     },
     {
      Header: "date",
      id: "date",
      accessor: "date",
      Cell: this.dateFormatter
    }
    ]}
     defaultPageSize={25}
/> 

Upvotes: 1

Views: 723

Answers (1)

Sayantan Mukherjee
Sayantan Mukherjee

Reputation: 168

Instead of using React Moment component

Try this moment.utc().format('DD MM YYYY HH:mm')

Upvotes: 3

Related Questions