Skip to content
Snippets Groups Projects
Commit 6862c925 authored by Damien's avatar Damien
Browse files

Fix bug sur la date

parent ab6ba111
Branches
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ class FormToucan extends Component { ...@@ -50,7 +50,7 @@ class FormToucan extends Component {
onDateChange = (event,{value}) =>{ onDateChange = (event,{value}) =>{
let [day,month,year] = value.split("-") let [day,month,year] = value.split("-")
this.setState({date: new Date(year,month,day)}); this.setState({date: new Date(Date.UTC(year,month-1,day,0,0,0))},()=> console.log(this.state.date.toLocaleDateString()));
} }
onSubmit = () => { onSubmit = () => {
......
...@@ -10,15 +10,6 @@ class ToucanLine extends Component { ...@@ -10,15 +10,6 @@ class ToucanLine extends Component {
this.closeModal = this.closeModal.bind(this) this.closeModal = this.closeModal.bind(this)
} }
date(time){
const dateObject = new Date(time)
const year = dateObject.getFullYear();
const month = dateObject.getMonth();
const day = dateObject.getDay();
return (`${day+1}/${month+1}/${year}`)
}
closeModal() { closeModal() {
this.setState({ isModalOpen: false }) this.setState({ isModalOpen: false })
} }
...@@ -38,7 +29,7 @@ class ToucanLine extends Component { ...@@ -38,7 +29,7 @@ class ToucanLine extends Component {
{this.props.toucan.title} {this.props.toucan.title}
</Table.Cell> </Table.Cell>
<Table.Cell > <Table.Cell >
{this.date(this.props.toucan.date)} {(new Date(this.props.toucan.date).toLocaleDateString())}
</Table.Cell> </Table.Cell>
<Table.Cell style={{width:"fit-content"}}> <Table.Cell style={{width:"fit-content"}}>
<Button negative icon="cancel" onClick={() => this.setState({isModalOpen: true})}/> <Button negative icon="cancel" onClick={() => this.setState({isModalOpen: true})}/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment