diff --git a/front/src/FormToucan.js b/front/src/FormToucan.js index e5a4e394c9ec7216c82fcca88112fe72feb0302f..64c713cc17b6b20557f8b54509e36edfbaf3f3d8 100644 --- a/front/src/FormToucan.js +++ b/front/src/FormToucan.js @@ -50,7 +50,7 @@ class FormToucan extends Component { onDateChange = (event,{value}) =>{ 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 = () => { diff --git a/front/src/ToucanLine.js b/front/src/ToucanLine.js index 2b8074ea0a0d446a765c6a64f76f530750144393..45efc119930ce985e5df4251f474d416cb71e9f3 100644 --- a/front/src/ToucanLine.js +++ b/front/src/ToucanLine.js @@ -10,15 +10,6 @@ class ToucanLine extends Component { 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() { this.setState({ isModalOpen: false }) } @@ -38,7 +29,7 @@ class ToucanLine extends Component { {this.props.toucan.title} </Table.Cell> <Table.Cell > - {this.date(this.props.toucan.date)} + {(new Date(this.props.toucan.date).toLocaleDateString())} </Table.Cell> <Table.Cell style={{width:"fit-content"}}> <Button negative icon="cancel" onClick={() => this.setState({isModalOpen: true})}/>