I have date json format like this "YYYY-MM-DD" , so i do this in my tcomb form :
dob: {
returnKeyType: 'next',
testID: 'dobInput',
label: 'Birth date',
mode: 'date',
error:'',
config:{
format: (date) => {
return moment(date).format('YYYY-MM-DD');
},
}
but the return data still look like this "Sun Mar 08 2020 00:00:00 GMT+0000". So i try to reformat the value with moment when the value is set, like this :
const value = this.refs.form.getValue()
formatDob = moment(value.dob).format('YYYY-MM-DD')
value.dob = formatDob
console.log(value)
But the value still not change to "YYYY-MM-DD". How do i change the dob value format? please help, thankyou before
Try this. Hope help U