简体   繁体   中英

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}
/> 

Instead of using React Moment component

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM