My API contains data for name and date. The type of name is a string, and the type of date is also a string. Additionally, this project includes the latest version of Vue.js.
postTodo(){
axios({
method: 'post',
url: 'my-api',
headers : {
token: this.token
},
data: {
name : "Hello",
// it's not working => JSON.stringify(new Date())
date : JSON.stringify(new Date())
}
}).catch(err => console.log(err))
.then( response =>
console.log(response))
}
This is a button to check the post request
<button @click="postTodo">Send To-Do</button>
I need to convert from a date object to a string. How can I solve this issue?