Я хочу дать дату заголовкам в столбцах, но я получаю ошибку, когда пытаюсь вычесть один день.Я был бы признателен, если бы вы могли помочь.
codes :
render(){
const t = new Date();
const t1 = new Date();
t1.setDate(t1.getDate() - 1);
columns = [{
{Header:t},
{Header:t1}
}]
return{
<ReactTable
Columns={columns}
/>
}
}
Я хочу, чтобы t1 упал на 1 день, нет проблем в заголовке t показывает сегодняшнюю дату, но я не показываю заголовок t1, на который я хочу деньи дает следующую ошибку.
{
Objects are not valid as a React child (found: Tue Apr 09 2019 12:19:07 GMT+0300 (GMT+03:00)). If you meant to render a collection of children, use an array instead.
in div (created by ReactTable)
in div (created by ThComponent)
in ThComponent (created by ReactTable)
in div (created by TrComponent)
in TrComponent (created by ReactTable)
in div (created by Thead)
in Thead (created by ReactTable)
in div (created by TableComponent)
in TableComponent (created by ReactTable)
in div (created by ReactTable)
in ReactTable (at drivingHours.jsx:229)
in div (created by Col)
in Col (created by Context.Consumer)
in ForwardRef(Bootstrap(Col)) (at drivingHours.jsx:228)
in div (created by Row)
in Row (created by Context.Consumer)
in ForwardRef(Bootstrap(Row)) (at drivingHours.jsx:227)
in div (created by Col)
in Col (created by Context.Consumer)
in ForwardRef(Bootstrap(Col)) (at drivingHours.jsx:226)
in DrivingHours (created by Connect(DrivingHours))
in Connect(DrivingHours) (at driverReports.jsx:42)
in div (created by TabPane)
in Transition (created by Fade)
in Fade (created by TabPane)
in TabPane (created by Context.Consumer)
in ForwardRef(Bootstrap(TabPane)) (created by Context.Consumer)
in ForwardRef(ContextTransform) (created by Tabs)
in div (created by TabContent)
in TabContent (created by Context.Consumer)
in ForwardRef(Bootstrap(TabContent)) (created by Tabs)
in TabContainer (created by Tabs)
in Tabs (created by Uncontrolled(Tabs))
in Uncontrolled(Tabs) (at src/index.js:127)
in ForwardRef (at driverReports.jsx:27)
in section (at driverReports.jsx:26)
in ControlledTabs (created by Connect(ControlledTabs))
in Connect(ControlledTabs) (created by Route)
in Route (at app/index.js:48)
in Switch (at app/index.js:41)
in main (at app/index.js:40)
in div (created by Row)
in Row (created by Context.Consumer)
in ForwardRef(Bootstrap(Row)) (at app/index.js:28)
in div (created by Container)
in Container (created by Context.Consumer)
in ForwardRef(Bootstrap(Container)) (at app/index.js:27)
in App (created by Connect(App))
in Connect(App) (created by Route)
in Route (created by withRouter(Connect(App)))
in withRouter(Connect(App)) (at src/index.js:14)
in div (at src/index.js:13)
in Router (created by ConnectedRouter)
in ConnectedRouter (created by Connect(ConnectedRouter))
in Connect(ConnectedRouter) (at src/index.js:12)
in Provider (at src/index.js:11)}
```