I have some problem when I want to get the date from JSON that output in format 31-10-2019 07:00:00
, I want to change that format to YYYY-MM-DD, but at the moment, the field still displays dd/mm/yyyy
, for more detail look at my code :
<FormGroup>
<Label for="expiredDate">Expired Date</Label>
<Input
type="date"
name="expiredDate"
onChange = {this.handleForm}
value = {moment(new Date(expiredDate)).format("YYYY-MM-DD")}
placeholder="date placeholder"
min = {moment().format("YYYY-MM-DD")}/>
</FormGroup>
Fixed it with
moment(expiredDate, 'DD/MM/YYYY hh:mm:ss').format('YYYY-MM-DD')